Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I implement the hls.recoverMediaError() method? #416

Open
tanero opened this issue Mar 17, 2024 · 1 comment
Open

How can I implement the hls.recoverMediaError() method? #416

tanero opened this issue Mar 17, 2024 · 1 comment
Assignees

Comments

@tanero
Copy link

tanero commented Mar 17, 2024

https://github.com/video-dev/hls.js/blob/master/docs/API.md#fatal-error-recovery

When a fatal error occurs, as in the example above, I want the hls.recoveryMediaError() method to run. However, after initializing the ovenplayer, I could not find how to access this method. Is there a way to solve?

hls.on(Hls.Events.ERROR, function (event, data) {
  if (data.fatal) {
    switch (data.type) {
      case Hls.ErrorTypes.MEDIA_ERROR:
        console.log('fatal media error encountered, try to recover');
        hls.recoverMediaError();
        break;
      case Hls.ErrorTypes.NETWORK_ERROR:
        console.error('fatal network error encountered', data);
        // All retries and media options have been exhausted.
        // Immediately trying to restart loading could cause loop loading.
        // Consider modifying loading policies to best fit your asset and network
        // conditions (manifestLoadPolicy, playlistLoadPolicy, fragLoadPolicy).
        break;
      default:
        // cannot recover
        hls.destroy();
        break;
    }
  }
});
@SangwonOh
Copy link
Member

@tanero Hi!

Currently, when a fatal error occurs in Hls.js, OvenPlayer raise an error event. And you can't recover playback unless you call ovenplayer.load() again or recreate the player.

So, calling hls.recoverMediaError() when a fatal media error occurs is not yet supported. It seems difficult to support it right away because OvenPlayer's HLS error handling policy needs to be changed.

We will let you know again when various error handling becomes possible.

@SangwonOh SangwonOh self-assigned this Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants