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

HLS with ManageMediaSource throws NotFoundError: The object can not be found here. #1521

Open
pvm1987 opened this issue Nov 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pvm1987
Copy link

pvm1987 commented Nov 28, 2024

Current Behavior:

I'm using Safari 17.1 and trying to play HLS video. This browser has support of ManagedMediaSource and hls.js uses it. I sometimes receive the following error "NotFoundError: The object can not be found here." and the whole my React component is removed from the DOM.

Expected Behavior:

Player should load and play the HLS video every time as it's woking on all other browsers with the old MediaSource support. For example it works on Chrome.

Steps To Reproduce:

  1. Setup vidstack player with autoPlay={true} and load="visible"
  2. Setup HLS provider library to be "locally" accessed:
onProviderChange={(provider: MediaProviderAdapter | null, nativeEvent: MediaProviderChangeEvent,) => {
    if (isHLSProvider(provider)) {
      // Set hls.js to be used locally (i.e., not over a CDN).
      provider.library = HLS;
    }
  };
  }
  1. Reload the page and observe the console until you catch the moment when the following error occurs.
"NotFoundError: The object can not be found here." 

Environment:

Screenshot 2024-11-28 at 13 24 51 Screenshot 2024-11-28 at 13 46 18

I think this error happens when the <source> is appended to the <video> by hls.js. The lib is manipulating the DOM tree which is previously created by Vidstack MediaOutlet React component. Such actions are not allowed by React's re-render methods and they throw an error which breaks the whole app.

Note that I tested with HLS config param:

preferManagedMediaSource: false 

This turns off the usage of ManagedMediaSource and then everything works as expected. When MediaSource is used hls.js changes only the "src" attribute of the video tag and doesn't add any <source> child tags.

@pvm1987 pvm1987 added the bug Something isn't working label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant