clappr / clappr-level-selector-plugin

Clappr Level Selector Plugin
MIT License
76 stars 56 forks source link

Freeze while switching levels using level-selector plugin #38

Open remijulien opened 8 years ago

remijulien commented 8 years ago

Browser: Chrome 51.0.2704.84

OS: Mac OS X 10.11.5

Clappr Version: 0.2.54

Steps to reproduce:

Screenshot here

leandromoreira commented 8 years ago

@remijulien can you enable debug mode and post the log lines here? (at least the last 30)

//before you create your player
Clappr.Log.setLevel(Clappr.Log.LEVEL_DEBUG)
remijulien commented 8 years ago

here are two screenshots with debug mode on

the console error when playback freezes

more log lines

do you need the raw log lines as well ?

leandromoreira commented 8 years ago

@remijulien that "Dom " error is something with Chrome, they're already aware of it (actually they seem to fixed that too).

I went to the cdn added //cdn.jsdelivr.net/clappr.level-selector/latest/level-selector.min.js as external plugin [+] and copied (replacing the existent) this code:

var playerElement = document.getElementById("player-wrapper");

var player = new Clappr.Player({
  source: 'http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8',
  baseUrl: '/latest',
  plugins: [LevelSelector],
  poster: 'http://clappr.io/poster.png',
  mute: true,
  height: 360,
  width: 640
});

player.attachTo(playerElement);

And clicked run, then played and I think I could reproduce the same behavior. (it gets stucked... infinitely loading)

leandromoreira commented 8 years ago

But I really needed to change lots of quality I think it might be some race condition (you ask to switch a level, then you don't even wait for the end and try to change it again)

ropez commented 8 years ago

I have a similar problem that may be caused by the same bug.

In my case, I have a single page application with one player, and a list of sources to select from (TV channels). The sources are HLS, but they don't actually provide different levels. We're using the level-selector plugin for some other part of the application, so it's not really relevant to this page, but it still causes it to freeze.

When the page loads, the player is created and one channel (HLS source) is selected. There are buttons that activate other channels. When clicking these buttons, and the player is already created, we call player.stop() and player.load() with the new source. After switching back and forward a few times, the browser freezes completely, and it appears like there is a Javascript locked in a loop somewhere. Removing the level-selector plugin makes the problem go away.

I will try to set up a minimal page to reproduce.

ropez commented 8 years ago

It turns out my issue was caused by having two instances of the clappr javascript module. One imported by my app, and one imported by the plugin. I just need to find a proper solution to issue #40 then this won't be a problem