-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix: Can't disable subtitle on iOS when using type: disabled #1468
Conversation
@nbennink This is a very clever and intelligent solution. I haven't had a chance to test this yet. My only concern would be whether the empty VTT track appears in the list of text tracks reported by onLoad. If so, we should filter it out. |
@cobarx Yes you are right. My latest commit removes the subtitle file from the onLoad event. So you can't see it in your front-end and the only way to select it, is by using |
Can this change conflict with this? |
I don't think that it's a problem, here in the playerItemPrepareText method the function gets returned when you don't give the video player text tracks using the This was done to prevent an issue where you can't Airplay a video that contains text tracks. I'm not using caching for my project right now, but I assume that it works the same here. |
So I recently discovered that this is not working on tvOS. It appears that this line returns nil so it skips the empty VTT file. I think that this is limitation of the tvOS file system or AVPlayer on tvOS. I'm looking for a solution to fix it. Let me know if someone has suggestions. |
@nbennink Just a quick question, are you using mp4? or adaptative streaming? I was thinking in another approach for setting subtitles. |
@CHaNGeTe I am using mp4 files for subtitles and still have this issue. I'm not sure what the best option is to replace the current approach for subtitles. I'd like to fix the problem without the empty VTT file. Edit: I recently came back to this issue and tried again to come up with solution for tvOS but did not get it working. Anyone a suggestion? |
same problem here. why isnt this merged? tested and it works |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are having a similar problem, please open a new issue and reference this one instead of commenting on a stale or closed issue. |
This is a PR to fix #1144.
The original issue
When you select a textTrack it starts playing the video with subtitles. To disable these subtitle you can give the
setSelectedTextTrack={{type:'disabled'}}
to the Video component. This works correctly on Android, but on iOS it "freezes" the last known subtitle until the end of the video.How does this PR fix this?
There's been a discussion about how to fix this problem. A solution was to generate an empty VTT file with a package like RNFetchBlob. I think however that it's a better solution to generate this file in the Video component itself (since that's where the issue comes from).
This PR adds an VTT file to the array of TextTracks. When the selectedTextTrack gets
type: disabled
it will select this track which makes the "old" track disappear.Nothing changes in how you use texttracks. Something to note is that you can't load a completely empty VTT file. So there is a dot at the 98 hour timemark (basically never).
Edit: I only load this empty VTT file when you actually have other texttracks as well. So you don't have the issue where it breaks Airplay.