jaruba / wcjs-player

Node Player made for WebChimera.js (libVLC wrapper)
http://webchimera.org/
GNU Lesser General Public License v2.1
178 stars 46 forks source link

Player freezes complete electron application when stopped just after video has been initialized #93

Open vihar638 opened 3 years ago

vihar638 commented 3 years ago

var wjs = require("wcjs-player"); var conf = { wcjs: require('wcjs-prebuilt'), multiscreen: true, autoplay: true, loop: true, };

var liveViewPlayerHolder = new wjs('#player').addPlayer(conf);

liveViewPlayerHolder.clearPlaylist(); liveViewPlayerHolder.addPlaylist(url); liveViewPlayerHolder.play();

liveViewPlayerHolder.onBuffering(function(p){

if(p > 0 && p < 1) { liveViewPlayerHolder.stop(); setTimeout(() => { start(); }, 1000); } else if(p > 50){ stop(); start(); } });

function stop() { liveViewPlayerHolder.stop();

      setTimeout(() => {
          start();
      }, 1000);

  return true;

}

function start() { liveViewPlayerHolder.clearPlaylist(); liveViewPlayerHolder.addPlaylist(url); liveViewPlayerHolder.play(); }

In some condition the player completely stuck the complete electron application and it stuck in file wcjs-player/index.js

wjs.prototype.stop = function() {

wjsButton = this.find(".wcp-pause");

if (wjsButton.length != 0) wjsButton.removeClass("wcp-pause").addClass("wcp-play");

wjsButton = this.find(".wcp-replay");

if (wjsButton.length != 0) wjsButton.removeClass("wcp-replay").addClass("wcp-play");

//player completely works fine till this line this.vlc.playlist.stop(); //player stucks here

positionChanged.call(this,0);

this.find(".wcp-time-current").text("");

this.find(".wcp-time-total").text("");

return this;

}