1

I am integrating shaka player in my web application. I have gone throught the documentation and found basic program to load player with video manifest url. Link for basic program is basic tutorial. And it is loading video fine.

I need to implement error handing for player. So I am trying to understand, where the 'error' event listener will be firing. Following is the code for listening error. It is not triggering anymore for me.

 // Listen for error events.
  player.addEventListener('error', onErrorEvent);

Following are the Trails to get it invoked but not triggered: Trail 1: Not initialized video variable.

  const video = null;
  const player = new shaka.Player(video);

Trail 2: Loading an invalid manifest url.

try {
    await player.load('https://mydymmy.manifest.url');
  } catch (e) {
    onError(e);
  }

I would like to implement error handling in my program. For that i need to understand when this 'error' listener will be invoking.

2 Answers 2

0

Hey I ran into this issue too and to help anyone else who runs into this issue, this is how you catch the error on load.

await player.load('https://mydymmy.manifest.url').catch(onError);

Hopefully that helps.

1
0

player.addEventListener('error', onErrorEvent);

The listener example in the tutorial didn't work


const listener = new shaka.util.EventManager();

listener.listen(player, error, (event: any) => { onErrorEvent(event); });

You should use shaka.util.EventManager

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 14, 2022 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.