-
-
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
Prevent errors on iOS when using text tracks with caching #1172
Conversation
@n1ru4l I set some breakpoints in the code and what it looks like is happening is when it goes to get the video tracks there aren't any tracks in the array. What I'm guessing is that they haven't been loaded yet. Any idea how we might be able to wait until they are loaded before we try and query them? Also, I wanted to say great job on this. The code is very easy to follow and is especially impressive considering how many advance Objective-C features you're using for someone new to the language. |
@cobarx I will try to take a look when I got some spare time, currently having text tracks is unfortunately not a requirement of our app 😕. |
That’s fine, worst case scenario we disable caching for text tracks and
come back to it later.
…On Wed, Aug 15, 2018 at 12:28 AM Laurin Quast ***@***.***> wrote:
@cobarx <https://github.com/cobarx> I will try to take a look when I got
some spare time, currently having text tracks is unfortunately not a
requirement of our app 😕.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1172 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD4AF7RwJkHe3W34NQwtrJzhqnqJP8elks5uQ82QgaJpZM4V01cB>
.
|
I have no idea how to fix this so I'm going to disable caching if text tracks are specified and get this released. Glad we're finally getting to ship this! Hopefully some day your company will need to subtitles and we can get them fixed :) |
Fixes a crash when using the cache & sideloaded text tracks together due to the tracks on the asset not being available. Re-visit when someone with more expertise on the cache can look at it.
This PR is intended to fix a crash that happens when you attempt to mix in text tracks. Also fixes issues where the right error code wasn't returned when the file couldn't be cached.
@n1ru4l I did some refactors to make it a bit easier to read. IMO, putting all of the caching code into a separate function so you don't have to parse all the ifdefs is a lot easier to digest. For future PRs, I'd suggest breaking it into pieces. Giant PRs are make it more challenging to figure out what changed and also are a bit harder to merge since everything needs to be tested and evaluated all at once.
I did some investigation into the text track issue and have it mostly isolated. In the text track code https://github.com/react-native-community/react-native-video/blob/86d655c3d1c8a81f6b841d7379ba624903440b32/ios/Video/RCTVideo.m#L393 it is bombing at the line for:
AVAssetTrack *videoAsset = [asset tracksWithMediaType:AVMediaTypeVideo].firstObject;
Which throws an error in the debugger of:
I was thinking maybe DVURLAsset didn't subclass AVURLAsset and was missing the
tracksWithMediaType
method and manually created the AVURLAsset. However, that didn't fix it and it turns out it does subclass it.I ran out of time today to finish investigating but will see if I can figure out that error this evening or tomorrow.
@n1ru4l A few other questions for you. Can we also cache the audio & text tracks? Also, I'm assuming that if you watch a video for a second time and part of the video is in the cache, it will pull any other parts that aren't cached from the network, right? Just wanted to be sure.