Twitch.Player events not firing the way they used to - change in behavior?

Hi folks. I’ve noticed what appears to be a change in Twitch.Player events that fire when a stream goes offline, when dealing with interactive player embeds and the twitch.js library.

I’ve set up a simple test page to test which events fire when the stream goes online or offline, and when:

        html, body {
            margin: 0;
            padding: 0;
        #container {
            display: flex;
            flex-flow: row nowrap;

        #streams {
            flex: 0 0 60%;

        #log {
            flex: 0 0 40%;

        #container > div {
            height: 100vh;
            overflow-y: auto;

        #streams > div {
            width: 100%;
            height: 480px;
<script src= ""></script>
<script src=""></script>
<div id="container">
    <div id="streams"></div>
    <div id="log">
        Events will appear here.
        <ul id="event-list"></ul>
<script type="text/javascript">
    var options = {width: '100%', height: '100%', channel: 'Argus9'};
    var id = 'player-' + 'Argus9';
    $('#streams').append('<div id="' + id + '"></div>');
    var player = new Twitch.Player(id, options);

    player.addEventListener(Twitch.Player.ONLINE, function () {
        $('#event-list').append('<li style="color: darkgreen;">[' + new Date($.now()).toISOString() + '][' + 'Argus9' + '][VISIBLE] ONLINE</li>');
    player.addEventListener(Twitch.Player.OFFLINE, function () {
        $('#event-list').append('<li style="color: darkred;">[' + new Date($.now()).toISOString() + '][' + 'Argus9' + '][VISIBLE] OFFLINE</li>');
    player.addEventListener(Twitch.Player.PAUSE, function () {
        $('#event-list').append('<li style="color: darkgoldenrod;">[' + new Date($.now()).toISOString() + '][' + 'Argus9' + '][VISIBLE] PAUSE</li>');
    player.addEventListener(Twitch.Player.ENDED, function () {
        $('#event-list').append('<li style="color: darkred;">[' + new Date($.now()).toISOString() + '][' + 'Argus9' + '][VISIBLE] ENDED</li>');
    player.addEventListener(Twitch.Player.PLAY, function () {
        $('#event-list').append('<li style="color: darkgreen;">[' + new Date($.now()).toISOString() + '][' + 'Argus9' + '][VISIBLE] PLAY</li>');
    player.addEventListener(Twitch.Player.READY, function () {
        $('#event-list').append('<li style="color: darkgreen;">[' + new Date($.now()).toISOString() + '][' + 'Argus9' + '][VISIBLE] READY</li>');

The page itself isn’t very important - it’s just a diagnostic tool to figure out the larger issue I’m writing about here.

Previously, the embedded player behaved such that it would automatically resume playing if its channel went from OFFLINE to ONLINE. In this case the Twitch.Player.ONLINE event occurs, and any event listeners on that event would fire.

When a channel goes from ONLINE to OFFLINE, the Twitch.Player.OFFLINE event (and Twitch.Player.ENDED, I believe) event(s) would fire.

Now, I’m noticing entirely different behavior:

Behavior / Events Fired
Player loaded, Channel is Online / Ready, Online, Play
Channel goes from Online to Offline / Paused, Ended
Player loaded, Channel is Offline / Ready, Ended
Channel goes from Offline to Online / None

Can anyone explain this change in behavior? This completely breaks an implementation I’m working on with multiple streams in a page, which relies on event listeners to function properly.

Sorry for the bump, but can anyone please provide some information on this? Even knowing it’s a known issue and being investigated would be reassuring. This is a pretty big break in functionality. I’ve been able to successfully reproduce this problem over multiple browsers (with all extensions disabled), and I’ve even found the non-interactive iframe also suffers from the inability to autoplay when a channel comes online.

Any information would be greatly appreciated. Thanks!

We haven’t changed this behavior recently. Have you tried changing the event names to strings? They’re currently not strings in your code. E.g.

player.addEventListener('Twitch.Player.ONLINE', function () {
        $('#event-list').append('<li style="color: darkgreen;">[' + new Date($.now()).toISOString() + '][' + 'Argus9' + '][VISIBLE] ONLINE</li>');

Hey @DallasNChains, thanks for reaching out. Let me give that a try and get back to you. I’d like to note, though, that it’s not that no event listeners are firing, just not the ones I (used to) expect. Please see my note above under Behavior / Events Fired - and sorry, I couldn’t seem to get Markdown tables to work so it’s kind of messy. :slight_smile:

I’ll try this right away and get back to you.

@DallasNChains changing the events to Strings didn’t work. Now none of my event listeners are firing. :confounded: I know the documentation says the event is a String, but I believe it’s referring to the variable the constant “Twitch.Player.ONLINE” (etc.) refers to. For instance, Twitch.Player.ONLINE = “online”.

I’ll chat with the video playback team and keep you posted! :slight_smile:

1 Like

Much appreciated @DallasNChains, thanks so much! :smiley:

Hi @DallasNChains - were you able to speak with the video playback team on this yet? Also, just curious, but were you able to reproduce this yourself?

  1. Embed an interactive video player in an HTML page for your channel or one you control (so you can go online/offline at will).
  2. Add an event listener to the player for each of the supported events (Twitch.Player.x): ONLINE, OFFLINE, PAUSE, PLAY, READY, ENDED. Make the event listeners do something to make monitoring them easy; for instance, console.log to report which event fired.
  3. Load the page under the following conditions and observe which callbacks fire:
    a. Load page when channel is online. Expected events: READY, ONLINE, PLAY. Actual events: READY, ONLINE, PLAY.
    b. Have the channel go offline. Expected events: OFFLINE, ENDED. Player immediately lists the channel as “OFFLINE” instead of “LIVE”. Actual events: PAUSE, ENDED. The player does not always update (or takes minutes to update) to indicate the channel is offline.
    c. Load page when channel is offline. Expected events: READY, OFFLINE. Channel is not ever listed as “LIVE”. Actual events: READY, ENDED. Channel is sometimes listed as “LIVE”.
    d. Have the channel go from offline to online. Expected events: ONLINE, PLAY. Stream begins playing automatically. Actual events: ONLINE, PLAY. Stream does not begin playing automatically and does not update its label to indicate the channel is now online.

The team is looking into this. I’ll follow up again today. :slight_smile:

Thanks @DallasNChains!

Hi @DallasNChains. Just checking in, any updates on this issue? Anything you can share? I’m still able to reproduce the above behavior.

Thank you!

Hm. The fix for this was supposed to be deployed last week. I was out of the office at GDC. Let me check for you, @Argus9.

@Argus9 The fix for this was actually deployed. I tested it to see what I get.

Stream is Online (scenario 3a) [2017-03-07T17:04:43.107Z] READY [2017-03-07T17:04:44.198Z] ONLINE [2017-03-07T17:04:44.199Z] ONLINE [2017-03-07T17:04:44.585Z] PLAY [2017-03-07T17:04:45.713Z] PLAY [2017-03-07T17:04:45.717Z] PLAY
Stream goes Offline from Online (scenario 3b) [2017-03-07T16:23:03.187Z] READY [2017-03-07T16:23:04.298Z] PLAY [2017-03-07T16:23:05.006Z] ONLINE [2017-03-07T16:23:05.007Z] ONLINE [2017-03-07T16:23:05.426Z] PLAY [2017-03-07T16:23:05.427Z] PLAY [2017-03-07T16:23:22.582Z] OFFLINE [2017-03-07T16:23:22.583Z] OFFLINE [2017-03-07T16:23:29.499Z] PAUSE [2017-03-07T16:23:29.499Z] PAUSE [2017-03-07T16:23:29.500Z] ENDED [2017-03-07T16:23:29.500Z] ENDED
Channel is offline (scenario 3c) [2017-03-07T17:29:59.738Z] READY [2017-03-07T17:30:00.977Z] PLAY [2017-03-07T17:30:01.105Z] ENDED [2017-03-07T17:30:01.107Z] ENDED

I can’t get 3d to work, so I’m following up with the engineers on that one.

Hey @DallasNChains, thanks for the update. I can confirm that I can reproduce the log entries you mentioned above. I’m looking forward to hearing what the engineering team thinks about scenario 3d.

I assume we shouldn’t be seeing those events fire multiple times too, right?

Hi @DallasNChains, I checked on the state of the player now and it looks like your engineers made some great progress! Events are now firing like they used to - I’m seeing ONLINE and OFFLINE events. I noticed autoplay still isn’t working, but looking in the console I see what could be the cause:

Uncaught TypeError: Cannot read property ‘updating’ of null
at t.Lr (

I hope this helps! Thanks for investigating all of this so far.

@argus9 Awesome! Glad the events are updated. I’ve been on vacation for the past week, so I’m just now getting back to this. The autoplay is a known issue that’s being tracked.

Hope you had a good time, @DallasNChains. Looking forward to Autoplay getting straightened out.

I can sort of get around the issue by integrating a call to in the ONLINE event listener, though I noticed when doing this that the player will just sit there endlessly buffering. I’ll play around with it a little more and see if I can’t get it to work in the meantime.

Thanks again for your help on investigating this!

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