This method handles player events.
args - request object; parameters described below
A promise resolving to an event response. Stremio does not wait for or use the response.
type - type of the item that we’re emitting player events for; e.g. movie, series, channel, tv (see Content Types)
id - a Video ID as described in the Video Object
The Video ID is the same as the Meta ID for movies.
For IMDB series (provided by Cinemeta), the video ID is formed by joining the Meta ID, season and episode with a colon (e.g. "tt0898266:9:17").
extra - object that holds additional properties; defined below
config - object with user settings, see Manifest - User Data
action - set in the extra object; a string defining the player state, can be either: start (playback started or resumed), pause or stop (player closed, video changed or ended). A seek re-sends the current state with the new currentTime.
duration - set in the extra object; string specifying the full duration of the video in milliseconds.
currentTime - set in the extra object; string in milliseconds specifying the progress from the start of the video when the event happened.
builder.definePlayerHandler(function(args) {
if (args.type === 'movie' && args.id === 'tt1254207') {
// handle the player event
return Promise.resolve({ success: true })
} else {
// otherwise return false
return Promise.resolve({ success: false })
}
})
Note: You may require additional metadata for the requested item (such as name, releaseInfo, etc), if the requested ID is a IMDB ID (Cinemeta, for example, uses only IMDB IDs), then please refer to Getting Metadata from Cinemeta for this purpose.