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

fix(ios) add to validTextTracks only if we successfully insertTimeRage #3557

Conversation

gkueny
Copy link
Contributor

@gkueny gkueny commented Mar 1, 2024

insertTimeRage can fail & if we add failed textTrack to our validTextTracks array, video can crash later on selectTextTrack
we also add en empty textTrack only we we have validTextTrack

related to #3480

Summary

Error #3480 with sideLoaded textTrack happen because

textCompTrack.insertTimeRange

fail, but we already have added textTrack to our validTextTracks array.
Later, when we setSelectedTextTrack this cause video to crash.

Motivation

This change do not fix the side loaded textTrack issue, but prevent video crash because of them

Changes

  • append textTrack to validTextTracks only if textCompTrack.insertTimeRange run successfully.
  • avoid add empty textTrack if we have no validTextTracks handled (act the same if use give no textTracks)
  • print error to give some hint to developer

Test plan

@gkueny gkueny force-pushed the fix/avoid-crash-video-on-bad-subtitle branch from f0e32d4 to 9efbebb Compare March 1, 2024 23:20
insertTimeRage can fail & if we add failed textTrack to our validTextTracks array, video can crash later on selectTextTrack
we also add en empty textTrack only we we have validTextTrack

related to TheWidlarzGroup#3480
@gkueny gkueny force-pushed the fix/avoid-crash-video-on-bad-subtitle branch from 9efbebb to 682be95 Compare March 2, 2024 10:48
@gkueny gkueny requested a review from KrzysztofMoch March 2, 2024 10:49
@KrzysztofMoch
Copy link
Member

KrzysztofMoch commented Mar 4, 2024

You cooked 🔥 let me test it 👀

Copy link
Member

@KrzysztofMoch KrzysztofMoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and It's working 🚀
Thank You!

@KrzysztofMoch KrzysztofMoch merged commit b73baad into TheWidlarzGroup:master Mar 4, 2024
6 checks passed
@gkueny
Copy link
Contributor Author

gkueny commented Mar 4, 2024

Tested and It's working 🚀 Thank You!

Just to be sure that there's no misunderstanding, my PR do not really fix #3480 (comment) because sideloaded subtitle will not be shown to user

I just prevented the crash

I still haven't found out why textCompTrack.insertTimeRange throw an error 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants