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.
Parameters | Description | Type | Required |
---|---|---|---|
type | The pattern type, supports patterns from funScript and lovense (patterns created in Lovense software) | string | Yes |
data | The data of a pattern | array | No |
patternLink | The URL of a pattern's file | string | No |
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.
Parameters | Description | Type | Required |
---|---|---|---|
speed | The media playback speed (1 is normal speed) | float | Yes |
currentTime | The current playback time of the video (in ms) | init | Yes |
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 eventpatternLoaded
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.
Parameters | Description | Type | Required |
---|---|---|---|
speed | The media playback speed (1 is normal speed) | float | Yes |
currentTime | The playing time duration so far (in ms) | init | Yes |
// 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)
})