DeveloperDeveloper
  • Standard Solutions
  • Cam Solutions
  • Native SDKs
  • App Gallery
  • Game Engine Plugins
Forum
Projects Library
Dev Discord
  • Standard Solutions
  • Cam Solutions
  • Native SDKs
  • App Gallery
  • Game Engine Plugins
Forum
Projects Library
Dev Discord
  • Sync Methods

Sync Methods

If needed, these methods are available to manually handle video/audio syncing operations.

Workflow

Step 1: Load Pattern

Load Patterns. This step is required every time your user connects the app (Lovense Remote or VibeMate) to your platform, even when the audio/video is already playing.

ParametersDescriptionTypeRequired
typeThe pattern type, supports patterns from funScript and lovense (patterns created in Lovense software)stringYes
dataThe data of a patternarrayNo
patternLinkThe URL of a pattern's filestringNo
lovensePattern.loadPattern({
  type: "funScript",
  patternLink: "[pattern link]"// The funcript file download link
  data: [
    { pos: 50, at: 1000 },
    { pos: 80, at: 2000 },
    { pos: 20, at: 3000 },
  ], // FunScript data
})// If the data object is not null, this pattern data will be used first. Otherwise, pattern data is obtained from patternLink. If both are null, an error message will be returned.

lovensePattern.loadPattern({
  type: "lovense",
  patternLink: "[pattern link]"// The Lovense pattern file download link
  data: [
    { v: 10, t: 1000 },
    { v: 20, t: 2000 },
    { v: 5, t: 3000 },
  ], // Lovense Pattern data
})// If the data object is not null, this pattern data will be used first. Otherwise, pattern data is obtained from patternLink. If both are null, we will attempt to obtain patterns from our Lovense Pattern Editor(according to mediaId)), If it's null, an error message will be returned. Notice: we support third-party creating patterns from Lovense Pattern Editor according to mediaId)

Step 2: Play Pattern

The event patternLoaded will be triggered when the app (Lovense Remote or VibeMate) finishes loading Lovense patterns or patterns converted from Funscripts. Once you get the event patternLoaded, call the lovensePattern.play method automatically, then the toy will start syncing to the media. This step is required every time your user connects to the app (Lovense Remote or VibeMate) to your platform, even when the audio/video is already playing.

ParametersDescriptionTypeRequired
speedThe media playback speed (1 is normal speed)floatYes
currentTimeThe current playback time of the video (in ms)initYes
lovensePattern.on("patternLoaded", () => {
  console.log("patternLoaded")
  // The pattern is ready to be played.

  // When you play the video/audio content, call this method to play the pattern.
  lovensePattern.play({
    speed: 1, // The media playback speed (1 is normal speed)
    currentTime: 1000, // The playing time duration so far (in ms)
  })
})

Note: You only need to call lovensePattern.play within the event patternLoaded, when the event patternLoaded is triggered for the first time.

Step 3: Sync with Video/Audio

Call this method when the media is paused.

// Pause the pattern when the media is paused or loading, so the toy's reaction matches the media content.
lovensePattern.pause()

Call this method when the media's progress bar or speed changes.

ParametersDescriptionTypeRequired
speedThe media playback speed (1 is normal speed)floatYes
currentTimeThe playing time duration so far (in ms)initYes
// If the speed or progress changes while playing the media, call this method to re-sync the speed and time.
lovensePattern.change({
  speed: 1, // The media playback speed (1 is normal speed)
  currentTime: 1000, // The playing time duration so far (in ms)
})
Last Updated:
Explore our Forum or Support to get more inspiration or solve your problems.
Discord Channel
It is an online real-time channel where you can communicate directly with our official administrators or many excellent developers.
Forum
It is a place for Lovense developers to communicate, where you can find solutions to problems or get inspired for your projects.
Support
Find documents and tutorials that may be helpful to you.