Skip to content

selectAudioTrack() can break playback #8737

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

Open
xxoo opened this issue Jun 11, 2025 · 5 comments · Fixed by #8738 or #8741 · May be fixed by #8744
Open

selectAudioTrack() can break playback #8737

xxoo opened this issue Jun 11, 2025 · 5 comments · Fixed by #8738 or #8741 · May be fixed by #8744
Assignees
Labels
priority: P1 Big impact or workaround impractical; resolve before feature release type: bug Something isn't working correctly
Milestone

Comments

@xxoo
Copy link
Contributor

xxoo commented Jun 11, 2025

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

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

What version of Shaka Player are you using?
the nightly version

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?
both

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

What browser and OS are you using?
Chrome, Firefox and Safari on macOS 15

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

What are the manifest and license server URIs?
https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8

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

{
	"manifest": {
		"dash": {
			"clockSyncUri": "https://time.akamai.com/?ms&iso"
		}
	},
	"preferredAudioLanguage": "en-US",
	"preferredTextLanguage": "en-US"
}

What did you do?
Open the video in demo. Then run:

shakaDemoMain.player_.selectAudioTrack(shakaDemoMain.player_.getAudioTracks()[1]);

wait for a few seconds

shakaDemoMain.player_.selectAudioTrack(shakaDemoMain.player_.getAudioTracks()[0]);

What did you expect to happen?
The video should still be playable.

What actually happened?
The video is stuck forever.

Are you planning to send a PR to fix it?
no

@xxoo xxoo added the type: bug Something isn't working correctly label Jun 11, 2025
@avelad avelad added the priority: P1 Big impact or workaround impractical; resolve before feature release label Jun 11, 2025
@avelad avelad self-assigned this Jun 11, 2025
@avelad avelad added this to the v4.16 milestone Jun 11, 2025
@avelad
Copy link
Member

avelad commented Jun 12, 2025

See #8738 (comment)

@xxoo
Copy link
Contributor Author

xxoo commented Jun 12, 2025

@avelad
Thanks again! The problem seems solved on Chrome. But not on Safari and Firefox. In my test it even get worse on Safari. The video is stuck after switching audio for the first time. On Firefox the result is still the same as before.

@avelad
Copy link
Member

avelad commented Jun 12, 2025

In my case it is working correctly in Firefox, but it fails in Safari :(

8737.mp4

@avelad avelad reopened this Jun 12, 2025
@xxoo
Copy link
Contributor Author

xxoo commented Jun 12, 2025

@avelad
Copy link
Member

avelad commented Jun 13, 2025

I've seen several things that could be improved. Every time we change the audio, we reset MSE when it's not necessary. ChangeType can be used, and it's much better from a user perspective. Safari doesn't support switching from audio/mp4 to audio/aac when using sequenceMode, so in some cases, we should transmux to avoid having to reset.

I'll have the changes ready in PR later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: P1 Big impact or workaround impractical; resolve before feature release type: bug Something isn't working correctly
Projects
None yet
2 participants