Classes
Events
-
onDestroy
-
The destroy event to pass in the 'config.events' object at the setup call. Fires if the player is destroyed.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object (empty).
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onDestroy = function (event) { console.log('player destroy'); }; config.events.onDestroy = onDestroy; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onError
-
The error event to pass in the 'config.events' object at the setup call. Fires if any kind of error occures.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description codeNanoPlayer~errorcode The error code.
messagestring The error cause as human readable string.
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onError = function (event) { alert('Error: ' + event.data.code + ' ' + event.data.message); }; config.events.onError = onError; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onLoading
-
The load event to pass in the 'config.events' object at the setup call. Fires if playout was stopped or player is ready after setup and tries to play.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description connectDelaynumber The time in milliseconds to wait for initializing the connection to the server to get the stream. Is zero if no reconnect is imminent.
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onLoading = function (event) { console.log('Loading with delay of ' + event.data.connectDelay + ' milliseconds'); }; config.events.onLoading = onLoading; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onMetaData
-
The metadata event to pass in the 'config.events' object at the setup call. The config param 'playback.metadata' have to be set to true. Fires if the player receives metadata.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description handlerNamestring The name of the metadata handler.
message* The metadata message.
streamTimenumber The timestamp of the metadata in relation to currentTime.
Example
// player instance of NanoPlayer var onMetaData = function (event) { console.log('MetaData: ' + JSON.stringify(event.data)); }; config.events.onMetaData = onMetaData; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onMute
-
The mute event to pass in the 'config.events' object at the setup call. Fires if the player is muted.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description volumenumber The current volume in a range from 0.0 to 1.0.
Example
// player instance of NanoPlayer var onMute = function (event) { console.log('Muted with volume: ' + event.data.volume); }; config.events.onMute = onMute; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onPause
-
The pause event to pass in the 'config.events' object at the setup call. Fires if playout is paused.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description reasonNanoPlayer~pausereason The reason of pausing.
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onPause = function (event) { console.log('Pause'); if (event.data.reason !== 'normal') { alert('Paused with reason: ' + event.data.reason); } }; config.events.onPause = onPause; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onPlay
-
The play event to pass in the 'config.events' object at the setup call. Fires if playout is started.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description statsobject The startup stats object.
Properties
Name Type Description connectingnumber The time when 'player.play()' is just called in ms (always zero).
connectednumber The time when the connection is established in ms (relative to 'connecting').
firstFragmentReceivednumber The time when the first fragment is received in ms (relative to 'connecting').
firstFrameRenderednumber The time when the first frame is rendered in ms (relative to 'connecting').
playablenumber The time when the buffer has enough data to start in ms (relative to 'connecting').
playingnumber The time when the playback is started in ms (relative to 'connecting'). It's the total startup time.
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onPlay = function (event) { console.log('Playing'); console.log('play stats: ' + JSON.stringify(event.data.stats)); }; config.events.onPlay = onPlay; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onReady
-
The ready event to pass in the 'config.events' object at the setup call. Fires if the player is ready to play after successful setup.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description configconfig The config object.
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onReady = function (event) { console.log('Ready: ' + JSON.stringify(event.data.config)); } config.events.onReady = onReady; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onStartBuffering
-
The start buffering event to pass in the 'config.events' object at the setup call. Fires if playout is started but no media is available.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object (empty).
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onStartBuffering = function (event) { console.log('Buffering'); }; config.events.onStartBuffering = onStartBuffering; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onStats
-
The stats event to pass in the 'config.events' object at the setup call. Fires if the player has measured statistics.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description statsobject The stats object.
Properties
Name Type Description currentTimenumber The current time of the video.
playoutobject The playout object.
Properties
Name Type Description startnumber The start play time of the video.
endnumber The end play time of the video.
bufferobject The buffer object.
Properties
Name Type Description startnumber The start buffer time of the video.
endnumber The end buffer time of the video.
delayobject The delay buffer object.
Properties
Name Type Description currentnumber The current delay time.
avgnumber The average delay time over the last second.
minnumber The minimum delay time over the last second.
maxnumber The maximum delay time over the last second.
bitrateobject The bitrate object.
Properties
Name Type Description currentnumber The current bitrate in Bit/s. Is '0' if not available. NOT AVAILABLE FOR IOS.
avgnumber The average bitrate in Bit/s over the last 10 seconds. Is '0' if not available. NOT AVAILABLE FOR IOS.
minnumber The minimum bitrate in Bit/s over the last 10 seconds. Is '0' if not available. NOT AVAILABLE FOR IOS.
maxnumber The maximum bitrate in Bit/s over the last 10 seconds. Is '0' if not available. NOT AVAILABLE FOR IOS.
framerateobject The framerate object.
Properties
Name Type Description currentnumber The current network framerate. Is '0' if not available. NOT AVAILABLE FOR IOS.
avgnumber The average network framerate over the last 10 seconds. Is '0' if not available. NOT AVAILABLE FOR IOS.
minnumber The minimum network framerate over the last 10 seconds. Is '0' if not available. NOT AVAILABLE FOR IOS.
maxnumber The maximum network framerate over the last 10 seconds. Is '0' if not available. NOT AVAILABLE FOR IOS.
qualityobject The video playback quality object.
Properties
Name Type Description corruptedVideoFramesnumber The total number of corrupted video frames. ONLY AVAILABLE FOR FIREFOX.
corruptedVideoFramesCurrentnumber The number of corrupted video frames within the last second. ONLY AVAILABLE FOR FIREFOX.
creationTimenumber The time in miliseconds since the start of the navigation and the creation of the video element. ONLY AVAILABLE FOR FIREFOX.
droppedVideoFramesnumber The total number of dropped video frames. ONLY AVAILABLE FOR FIREFOX.
droppedVideoFramesCurrentnumber The number of dropped video frames within the last second. ONLY AVAILABLE FOR FIREFOX.
totalVideoFramesnumber The total number of created and dropped video frames since creation of the video element. ONLY AVAILABLE FOR FIREFOX.
Example
// player instance of NanoPlayer var onStats = function (event) { console.log('Stats: ' + JSON.stringify(event.data.stats)); }; config.events.onStats = onStats; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onStopBuffering
-
The stop buffering event to pass in the 'config.events' object at the setup call. Fires if playout resumes after buffering.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object (empty).
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onStopBuffering = function (event) { console.log('Resume'); }; config.events.onStopBuffering = onStopBuffering; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onStreamInfo
-
The stream info event to pass in the 'config.events' object at the setup call. Fires if informations about a stream is available right before playback starts.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description streamInfoobject The stream info object.
Properties
Name Type Description urlstring The complete stream url with parameters.
haveAudioboolean Indicates if the stream contains audio.
haveVideoboolean Indicates if the stream contains video.
audioInfoobject | null The audio info object. Is 'null' if the stream contains no audio.
Properties
Name Type Description bitsPerSamplenumber | null The bits per sample. Is 'null' if not available. NOT AVAILABLE FOR IOS.
sampleRatenumber | null The audio sample rate. Is 'null' if not available. NOT AVAILABLE FOR IOS.
channelsnumber | null The number of audio channels. Is 'null' if not available. NOT AVAILABLE FOR IOS.
videoInfoobject | null The stream info object. Is 'null' if the stream contains no video.
Properties
Name Type Description widthnumber | null The width of the video. Is 'null' if not available.
heightnumber | null The height of the video. Is 'null' if not available.
frameRatenumber | null The video frame rate. Is 'null' if not available. NOT AVAILABLE FOR IOS.
Example
// player instance of NanoPlayer var onStreamInfo = function (event) { console.log('StreamInfo: ' + JSON.stringify(event.data.streamInfo)); }; config.events.onStreamInfo = onStreamInfo; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onStreamInfoUpdate
-
The stream info event to pass in the 'config.events' object at the setup call. Fires if the stream format has changed during playback.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description streamInfoobject The stream info object.
Properties
Name Type Description urlstring The complete stream url with parameters.
haveAudioboolean Indicates if the stream contains audio.
haveVideoboolean Indicates if the stream contains video.
audioInfoobject | null The audio info object. Is 'null' if the stream contains no audio.
Properties
Name Type Description bitsPerSamplenumber | null The bits per sample. Is 'null' if not available. NOT AVAILABLE FOR IOS.
sampleRatenumber | null The audio sample rate. Is 'null' if not available. NOT AVAILABLE FOR IOS.
channelsnumber | null The number of audio channels. Is 'null' if not available. NOT AVAILABLE FOR IOS.
videoInfoobject | null The stream info object. Is 'null' if the stream contains no video.
Properties
Name Type Description widthnumber | null The width of the video. Is 'null' if not available.
heightnumber | null The height of the video. Is 'null' if not available.
frameRatenumber | null The video frame rate. Is 'null' if not available. NOT AVAILABLE FOR IOS.
Example
// player instance of NanoPlayer var onStreamInfoUpdate = function (event) { console.log('StreamInfo updated: ' + JSON.stringify(event.data.streamInfo)); }; config.events.onStreamInfoUpdate = onStreamInfoUpdate; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onUnmute
-
The unmute event to pass in the 'config.events' object at the setup call. Fires if the player is unmuted.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description volumenumber The current volume in a range from 0.0 to 1.0.
Example
// player instance of NanoPlayer var onUnmute = function (event) { console.log('Unmuted with volume: ' + event.data.volume); }; config.events.onUnmute = onUnmute; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onUpdateSourceAbort
-
The event to signal that the update source request is aborted. Reasons can be an equal source ('equalsource'), a superseding ('superseded') or an to less time range between two 'updateSource' calls ('updatefrequency'). This is an completion event that follows on an start event.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description reasonstring The options object used for the
'updateSource'call. Possible values are 'equalsource', 'superseded' and 'updatefrequency'.tagstring The custom tag string given in the options object of the
'updateSource'call. Is an empty string if not set.countnumber The count of the update source request to identify the paired start and completion event. The start event is
'onUpdateSourceInit'and completion events are'onUpdateSourceSuccess','onUpdateSourceFail'and'onUpdateSourceAbort'stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onUpdateSourceAbort = function (event) { console.log('Update Source Abort with source: ' + JSON.stringify(event.data.source) + ' and options: ' + JSON.stringify(event.data.options)); console.log('tag: ' + event.data.tag); console.log('count: ' + event.data.count); }; config.events.onUpdateSourceAbort = onUpdateSourceAbort; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onUpdateSourceFail
-
The event to signal that the update source request is failed. Fired if an error occure during the update. This is an completion event that follows on an start event.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description codeobject The error code. Similar to the
errorcodes.messageobject The error message.
tagstring The custom tag string given in the options object of the
'updateSource'call. Is an empty string if not set.countnumber The count of the update source request to identify the paired start and completion event. The start event is
'onUpdateSourceInit'and completion events are'onUpdateSourceSuccess','onUpdateSourceFail'and'onUpdateSourceAbort'stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onUpdateSourceFail = function (event) { console.log('Update Source Fail with error code: ' + event.data.code + ' and error message: ' + event.data.message); console.log('Update Source tag: ' + event.data.tag); console.log('Update Source count: ' + event.data.count); }; config.events.onUpdateSourceFail = onUpdateSourceFail; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onUpdateSourceInit
-
The event to signal that the update source request is initialized. This is always the start event, an completion event will follow.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description sourceobject The source object given in the
'updateSource'call.optionsobject The options object used for the
'updateSource'call.tagstring The custom tag string given in the options object of the
'updateSource'call. Is an empty string if not set.countnumber The count of the update source request to identify the paired start and completion event. The start event is
'onUpdateSourceInit'and completion events are'onUpdateSourceSuccess','onUpdateSourceFail'and'onUpdateSourceAbort'stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onUpdateSourceInit = function (event) { console.log('Update Source Init with source: ' + JSON.stringify(event.data.source) + ' and options: ' + JSON.stringify(event.data.options)); console.log('Update Source tag: ' + event.data.tag); console.log('Update Source count: ' + event.data.count); }; config.events.onUpdateSourceInit = onUpdateSourceInit; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onUpdateSourceSuccess
-
The event to signal that the update source request is succeeded. Fires if the source is updated. This is an completion event that follows on an start event.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description tagstring The custom tag string given in the options object of the
'updateSource'call. Is an empty string if not set.countnumber The count of the update source request to identify the paired start and completion event. The start event is
'onUpdateSourceInit'and completion events are'onUpdateSourceSuccess','onUpdateSourceFail'and'onUpdateSourceAbort'stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onUpdateSourceSuccess = function (event) { console.log('Update Source Success with tag: ' + event.data.tag + ' and count: ' + event.data.count); }; config.events.onUpdateSourceSuccess = onUpdateSourceSuccess; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onVolumeChange
-
The volume change event to pass in the 'config.events' object at the setup call. Fires if the player's volume has changed.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description volumenumber The current volume in a range from 0.0 to 1.0.
Example
// player instance of NanoPlayer var onVolumeChange = function (event) { console.log('Volume: ' + event.data.volume); }; config.events.onVolumeChange = onVolumeChange; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); }); -
onWarning
-
The error event to pass in the 'config.events' object at the setup call. Fires if something is not as expected, but functionality works.
Type: object
- See:
Properties:
Name Type Description namestring The event name.
playerstring The player name (id of the playerDiv).
idstring The unique id of the player instance.
versionstring The version of the player.
dataobject The data object.
Properties
Name Type Description messagestring The warning as human readable string.
stateNanoPlayer~state The player state.
Example
// player instance of NanoPlayer var onWarning = function (event) { console.log('Warning: ' + event.data.message); }; config.events.onWarning = onWarning; player.setup(config).then(function (config) { console.log('setup ok with config: ' + JSON.stringify(config))); }, function (error) { console.log(error); });