Control Interface
cyberplayer
Parameter list: String -Player DIV container id for containing the player
Return type: Object
Interface features: Create a player instance in the assigned DIV container
Code example:
var myPlayer = cyberplayer("playerContainer").setup({
width:600,
height:450,
file:"http://ip:port/playlist.m3u8",
image: "<Image_File>"
});
cyberplayer:setup
Parameter list: Object
Return type: None
Interface features: Create a player
Code example:
var myPlayer = cyberplayer("playerContainer").setup({
flashplayer:"player/cyberplayer.flash.swf ",
width:600,
height:450,
file:" http://ip:port/playlist.m3u8",
image: "<Image_File>
controlbar: {
barLogo: false
}
});
Detailed parameter annotation: There is only one Object type parameter in setup, the parameter is a parameter set, and the parameter elements and usage methods of the set are described as follows:
Parameter name | Parameter interpretation | Comments |
---|---|---|
flashplayer | Specify the storage address for swf files of the flash player. It can be a relative path or an absolute path beginning with the http protocol. If this parameter is omitted, it automatically searches the cyberplayer.flash.swf file in the path where js is located. | Optional |
width | Assign the play window width to create. | Specify the height of the playback window to be created. Required |
height | Specify the height of the playback window to be created. | Required |
playlist | Please see:Fulfill list playback. | Optional |
imageAdvs | Display the image ads at the beginning, end and pause of the video, with the image in the format of gif, png and jpeg supported. The start is the opening advertisement parameter, pause is the pausing advertisement parameter and end is the ending advertisement parameter. Image parameter means to display the image address, url means link address and time means the opening advertisement display duration, with the unit of second. When displaying the pausing advertisement image, it is zoomed to be 400x300, you are suggested to use the image with the width and height proportion of 4:3 as the pausing advertisement. imageAdvs : { start : { image : "http://xxxx/abc.gif", url : "http://xxxx", time : 10 }, pause : { image : " http://xxxx/abc.gif ", url : " http://xxxx" }, end : { image : " http://xxxx/abc.gif ", url : " http://xxxx" } } | Optional |
autostart | Set whether to auto play after loading the player: true :Automatic playback;false : Do not play automatically. | Optional |
repeat | Set repeat play modes of the videos, the repeat modes are: 1.false:No duplicates; 2.true:Repeat playback | Optional |
file | Set media stream name or filename or M3U8 playlist address | Required |
image | Set the media stream preview | Optional |
volume | Set the player sound volume size, range(0 - 100) | Optional |
controls | Set the player control bar display modes, which include: 1.none:Do not show; 2.over:Suspension(The mouse is automatically hidden if there is no operations) | Optional |
barLogo | Set whether to display Logo, sub-parameter of `controls`, the selectable values are true (display) and false (not display) | Optional |
skin | Set player skin packs | Optional |
stretching | Set the player zoom methods, which include: 1.none:No zoom; 2.uniform:Add black-edge scaling; 3. exactfit:Change the aspect ratio to the maximum; 4.fill:Cut and zoom to the max(uniform method by default) | Optional |
Parameter name | Parameter interpretation | Comments |
---|---|---|
flashplayer | Specify the storage address for swf files of the flash player. It can be a relative path or an absolute path beginning with the http protocol. If this parameter is omitted, it automatically searches the cyberplayer.flash.swf file in the path where js is located. |
Optional |
width | Assign the play window width to create. | Specify the height of the playback window to be created. Required |
height | Specify the height of the playback window to be created. | Required |
playlist | Please see Realize List Play | Optional |
imageAdvs | Display the image ads at the beginning, end and pause of the video, with the image in the format of gif, png and jpeg supported. The start is the opening advertisement parameter, pause is the pausing advertisement parameter and end is the ending advertisement parameter. Image parameter means to display the image address, url means link address and time means the opening advertisement display duration, with the unit of second. When displaying the pausing advertisement image, it is zoomed to be 400x300, you are suggested to use the image with the width and height proportion of 4:3 as the pausing advertisement. imageAdvs : { start : { image : "http://xxxx/abc.gif", url : "http://xxxx", time : 10 }, pause : { image : " http://xxxx/abc.gif ", url : " http://xxxx" }, end : { image : " http://xxxx/abc.gif ", url : " http://xxxx" } } |
Optional |
autostart | Set whether to auto play after loading the player: true :Automatic playback;false : Do not play automatically. | Optional |
repeat | Set repeat play modes of the videos, the repeat modes are: 1.false:No duplicates; 2.true:Repeat playback |
Optional |
file | Set media stream name or filename or M3U8 playlist address | Required |
image | Set the media stream preview | Optional |
volume | Set the player sound volume size, range(0 - 100) | Optional |
controls | Set the player control bar display modes, which include: 1.none:Do not show; 2.over:Suspension(The mouse is automatically hidden if there is no operations) |
Optional |
barLogo | Set whether to display Logo, sub-parameter of controls , the selectable values are true (display) and false (not display) |
Optional |
skin | Set player skin packs | Optional |
stretching | Set the player zoom methods, which include: 1.none:No zoom; 2.uniform:Add black-edge scaling; 3. exactfit:Change the aspect ratio to the maximum; 4.fill:Cut and zoom to the max(uniform method by default) |
Optional |
cyberplayer: remove
Parameter list: None
Return type: None
Interface features: Remove the current player.
Code example:
myPlayer.remove();
cyberplayer: getPlaylist
Parameter list: None
Return type: Array
Interface features: Get the current playlist.
Code example:
var playlist = myPlayer. getPlaylist();
cyberplayer: getPlaylistIndex
Parameter list: None
Return type: Number
Interface features: Get the currently played video position in the playlist, 0 stands for the first and so forth.
Code example:
var playlistIndex = myPlayer. getPlaylistIndex();
cyberplayer: getPlaylistItem
Parameter list: None
Return type: Object
Interface features: Get the currently played video object.
Code example:
var playlistItem = myPlayer. getPlaylistItem();
cyberplayer: playlistItem
Parameter list: Number
Return type: Object
Interface features: Play the assigned play list and return the item object, the list begins counting from 0.
Code example:
var item = myPlayer.playlistItem(2);
cyberplayer: playlistNext
Parameter list: None
Return type: Object
Interface features: Play the item after the current playing item, and return the item object.
Code example:
var item = myPlayer.playlistNext();
cyberplayer: playlistPrev
Parameter list: None
Return type: Object
Interface features: Play the previous item of the currently played item, and return the item object.
Code example:
var item = myPlayer.playlistPrev();
cyberplayer: getBuffer
Parameter list: None
Return type: Object
Interface features: Get the currently played video cache duration, with the unit of second.
Code example:
var buffer = myPlayer. getBuffer();
cyberplayer: getState
Parameter list: None
Return type: String
Interface features: Get the current player status.
Code example:
var state = myPlayer.getState();
Value range: {“playing”、“paused”、“idle”、“buffering”}
cyberplayer: play
Parameter list: None
Return type: None
Interface features: Start to play the current media contents.
Code example:
myPlayer.play();
cyberplayer: pause
Parameter list: None
Return type: Number
Interface features: Pause the current media contents.
Code example:
myPlayer.pause();
cyberplayer: stop
Parameter list: None
Return type: None
Interface features: Stop playing the current media content.
Code example:
myPlayer.stop();
cyberplayer: getDuration
Parameter list: None
Return type: Number -The total duration of the currently played media file
Interface features: Get the total duration of the currently played media file.
Code example:
var duration = myPlayer.getDuration();
cyberplayer: getPosition
Parameter list: None
Return type: Number
Interface features: Get the play position of the currently played media file.
Code example:
var position = myPlayer.getPosition();
cyberplayer: seek
Parameter list: Number -The play time duration of the target
Return type: None
Interface features: Locate the place where the current media content begins to play.
Code example:
myPlayer.seek(102);
cyberplayer: getMute
Parameter list: None
Return type: Boolean - true :Enable the sound; false : Open the sound
Interface features: Get whether the sound of the current player is enabled.
Code example:
var mute = myPlayer.getMute();
cyberplayer: getVolume
Parameter list: None
Return type: Number
Interface features: Get the current player volume.
Code example:
var volume = myPlayer.getVolume();
cyberplayer: setMute
Parameter list: Boolean - true :Turn off sound;false : Enable sound
Return type: None
Interface features: Set the sound switch for current player.
Code example:
myPlayer.setMute(true);
cyberplayer: setVolume
Parameter list: Number -Volume(0-100)
Return type: None
Interface features: Set the player volume.
Code example:
myPlayer.setVolume(90);
cyberplayer: getWidth
Parameter list: None
Return type: Number
Interface features: Get the current player window width.
Code example:
var width = myPlayer.getWidth();
cyberplayer: getHeight
Parameter list: None
Return type: Number -Player height
Interface features: Get the current display window height of the player.
Code example:
var height = myPlayer.getHeight();
cyberplayer: getFullscreen
Parameter list: None
Return type: Boolean - true :Full-screen ;false : Non full screen
Interface features: Get whether the current player is in full-screen status.
Code example:
var fullscreen = myPlayer.getFullscreen();
cyberplayer: resize
Parameter list: Number -Width of the player, Number -Player height
Return type: None
Interface features: Adjust the player size.
Code example:
myPlayer.resize(600, 400);
cyberplayer: setFullscreen
Parameter list: Boolean - true :Full-screen;false : Non full screen
Return type: None
Interface features: Set whether the current player is full-screen.
Code example:
myPlayer.setFullscreen(true);
cyberplayer: getQualityLevels
Parameter list: None
Return type: Array
Interface features: Get all the code rates of the current video.
Code example:
var qualityLevels = myPlayer.getQualityLevels();
cyberplayer: getCurrentQuality
Parameter list: None
Return type: Number
Interface features: Get the currently played video code rate index, starting with 0.
Code example:
var currentQuality = myPlayer.getCurrentQuality();
cyberplayer: setCurrentQuality
Parameter list: Number
Return type: Object
Interface features: Set to play the video with certain code rate.
Code example:
myPlayer.setCurrentQuality(1);
cyberplayer: getControls
Parameter list: None
Return type: Boolean
Interface features: Get whether the controlbar of the player can be showed.
Code example:
var controls = myPlayer.getControls();
cyberplayer: getSafeRegion
Parameter list: None
Return type: Object
Interface features: Get the location object of the player.
Code example:
var region = myPlayer.getSafeRegion();
cyberplayer: setControls
Parameter list: Boolean - true :display;false : Do not show
Return type: Object
Interface features: Set whether the player displays controlbar.
Code example:
myPlayer.setControls();
cyberplayer: getMeta
Parameter list: None
Return type: Object -Metadata object
Interface features: Get the currently played media file metadata object.
Code example:
var meta = myPlayer.getMeta();
cyberplayer: getRenderingMode
Parameter list: None
Return type: String -Rendering mode
Interface features: Get the rendering mode of the current player.
Code example:
var mode = myPlayer.getRenderingMode();
Value range: {“flash”、“html5”}
cyberplayer: getCaptionsList
Parameter list: None
Return type: Array
Interface features: Get all the character objects of the current video.
Code example:
var captionList = myPlayer.getCaptionList();
cyberplayer: getCurrentCaptions
Parameter list: None
Return type: Number
Interface features: Get the currently used character file index, starting with 0.
Code example:
var currentCaptions = myPlayer.getCurrentCaptions();
cyberplayer: setCurrentCaptions
Parameter list: Number
Return type: Object
Interface features: Set to use a certain specific subtitle.
Code example:
myPlayer.setCurrentCaptions(1);
cyberplayer: on
Player event monitoring method, which is activated after executing a certain action. E.g.:
myPlayer.on('play', function () {
alert('The video has already played');
});
Similar incidents are
ready, setupError, playlist, playlistItem, playlistComplete, bufferChange, play, pause, buffer, idle, complete, error, seek, seeked, time, mute, volume, fullscreen, resize, levels, levelsChanged, captionsList, captionsChange, controls, displayClick, meta
, etc.