elements icon indicating copy to clipboard operation
elements copied to clipboard

Bug: mux-video with hls: Error: Media element src was set while attaching MediaSource when adding tracks

Open endymion1818 opened this issue 1 year ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Which Mux Elements/Packages does this apply to? Select all that apply

mux-video

Which browsers are you using?

Chrome

Which operating systems are you using?

macOS

Description

I'm getting an error when supplying tracks to the mux-video web component.

[error] > Media element src was set while attaching MediaSource Here's some example code:

<mux-video src="https://some-hls-source"

The code I'm using in my component is more complex than this and involves the use of media-chrome, but even when I use straight up HTML without my wrapper component and the hosted version of mux-video it still occurs.

There's no documentation on the mux-video readme about s, but since it's an extension of HTML

How do I provide the captions, chapters etc without triggering this error?

Reduced test case

https://codepen.io/endymion1818/pen/RwmKQpq

Steps to reproduce

  1. Load the page
  2. See error in console

Current Behavior

An error is logged to the console although player renders and works as expected.

Expected Behavior

No error logged to the console.

Errors

[error] > Media element src was set while attaching MediaSource

What version of the package are you using?

v0.19.0

endymion1818 avatar Jun 06 '24 09:06 endymion1818

It looks like it could be a race condition because tracks need to download their src files asynchronously yet the player seems to render straight away

Screenshot 2024-06-06 at 10 34 44

endymion1818 avatar Jun 06 '24 09:06 endymion1818

I see the error but does this break anything in your program? seems the captions still work as expected.

it's a strange error because the media element is different from the track element. https://github.com/video-dev/hls.js/pull/5206/files

seems almost like that event bubbles up or something and the track src is wrongly compared with the media element src which is a blob.

luwes avatar Jun 11 '24 15:06 luwes

It doesn't break you're right, but we get a console error on each load, which is going to be a drain on our bug tracker. It will cause similar issues for third parties that embed our player too so we really want to avoid it if at all possible.

endymion1818 avatar Jun 11 '24 21:06 endymion1818

totally get that. how I see it currently is that it's a bug in hls.js, could you open an issue there and mention this ticket? we'll follow it along.

luwes avatar Jun 12 '24 13:06 luwes

Thanks, I'm opening an issue there however some information I don't think I have access to: what is the hls.js configuration?

Also I've developed a new test case that outputs more information to the console, is this information more helpful? https://embed-mediamanager-io-v3.pages.dev/storybook/?path=/story/media-manager-embeds--player

endymion1818 avatar Jun 17 '24 09:06 endymion1818

Hi! Thanks for reporting this. I was able to reproduce the issue using the version you mentioned, but it no longer seems to occur with the latest release (v0.24.5).

Could you try updating to a more recent version and see if the issue still happens on your end?

I'll go ahead and close this for now, but feel free to reopen it if you have any additional information or if the issue persists.

Thanks again!

R-Delfino95 avatar Apr 01 '25 20:04 R-Delfino95

Thanks Renzo, we have upgraded dependencies on the app and it seems to work great! Thank you!

endymion1818 avatar Apr 05 '25 07:04 endymion1818