Hey there,
I created a video player like this one: https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos
But if the video file can not load (because of wrong url or missing internet connection) the player is just showing this loading-circle.
So there is no information whether the video file can be loaded or not.
Is there a way to check if a video file from the internet is available or not?
Thanks!
I created a video player like this one: https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos
But if the video file can not load (because of wrong url or missing internet connection) the player is just showing this loading-circle.
So there is no information whether the video file can be loaded or not.
Is there a way to check if a video file from the internet is available or not?
Thanks!
Could you show the code where you read and try to launch the video ?
You could use
AVAsset(url: url).isPlayable
to test if video is playable; and react accordingly.
You may have a look here:
https://stackoverflow.com/questions/48866004/ios-detecting-if-an-url-stream-is-working-or-not-with-avplayer
You could use
AVAsset(url: url).isPlayable
to test if video is playable; and react accordingly.
You may have a look here:
https://stackoverflow.com/questions/48866004/ios-detecting-if-an-url-stream-is-working-or-not-with-avplayer