react-native-af-video-player "Oops! there was an error while playing this video please try again later"

453 views Asked by At

I'm using this library "react-native-af-video-player" for playing videos from my remote server, and its working perfectly on android, but on iOS its giving this error "Oops! there was an error while playing this video please try again later". I tried giving a random dummy .mp4 url and it worked normally, only the videos from my server are not being read.I added my servers url to the "Exception Domains" in "App Transport Security Settings" in info.plist file but it didn't work. Any help would be appreciated.

1

There are 1 answers

0
Jawad Chawich On BEST ANSWER

Apparently, HTTP servers hosting media files for iOS must support byte-range requests, which iOS uses to perform random access in media playback. (Byte-range support is also known as content-range or partial-range support.) Most, but not all, HTTP 1.1 servers already support byte-range requests.

If you are not sure whether your media server supports byte-range requests, you can open the Terminal application in OS X and use the curl command-line tool to download a short segment from a file on the server:

curl --range 0-99 http://example.com/test.mov -o /dev/null

If the tool reports that it downloaded 100 bytes, the media server correctly handled the byte-range request. If it downloads the entire file, you may need to update the media server to support byte-range requests.