VideoJS not working after RTMP pause live

I use VideoJS to stream live from the Wowza server, but when I pause the player and they play again, the player does not restore the stream. I need to reload a webpage in order to start the stream again.

<video id="videoID" class="video-js vjs-default-skin vjs-big-play-centered" poster="/images/image.png" controls="controls" width="320" height="240" data-setup='{"techOrder": ["flash"]}'> <source src="rtmp://www.myhost.com:1935/live/live.stream" type="rtmp/mp4" /> </video> 

Is there a way to stop or restart VideoJS when a paused event occurs?

EDIT: I came across a solution using this script:

 <script type="text/javascript"> var myPlayer = videojs('videoID'); videojs("videoID").ready(function(){ var myPlayer = this; myPlayer.on("pause", function () { myPlayer.on("play", function () { myPlayer.load (); myPlayer.off("play"); }); }); }); </script> 
+5
source share
1 answer

Ok, so I found a solution. Instead of shooting all the game events with the player, in fact you just need to edit the flash game event inside video.dev.js on line 7337 (in version 4.11.4, I think). this is a line that says:

 vjs.Flash.prototype.play = function(){ this.el_.vjs_play(); }; 

it needs to be changed to say:

 vjs.Flash.prototype.play = function(){ this.el_.vjs_load(); this.el_.vjs_play(); }; 

so that the load event is called before the playback event.

+3
source

Source: https://habr.com/ru/post/1200922/


All Articles