Unable to add event listener to embed.player


#1
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, () => {
		console.log("HERE");
	});
	player.setQuality('160p30');
	player.setMuted(true);
});

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.

Thanks


#2

Bump - still trying to figure this out.


#3

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