http-streaming icon indicating copy to clipboard operation
http-streaming copied to clipboard

Manual way to force stop requesting for chunklist

Open tokidoki11 opened this issue 5 years ago β€’ 14 comments

Please do not delete the template, by filling out the required information we can investigate your issue more quickly.

Before opening an issue see if your problem can be resolved with the troubleshooting guide.

Description

I have a live hls streaming, somehow when it is ended it doesn't send any EXT-X-ENDLIST flag, so we manually trigger stream end by issuing videojs.error(message) but, the problem is I still see the network is still trying to get the chunklist

Sources

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Setup live hls streaming to streaming server via OBS or similar
  2. view with videojs
  3. stop the live video from OBS

videojs-http-streaming version

what version of videojs-http-streaming does this occur with? videojs-http-streaming 1.13.2

videojs version

what version of videojs does this occur with? video.js 7.8.4

Browsers

what browsers are affected? please include browser and version for each Tested on Chrome 84

Platforms

what platforms are affected? please include operating system and version or device and version for each MacOS 10.15.6

Other Plugins

are any other videojs plugins being used on the page? If so, please list them with version below. *

Other JavaScript

are you using any other javascript libraries or frameworks on the page? if so please list them below. *

tokidoki11 avatar Aug 06 '20 01:08 tokidoki11

πŸ‘‹ Thanks for opening your first issue here! πŸ‘‹

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

welcome[bot] avatar Aug 06 '20 01:08 welcome[bot]

We don't really have a way to do that right now. The closest is probably to call reset() on the player. If you know that the event has ended, you can just call reset directly. You can also listen to the retryplaylist event on tech which gets triggered when we get an issue requesting a playlist, this would happen when there's a blip with the network but also if the stream has ended but the end list tag isn't present.

player.tech().on('retryplaylist', () => {
  if (weHaveRetriedSeveralTimesThenThisMustBeEndOfStream()) {
    player.reset();
  }
});

For example something like that.

gkatsev avatar Aug 06 '20 05:08 gkatsev

Currently i use the waiting event and check the stream. I reset the player as well, but it doesn't seem to work

something like this

 this.player.on('waiting', async () => {
      if (this.hasPlayed) {
        const exists = await this.checkStreamExists()
        if (!exists) {
          this.player.reset()
          this.player.error("stream ends")
          this.player.errorDisplay.show()
        }
      }
    })

tokidoki11 avatar Aug 07 '20 00:08 tokidoki11

Also experiencing this exact issue. In my case, the problem is immediately preceded by all the renditions becoming blacklisted. I'm logging this out like so:

player.tech().on("usage", e => {
  console.log(e.name); // hls-rendition-blacklisted
}

hls-rendition-blacklisted triggers for every stream quality, then the network panel becomes flooded with requests.

The only workaround that I found to stop the requests was to overwrite player.hls.xhr with a noop... but obviously that's not ideal.

kaizau avatar Aug 27 '20 07:08 kaizau

Adding to this thread triggering ended event manually is not helping either

tokidoki11 avatar Oct 01 '20 02:10 tokidoki11

I found out, pausing player then reset it, will stop the request since it is guaranteed to call doReset_

https://github.com/videojs/video.js/blob/8e5a1af82637e1c910a3336bca1d63509e9ea2cc/src/js/player.js#L3440-L3450

now, the problem is I cant reload the player anymore with player.load()

tokidoki11 avatar Oct 02 '20 03:10 tokidoki11

@gkatsev γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2020-10-04 23 57 19

Could you please explain the logic behind playing the video first before doReset_ The code in silencePromise didnt run at all....

tokidoki11 avatar Oct 04 '20 14:10 tokidoki11

@tokidoki11 Perhaps the playPromise throws an error? Try chaining a .catch() after the .then.

I've resolved this problem with this by pausing the player, setting currentTime to 0 and then resetting the player. I don't have to deal with the issue of not being able to "reinitiate" the player though,

heennkkee avatar Oct 05 '20 18:10 heennkkee

@tokidoki11 Perhaps the playPromise throws an error? Try chaining a .catch() after the .then.

Will try this....

I've resolved this problem with this by pausing the player, setting currentTime to 0 and then resetting the player.

yes, pausing the video will indeed call the doReset_

I don't have to deal with the issue of not being able to "reinitiate" the player though,

I think, it is on my side.. the src that I pass before calling load is seems to be undefined sending the correct one, will load the video perfectly....

tokidoki11 avatar Oct 06 '20 05:10 tokidoki11

@tokidoki11 Perhaps the playPromise throws an error? Try chaining a .catch() after the .then.

I have tried this, no error is being caught.... Well technically i can just send pause, or as @kaizau said just noop the XHR

but without explanation at all it feels like a monkey patch. if ever there is an update on this area, it will be very hard to see on my side since no documentation will state the change

tokidoki11 avatar Oct 07 '20 02:10 tokidoki11

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 25 '20 11:12 stale[bot]

I think this is something we should add. We do have a way to stop all loading, but it isn't exposed publicly. In addition, we don't have a good way of restarting things afterwards. So, for this feature, we'll want pause and continue methods exposed that would allow the loaders to pause and continue when called.

gkatsev avatar Aug 02 '21 18:08 gkatsev

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 08 '22 23:01 stale[bot]

Similar issue happens when Google IMA SDK replaces video element's src on IOS (videojs 6.13.0, contrib-ads 6.9.0). As it bypasses player.src method, player doesn't know that source changes (to mp4) and vhs starts blacklisting all playlists due to PlaybackWatcher resulting in MediaError (no playlist to play). Is there way to make it work when IMA SDK requires video element to change source directly? Calling player.src makes new video tag which breaks reference. It would be nice to have vhs instance passively on tech, but suspended (no listeners, no intervals, etc). When IMA SDK returns previous hls src, it should be again activated.

mysuf avatar Aug 26 '23 11:08 mysuf