-
Notifications
You must be signed in to change notification settings - Fork 3
Player
Plays a content or channel.
// Channel content
R7('play', { channelId }, callback)
R7('play', { channelNumber }, callback)
// Video content streaming
R7('play', { uri, [position], [resumePlaying], [fileSystem], [metadata] }, callback)To play a channel:
-
channelorchannelNumberChannel with the given channelNumber -
channelIdChannel with the given channelId
To play a video content:
-
uriAn uri that the player would play. -
[position]The position in milliseconds at which the video will be started. -
[resumePlaying]If true and the content is read from file system, the player will try to resume the position to the previously known stop position. -
[fileSystem]If true will ensure that the content you will play will be read from the file system as a PDL or Record -
[metadata]Custom content attributes for the content.- see the program's metadata page for program's metadata
-
durationin milliseconds is mandatory to have a valid timeline inside the player. -
mpeg2tsas a boolean is required for MPEG2TS contents to make the position option to work. -
totalSizein bytes is required for MPEG2TS contents to make the position option work.
Stops the currently playing.
R7('stop', callback);Change the speed of the content (default: 1). Also used to resume paused content.
// General function. speed is a number and not mandatory
R7('resume', speed, callback)
// Play a paused content
R7('resume', callback)
// Play at 2* normal speed
R7('resume', 2, callback)
// Play at 0.5* normal speed
R7('resume', 0.5, callback)Pause the playing content. Equivalent to resume with speed at 0.
R7('pause', callback)Returns the player metadata. New : return the available subtitles and audiotracks. Live is now updated and delivers all informations needed
R7('getPlayer', callback){
"metadata": {
"channelId": 9104,
"uri": "null://",
"channelNumber": 99
},
"uri": "null://",
"parentalMaxRating": 8,
"status": "stopped"
}-
statusState of the player: 'paused', 'playing' or 'stopped'
Returns the player progression information.
R7('getPlayerProgress', callback){
"buffer": 37.316269841269836,
"duration": 252000,
"position": 37.316269841269836,
"relative": 94037,
"type": "video"
}-
relativeposition of the player -
durationduration of the content (passed in play arguments) -
positionposition of the player in percent
Returns the list of available player's audio tracks.
R7('getPlayerAudioTracks', callback)[
{
"active": false,
"AudioPid": "230",
"AudioLang": "fra",
"AudioComponentTag": "0",
"AudioCodec": "eac3",
"AudioLangType": "0",
"languageInFrench": "français"
}
]-
activeTrue if player's audio track is current -
AudioPidAudio Packet Identifier of the track -
AudioLangAudio Language descriptor -
languageInFrenchFrench name of the audio track
Sets a selected audio track as the active audio track of the player.
R7('setPlayerAudioTrack', audiotrack, callback)-
audiotrack: Hash description of the audio track. SeegetPlayerAudioTracks.
Returns video frame coordinates (available since webapp version 1.11.2).
R7('getVideoFrame', callback)-
xleft position of the current video frame in pixels -
ytop position of the current video frame in pixels -
widthcurrent width of the video frame in pixels -
heightcurrent height of the video frame in pixels
Sets video frame coordinates (available since webapp version 1.11.2).
R7('setVideoFrame', coord, callback)-
xleft position of the current video frame in pixels -
ytop position of the current video frame in pixels -
widthcurrent width of the video frame in pixels -
heightcurrent height of the video frame in pixels
Restores video frame to FULL SCREEN (available since webapp version 1.11.2).
R7('restoreVideoFrame', callback)// Simple content without license
R7('play', {
uri: 'http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_surround-fix.avi',
metadata: {
duration: 600000, // in milliseconds,
titleLbl: 'Big Buck Bunny'
}
}, callback);// MPEG2TS content with a seek at 10 seconds before play
R7('play', {
uri: 'http://baz.quz/video.ts',
position: 10e3 // in milliseconds
metadata: {
mpeg2ts: true,
duration: 600e3, // in milliseconds
totalSize: 30e6, // in bytes
}
}, callback)// Content played from filesystem after download
R7('download', { extId: 123, catalog: 'cplusald' }, function(err, vod) {
if (err) {
return console.error(err);
}
R7('play', { uri: vod.uri, fileSystem: true } function(err, pdl) {
if (err) {
console.error(err);
} else {
console.log(pdl);
}
});
});// Stop and Play
R7('stop', function(err) {
if (err) { return; }
R7('play', { uri: 'http://...' }, callback);
});R7('getPlayerAudioTracks', function(err, audiotracks) {
var eng = _.where(audiotracks, function(at) {
return at.AudioLang === 'eng';
});
if (!err && eng) {
R7('setPlayerAudioTrack', eng);
}
});var width, height;
R7('getVideoFrame', function(err, data) {
if (!err & data) {
width = data.witdh;
height = data.height;
R7('setVideoFrame', {
x: width * 0.25,
y: height * 0.25,
width: width * 0.5,
height: height * 0.5,
});
}
});