shaka-player icon indicating copy to clipboard operation
shaka-player copied to clipboard

Can I use setTextTrackVisibility() on iOS when useNativeHlsOnSafari is true?

Open kuroishi opened this issue 5 months ago • 8 comments

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.

kuroishi avatar Mar 19 '24 10:03 kuroishi

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

absidue avatar Mar 19 '24 11:03 absidue

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?

kuroishi avatar Mar 20 '24 00:03 kuroishi

@absidue may be mistaken. Native HLS on iOS should not cause setTextTrackVisibility to fail. Thank you for the report.

joeyparrish avatar Mar 20 '24 01:03 joeyparrish

@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.

absidue avatar Mar 20 '24 08:03 absidue

@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.

absidue avatar Mar 20 '24 08:03 absidue

I checked and I surely call selectTextTrack(). Again, it works on macOS and Native HLS Safari using the same code.

kuroishi avatar Mar 20 '24 09:03 kuroishi

Okay, sounds like a bug. Text tracks should work on all platforms and all versions.

joeyparrish avatar Mar 20 '24 17:03 joeyparrish

@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.

avelad avatar Mar 27 '24 08:03 avelad