This is my first Twitch developer question, hope I’m doing this right. I am embedding several channels on my web page and I’m currently listening for the Twitch.Player.ONLINE eventListener in order to do something with that stream video. Question is: Once I’m able to call my function from the event I want to go ahead and remove the event listener, because I don’t want it being called anymore. Is that a possibility? My code looks something like this:
player.addEventListener(Twitch.Player.ONLINE, function() {
var channelName = player._bridge._playerState.channelName;
// do something with the channelName
player.removeEventListener(Twitch.Player.ONLINE);
});
@3ventic thanks so much! For some reason I was hesitant to use it like that because I thought the removeEventListener wouldn’t know ‘which’ player without me using ‘this’ keyword.