This method handles player events.
args
- request object; parameters described below
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 user action, can be either: start
, end
, pause
or resume
.
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 user took the action.
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.