-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[ios][expo-av] HLS downloaded multiple times #19296
Comments
Some more infos: its not a big deal with mp4 with my tests, since mp4 caches, but its a big thing with HLS, because it does not cache and always re-request |
I looked into this in the past as far as I can remember as you guessed the AVQueuePlayer with repeated AVPlayerItem's was a historic technique to achieve seamless looping. It could now be replaced with a Side note that I'm not sure if AVPlayerLooper would actually resolve any issue with HLS not being cached, maybe iOS will keep some HLS chunks in memory but I don't think it'll keep significant amounts cached. |
I think a HLS cache would be out of scope right now. It's pretty complicated (but should eventually be integrated when dealing with loop someday). I know that react native video is working on this currently but not sure if it's really reliable. Integrating AVPlayerLooper seems to be the right choice today, so we could try to fix this bandwidth issue while still being able to loop seamlessly . |
I don't think AVPlayerLooper will actually resolve your issue, as far as I can gather it basically handles for you what the old method was doing, creates three AVPlayerItems and loops through them. I do think what you really need is video caching, but I'm not sure if even react-native-video can handle that for HLS. |
From my research, it might need https://developer.apple.com/documentation/avfoundation/avassetcache More information: |
Thank you for filing this issue! |
Summary
After getting a hint at Twitter and also doing some checks in the network profiler + my CDN, I confirmed that expo-av consumes a lot of bandwidth. Turns out its this:
expo/packages/expo-av/ios/EXAV/EXAVPlayerData.m
Lines 137 to 143 in e377f0c
Expo-Av prepares 3x the same item. I don't know the purpose of this, but without a proper HLS Cache, this is not good. I think this has some historical reason (guess: fast looping?). Anyway, I would like to know if we should remove this at all.
What platform(s) does this occur on?
iOS
Environment
Minimal reproducible example
expo/packages/expo-av/ios/EXAV/EXAVPlayerData.m
Lines 137 to 143 in e377f0c
The text was updated successfully, but these errors were encountered: