Novage / p2p-media-loader

An open-source engine for P2P streaming of live and on demand video directly in a web browser HTML page

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to properly stop or destroy a p2p-media-loader instance?

renatofrota opened this issue · comments

I have a website where p2p-media-loader is being used - the code is based on Novage's demo page. I want to preserve visitor's browser processing time by destroying the player's / p2p elements as they navigate to other website pages (without players).

The pages are loaded via Ajax and a main div container is updated with the new page content (which may - or not - include a video). What I did so far:

  • changed const demo to var demo (so it can be overwritten when navigating to another page);
  • when user clicks a link, I check for the presence of of a <video> tag in the DOM and set it's src to null before doing the Ajax call to load the next page;

However, after loading a new page where no video is displayed, I can still see logs like Firefox can’t establish a connection to the server at wss://tracker.novage.com.ua/ - what indicates there's still "something" running in background (from the previous page load).

Any advice on how to properly stop or destroy the p2p-media-loader instance before loading a new page via Ajax?

I confirm this bug on jwplayer.