Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VideoJS doesn´t play after pause RTMP live stream

I´m using VideoJS for a live stream from Wowza server but when I pause the player and them I play again the player does not recover the stream. I need to reload the webpage 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>

There are any method to do stop or VideoJS reload when the paused event appear?

EDIT: I've encountered the 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>
like image 313
Ivan Fernandez Martinez Avatar asked Aug 22 '14 12:08

Ivan Fernandez Martinez


1 Answers

Ok so i found a solution. Instead of stripping all of the play events form the player you actually just need to edit the flash play event inside of video.dev.js on line 7337 (in version 4.11.4 i think). this is the line that says:

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

it should 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 play event.

like image 88
okwme Avatar answered Sep 21 '22 10:09

okwme