Description
The method TouchCastPlayerAPI.Event.subscribe()
allows you to subscribe to a range of events defined by the SDK,
and run callback functions for when the event is fired.
Code Block |
---|
|
TouchCastPlayerAPI.Event.subscribe(event, callback);
|
...
Name | Description | Type |
---|
event | The name of the event type you want to subscribe to. Click here for a list of all events. | string |
callback | This is the callback function that is triggered when the event is fired. You can add multiple callbacks to the same event, by calling .Event.subscribe() again with a different callback. All the callbacks you've added will be triggered when the event takes place. See the table below Callback Parameters for a list of all the arguments the callback function will receive. | function |
Callback Parameters
Name | Description | Type |
---|
e | An object with these properties:type[string] - the type of the event dispatched.data[object] - This is an object with different properties and it's different based on the event type.
| object |
Output
This method has no output.
Example
Code Block |
---|
|
TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.VIDEO_ENDED, event_callback_video_ended);
function event_callback_video_ended (e) {
// do something here
}
|