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

Media source error (object in invalid state) when playing hls stream with audio on #7960

Open
HokkanenTeemu opened this issue Jan 28, 2025 · 3 comments
Labels
browser: Safari Issues affecting Safari or WebKit derivatives type: bug Something isn't working correctly
Milestone

Comments

@HokkanenTeemu
Copy link

Have you read the FAQ and checked for duplicate open issues?
Yes

If the problem is related to FairPlay, have you read the tutorial?

N/A

What version of Shaka Player are you using?

I'm using 4.11.4 in production at the moment but I have tested multiple versions, including the latest 4.13.0.
From what I have gathered, latest version without the issue seems to be 4.9.35.

Can you reproduce the issue with our latest release version?
Yes

Can you reproduce the issue with the latest code from main?
Yes

Are you using the demo app or your own custom app?
Yes

If custom app, can you reproduce the issue using our demo app?
Yes

What browser and OS are you using?
Safari 17/18 on iOS/iPadOS.
Latest Safari (18.2) does not seem to have this issue.

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
N/A

What are the manifest and license server URIs?

The issue was discovered with our own streams but this stream that I found from hls.js demo page works also:
https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8
I tried to reproduce the issue with streams from shaka-player demo page but those seemed to work without an issue.

What configuration are you using? What is the output of player.getNonDefaultConfiguration()?

Default configuration

What did you do?

I tried to play the stream with audio.

What did you expect to happen?
Nothing particular.

What actually happened?

Playback fails after some time with InvalidStateError.
MediaError object from the video element: { code: 3, message: "Media failed to decode }
Note that the playback works if video is muted.

I added some logging and noticed that error is throwed while shaka is trying to append video buffer:

  1. append audio buffer -> ok
  2. MMS endstreaming
  3. append video buffer -> error

The issue seems to be the MMS endstreaming event being raised between appending buffers.

Also, these this.getBuffered_ calls are causing invalid state errors when debug is enabled, I added this.streamingAllowed_ check for my own tests to supress those.

await this.enqueueOperation_(contentType, () => {
if (goog.DEBUG && reference && !reference.isPreload() && !isChunkedData) {
bufferedBefore = this.getBuffered_(contentType);
}
this.append_(contentType, data, timestampOffset);
}, reference ? reference.getUris()[0] : null);
if (goog.DEBUG && reference && !reference.isPreload() && !isChunkedData) {
const bufferedAfter = this.getBuffered_(contentType);

Are you planning to send a PR to fix it?
Not at the moment.

@HokkanenTeemu HokkanenTeemu added the type: bug Something isn't working correctly label Jan 28, 2025
@shaka-bot shaka-bot added this to the v4.14 milestone Jan 28, 2025
@avelad avelad added the browser: Safari Issues affecting Safari or WebKit derivatives label Jan 28, 2025
avelad added a commit to avelad/shaka-player that referenced this issue Jan 30, 2025
@avelad
Copy link
Member

avelad commented Jan 30, 2025

I have tested on iOS 18.3 and this issue does not exist.

@HokkanenTeemu
Copy link
Author

@avelad Yes, the issue does not exist on latest iOS (since 18.2).
This is mainly concerning iOS 17 as I would think that anyone running iOS 18 already has 18.2 / 18.3

@avelad
Copy link
Member

avelad commented Jan 30, 2025

I don't have any iOS 17 device to test and troubleshoot, sorry :(

avelad added a commit that referenced this issue Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser: Safari Issues affecting Safari or WebKit derivatives type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants