Unable to add event listener to embed.player

const embed = new Twitch.Embed(`twitch-embed`, {
	width: 300,
	height: 500,
	channel: user
embed.addEventListener(Twitch.Embed.VIDEO_READY, () => {
	const player = embed.getPlayer();
	player.addEventListener(Twitch.Player.PLAY, () => {

I am unable to addEventLsitener to an embeds PLAYER as it is undefined.

API Reference claims that "To provide additional functionality to our API, access specific components with getPlayer() , which retrieves the current video player instance from the Embed, and provides full programmatic access to the video player API. Here

Related Thread: Internal

Sorry if this has been solved elsewhere, I was unable to find answers or resources to answer this.


1 Like

Bump - still trying to figure this out.

1 Like

Am unable to get your method working as well, however using the player itself does what you want correctly. https://jsfiddle.net/679q1gue/

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.