shaka-player
shaka-player copied to clipboard
Can I use setTextTrackVisibility() on iOS when useNativeHlsOnSafari is true?
Have you read the Tutorials? yes.
Have you read the FAQ and checked for duplicate open issues? yes.
If the question is related to FairPlay, have you read the tutorial?
N/A
What version of Shaka Player are you using? 4.7.9
What browser and OS are you using? iOS 15.4 Safari
Please ask your question Can I use setTextTrackVisibility() when useNativeHlsOnSafari is true? It doesn't seem to work correctly. In Safari on macOS, I can use the method as I expect but on iOS I can't. Maybe it doesn't matter whether or not the useNativeHlsOnSafari is true/false on iOS.
As you are on iOS 15.4 shaka-player will always use native HLS, Apple only added the APIs (ManagedMediaSource) for non-native HLS playback in iOS 17.1.
https://caniuse.com/mdn-api_managedmediasource
I can control the visibility using setTextTrackVisibility() on macOS even when useNativeHlsOnSafari is true. But on iOS 15.4 it doesn't work. Is it right?
@absidue may be mistaken. Native HLS on iOS should not cause setTextTrackVisibility to fail. Thank you for the report.
@absidue may be mistaken.
On iOS versions older than 17.1, the useNativeHlsOnSafari setting makes no difference, because before that iOS had neither the MediaSource API or the ManagedMediaSource API, so shaka-player will always use native playback/LoadMode.SRC_EQUALS
. macOS and iPadOS have had the MediaSource APIs for a long time.
@kuroishi Make sure that you call selectTextTrack
first before you call setTextTrackVisibility
, otherwise shaka-player won't know which text track it should make visible.
I checked and I surely call selectTextTrack(). Again, it works on macOS and Native HLS Safari using the same code.
Okay, sounds like a bug. Text tracks should work on all platforms and all versions.
@joeyparrish I tested it, and it works in Safari 16+ but it fails in Safari 15. The bug seems to be here: https://github.com/shaka-project/shaka-player/blob/main/lib/player.js#L2533 that the browser does not always fill the texttracks at startup, sometimes it takes a time.I have no way to debug further because I don't have a real device, I tried it with a borrowed device.