sampotts / plyr

A simple HTML5, YouTube and Vimeo player

Home Page:https://plyr.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Old request continues to download

ronag opened this issue · comments

I don't think old requests are properly cleaned up when changing sources, i.e. I can see in the Chrome Dev Tools that they continue downloading...

In _updateSource, instead of just doing:

// Remove the old media
_remove(plyr.media);

I think the following is required:

plyr.media.pause();
plyr.media.src = '';
plyr.media.load();
// Remove the old media
_remove(plyr.media);

Likewise in destroy

Thanks for this. There was a pull request for this for the old source() method but I'd been meaning to port it to the new method.

I've fixed this for the source() api method but with destroy() the intention there is to return the player to it's "default" state, e.g. back to a native UI'd player. In my mind that would mean you wouldn't want to remove the sources there? I could make it an option of course though?