To be able to receive player events, call the registerEventListener method of the EvoWSPlayer or EvoWrtcPlayer and pass on to it a handler that accepts two parameters. The first parameter will be the eventName, and the second parameter, the eventData. Please note that not all events will include an eventData.
Example:
var player = new EvoWsPlayer ( options ) ;
player.registerEventListener ( function (event,description){
if ( event == 'transportclosed' ) {
// do something...etc.
}
});
List of Events
Player Events
| Event Name | Description |
|---|---|
| playerStarted | Emitted when the player actually starts playback of the stream |
| playerStopped | Emitted when the player is purposefully stopped (ex the stop button is pressed or the connection is lost) |
| playerFroze | Emitted when the player is detected to fail playback, possibly due to bad data, lost packets, etc. There is likely a needed time threshold for a hlated event to cross before this will be emitted |
| playerNoData | There is no data on the streaming channel |
| playerResume | Emitted when the play resumes from a pause or halt event |
| playerPause | Emitted with the player is purposely put into a pause state (we currently dont have this state, but will need to at some point) |
Connection Messages (WebSockets)
| Event Name | Description |
|---|---|
| transportEstablished | The connection to the EMS/server has been made |
| transportError | Emitted when a connection error to the EMS occurs |
| transportClosed | Emitted when the connection to the EMS is closed, either purposefully or from error |
WebRTC States
| Event Name | Description |
|---|---|
| joinedRoom | Player has connected with ERS |
| createdPeer | Local peering candidates have been created |
| checkingPeer | Remote peering candidates have been received and connection attempts are starting |
| chosenCandType | The type of candidate used for peering: host, reflex, or relay |
| connectedPeer | Route to peer has been established, streaming stack will now be setup |
| disconnectedPeer | Disconnected from a connected peer |
| connectFailedPeer | Could not connect to the peer |
| closePeer | Peering stack destructed |
Platform/Player Errors
| Event Name | Description |
|---|---|
| playeralert | Errors that are generated by the logic surrounding the player itself. For example: “Video element [element name] not found”, “MediaSource API is not enabled or supported” |
| playererror | Errors coming from the player itself. These will be specific for each platform. For example: AppendBuffer issue: [error from player], Media decode error. |
QOS Reports
| Event Name | Value | Description |
|---|---|---|
| rep-frameloss | frame loss count | Emitted once per second, with the numbers of frames dropped/lost during that last second |
| rep-estthroughput | estimated throughput in kbps | Emitted once per second, a running calculation of the amount of data we are ingesting |
QOS Accessor Functions
| Event Name | Description |
|---|---|
| getAggFrameLoss | Get function for obtaining total frame loss |
| getAggPacketLoss | Get function for obtaining total packet loss |