/
Events

Events

.EMBED_PLAYER_ADDED_TO_DOM

This event is dispatched when an embed player was added to the DOM, but not yet fully initialized. 

How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.EMBED_PLAYER_ADDED_TO_DOM, callback);


Example of the e callback argument

{
	type:"EMBED_PLAYER_ADDED_TO_DOM",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
	}
}


.EMBED_PLAYER_FULLY_READY

This event is dispatched when an embed player is fully initialized and ready to be used. At this stage is safe to use the TouchCastPlayerAPI.doAction() method. 

How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.EMBED_PLAYER_FULLY_READY, callback);


Example of the e callback argument

{
	type:"EMBED_PLAYER_FULLY_READY",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
	}
}


.PLAYER_VIDEO_PLAYED

This event is dispatched when an embed player has started playback, even if it's for the very first time or just a simple resume. 

How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.PLAYER_VIDEO_PLAYED, callback);


Example of the e callback argument

{
	type:"PLAYER_VIDEO_PLAYED",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
	}
}


.PLAYER_VIDEO_PAUSED

This event is dispatched when an embed player has paused playback. 

How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.PLAYER_VIDEO_PAUSED, callback);


Example of the e callback argument

{
	type:"PLAYER_VIDEO_PAUSED",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
	}
}


.PLAYER_VIDEO_ENDED

This event is dispatched when an embed player has finished playback and reached video end. 


How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.PLAYER_VIDEO_ENDED, callback);


Example of the e callback argument

{
	type:"PLAYER_VIDEO_ENDED",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
	}
}


.PLAYER_TIME_UPDATE

This event is dispatched during playback of an embed player. Use this to track playback time. 


How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.PLAYER_TIME_UPDATE, callback);


Example of the e callback argument

{
	type:"PLAYER_TIME_UPDATE",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
   		time:"1.38746" // the current timecode of the player in seconds
	}
}


.INTERACTIVE_EVENT

This event is dispatched after interactive event in an embed player.


How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.INTERACTIVE_EVENT, callback);


Example of the e callback argument

{
	type:"INTERACTIVE_EVENT",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
   		mode:"TCINTC",
		event:"OPEN",
		info:{
			x:0.5461847389558233,
			y:0.7534582775546631,
			title:"Hls tc in tc",
			time:19.920502,
			id:"2",
			type:"html",
			level: 2,
			url:"tc-player://load-touchcast?id=ba37868a3afa4fd2a449b5d02a0c7b1e",
		}
	}
}

{
	type:"INTERACTIVE_EVENT",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
   		mode:"TCINTC",
		event:"CLOSE",
		info:{
			type:"html",
			level: 0,
		}
	}
}

{
	type:"INTERACTIVE_EVENT",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
   		mode: null,
		event:"FAIL",
		info: null
	}
}


.CONTROLS_EVENT

This event is dispatched after controls event in an embed player.


How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.CONTROLS_EVENT, callback);

Example of the e callback argument

{
	type:"CONTROLS_EVENT",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
		event:"FULLSCREEN",
		value:false
	}
}


{
	type:"CONTROLS_EVENT",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
		event:"SUBTITLES",
		value: 'en'
	}
}

{
	type:"CONTROLS_EVENT",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
		event:"SUBTITLES",
		value: false
	}
}


.CURRENT_SUBTITLES

This event is dispatched after load or change video(Tc in Tc), returned current all available values of language


How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.CURRENT_SUBTITLES, callback);

Example of the e callback argument

{
	type:"CURRENT_SUBTITLES",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
		allLangs:[
			{
			"label":"Off",
			"value":"off"
			},{
			"label":"English",
			"value":"en"
			}
		]
	}
}


{
	type:"CURRENT_SUBTITLES",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
		allLangs: null
	}
}




.ANALYTICS_READY

This event is dispatched after load and init fabric analytics.


How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.ANALYTICS_READY, callback);

Example of the e callback argument

{
	type:"ANALYTICS_READY",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
	}
}




.HLS_QUALITY_LIST

This event is dispatched after parsed manifest of HLS.


How to subscribe?

TouchCastPlayerAPI.Event.subscribe(TouchCastPlayerAPI.events.HLS_QUALITY_LIST, callback);

Example of the e callback argument

{
	type:"HLS_QUALITY_LIST",
   	data:{
		videoId:"44df4sdfs55erw444wefw1", // the id of the touchcast video
    	playerId:"player_01" // the unique player id that was set when the player was embedded
		levels: [
			{value: 2, label: "720p"},
			{value: 1, label: "480p"},
			{value: 0, label: "360p"},
			{value: -1, label: "Auto"}
		]
	}
}