silvermine / videojs-chromecast

MIT License
147 stars 74 forks source link

Fix position stops updating after seek on HLS streams #165

Open kontrollanten opened 11 months ago

kontrollanten commented 11 months ago

Authored by @andreasgangso some years ago.

As far as I remember the first commit solved some general issue where an error was thrown due to "tech.seeking is not defined".

The seeking/scrubbing issue is described in #103.

coveralls commented 11 months ago

Coverage Status

coverage: 18.166% (-0.2%) from 18.386% when pulling 50447c011d6ed93ccc14810bcfad25ff1c57db0a on kontrollanten:fix-hls-seek into 718c832bcdd1b466bb8c3fbbe72c2d23609504df on silvermine:master.

kontrollanten commented 10 months ago

Comment from izkmdz:

Unfortunately, this fix for https://github.com/silvermine/videojs-chromecast/issues/103 is causing the seek bar to not be as responsive as before. Also, the delay does not allow for quick mouse clicks/taps to be registered on the seek bar.

RavWar commented 10 months ago

I think i was able to fix the issue by adding the check for this.videojsPlayer.scrubbing() in pause method, like this:

   pause: function() {
      // Do not pause while scrubbing or else chromecast will stop timeupdate events
      if (!this.paused() && this._remotePlayer.canPause && !this.videojsPlayer.scrubbing()) {
         this._remotePlayerController.playOrPause();
      }
   }
kontrollanten commented 10 months ago

Interesting. Is it necessary to check for !this.paused() and then call this._remotePlayerController.playOrPause()? Sounds like it should be enough to remove the this.paused check and then just call this._remotePlayerController.pause()?

RavWar commented 10 months ago

I just left this part as it was before, didn't check, but i think playOrPause is used because there is no pause method https://developers.google.com/cast/docs/reference/web_sender/cast.framework.RemotePlayerController#playOrPause

RavWar commented 7 months ago

In the latest video.js version this fix is not working, scrubbing(true) is not being set on single clicks on seek bar anymore. Not sure how to fix it differently, i've just patched scrubbing(true) back into video.js in SeekBar handleMouseDown function

kontrollanten commented 4 months ago

In the latest video.js version this fix is not working, scrubbing(true) is not being set on single clicks on seek bar anymore. Not sure how to fix it differently, i've just patched scrubbing(true) back into video.js in SeekBar handleMouseDown function

The latest PR should work with latest video.js as well. It's not 100% working and the solution is not perfect though. I've been sitting in days and trying to figure out why chromecast stops sending time_update events upon scrubbing HLS, but can't find the core issue.

Known issues:

@izkmdz Should we put the functionality in this PR under a specific tech option since it's not perfect? For HLS users it's still a great step forward compared to how it works today.

Proposal:

const videojsOptions = {
   fluid: true,
   techOrder: [ 'chromecast', 'html5' ],
   plugins: {
      chromecast: {
        enableExperimentalHlsSeekSupport: true,
      },
   },
};
kontrollanten commented 4 months ago

@RavWar @ayrtonbrut Can you this PR and see if it solves your issues?

I've created a demo with HLS in https://github.com/silvermine/videojs-chromecast/pull/166 which you can use if you'd like to.

RavWar commented 3 months ago

With the new PR changes original issue is fixed for me, couldn't thoroughly test if it causes any other problems though

kontrollanten commented 3 months ago

With the new PR changes original issue is fixed for me, couldn't thoroughly test if it causes any other problems though

Great, thanks for testing.