Closed jrods closed 5 years ago
Which kind of video are you trying to load? Progressive (f.e mp4) or Adaptative (f.e. hls, mpd, ism)
If you are using mp4, it may help to include Content-Rage
headers. returning 206 status code (Partial Content)
@CHaNGeTe I'm trying to play .mp4 videos recorded from react-native-camera. I will try and see what the OK status is from requesting the video link, is the Content-Range
header set from S3 or Cloudfront? Would I being using the buffer config in react-native-video to make range request for me? I'm not familiar with range requests/responses.
Do you know Postman?
I am not used to cloudfront, but you can test if it has range support with it.
Send this header to a mp4 video (I am using https://www.w3schools.com/html/mov_bbb.mp4)
Range: bytes=0-2
If you receive a Content-Range header in response, then the server (cloudfront) is configured for progressive download.
I am not sure if AVPlayer handles progressive files by default, but it is a good way to start.
Also check if you are getting the 206 status code (size and time are also hints)
The response is the full video in the request when requesting it by postman. I can't tell how react-native-video is requesting without including a fork in my app.
After further testing, there is an inconsistency between OS versions, for example Android Pie loads the video much slower than other versions, Android Oreo less so and Android Nougat even less.
This behaviour also seems to exhibit on selected playback seeking, Android Pie suffering the most.
The response is the full video in the request when requesting it by postman.
this is the first thing you have to solve. Search for setup Cloudfront for progressive mp4. You can try in StackOverflow also.
I also have this issue from Cloudfront. I checked Postman and I do get a 206 with Content-Range. This is not using the ExoPlayer as that one crashes on me when the controls
prop is true
and it also doesn't load the video with a different error. (something to do with AVC codec)
Question
I'm currently having a problem with video playback availability on Android.
In upgrading my app to react-native 0.59, I also upgraded react-native-video to it's latest version 4.4.1. What is currently happening is when trying to play videos with this library, it takes awhile for the video to be available for playback. The size of the videos doesn't seem to matter. The videos are stored on S3, in my test environment the videos are linked by Cloudfront, in my local environment the videos are linked by the S3 location, but the behaviour exhibited is the same for both environments.
This only happens for Android, iOS playback availability is ready in under 1s for the same videos.
I have tried rolling back react-native-video to a previous compatible version, the problem persists.
Different devices have different wait times for playback availability.
I wasn't able to used SDK 27 due to using a version of Firebase requiring SDK 28.
There is an IOException being raised when the component has been initialized to get the S3 resource, but the library does eventually get the video.
I don't know the exact cause of the problem, whether or not the library is downloading the video before playing, or if there needs to be a header included in the request.
Here is the debug output when trying to play a video:
React-Native: 0.59 Target SDK: 28 Android OS: Pie Testing Device: OnePlus 5 Other devices with older OS version (at least Marshmellow) are also affected
I have also posted this question on stackoverflow: https://stackoverflow.com/questions/56596041/react-native-video-takes-too-long-to-start-playback