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

TypeError: null is not an object (evaluating 'this.fragmentTracker.getPartialFragment') #3744

Closed
green-coder opened this issue Apr 8, 2021 · 5 comments

Comments

@green-coder
Copy link

On hls v1.0.0, on a video which I cannot share.

By following the snippet from the documentation:

hls.on(Hls.Events.ERROR, function (event, data) {
  if (data.fatal) {
    switch (data.type) {
      case Hls.ErrorTypes.NETWORK_ERROR:
        // try to recover network error
        console.log('fatal network error encountered, try to recover');
        hls.startLoad();
        break;
      case Hls.ErrorTypes.MEDIA_ERROR:
        console.log('fatal media error encountered, try to recover');
        hls.recoverMediaError();
        break;
      default:
        // cannot recover
        hls.destroy();
        break;
    }
  }
});

After calling hls.recoverMediaError();, I get the error:

TypeError: null is not an object (evaluating 'this.fragmentTracker.getPartialFragment')

The error seems to come from

const partial = fragmentTracker.getPartialFragment(currentTime);

fragmentTracker seems to be null.

@robwalch
Copy link
Collaborator

robwalch commented Apr 8, 2021

Hi @green-coder,

Was hls.recoverMediaError() called after hls.destroy()?

I think fragmentTracker would only be null if the player was destroyed first. I cannot confirm without steps to reproduce.

Maybe we need something like #3710 for recoverMediaError? The thing is destroy removes all listeners and calling these two methods sequentially does not reproduce the issue for me. I do need a stream, and I need to know what sequence of events (and specific errors) lead to this exception.

@robwalch
Copy link
Collaborator

robwalch commented Apr 8, 2021

Please fill out the Bug Report Template as part of your issue, making sure to include:

  • Test stream/page (if possible)
  • Steps to reproduce
  • Expected behavior
  • Actual behavior

If the issue is related to your stream, and you cannot share the stream, please include all the information we would need to reproduce the issue. This includes how to generate a stream that reproduces the issue.

@green-coder
Copy link
Author

hls.recoverMediaError() was called before hls.destroy(), on an event where fatal was false.

The stream on which I had the problem is one that does not play well specifically via Hls on Safari. I am sorry that I cannot share the stream, but I will come back if I can reproduce the problem on a sharable stream.

@robwalch
Copy link
Collaborator

robwalch commented Apr 8, 2021

Thanks @green-coder,

I've looked through the src and can't see how this could happen without either the gap-controller being initialized with a null for a fragmentTracker (unlikely) or gap-controller being destroyed first which is the only place its fragmentTracker is set to null.

gap-controller is the only module where fragmentTracker.getPartialFragment is called. and it's called with onTickEnd from the main stream-controller.

Maybe hls.destroy() was called in response to an event emitted in the stream-controller's tick. In that case, we might want to exit early from doTick or onTickEnd. Even that seems unlikely as checkBuffer which is part of that chain would exit early if the player was destroyed.

@stale
Copy link

stale bot commented Apr 18, 2022

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

@stale stale bot added the Stale label Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants