Post

Replies

Boosts

Views

Activity

Using URLRequest with AVPlayer
I'm creating an app with a video player streaming video from an URL. The AVPlayer only takes the URL address of the video but I'd like to create a custom URLRequest and then use that to stream the video from online. So current situation is this: let videourl = URL(string: "videofoobar.com") let player = AVPlayer(url: videourl) player.play() And I would like to go to something like this: let videourl = URL(string: "videofoobar.com") var request = URLRequest(url: videourl) let player = AVPlayer(request: request) //This obviously fails, any workaround? player.play() I know it is not possible to do it like this as AVPlayer only takes URL or AVPlayerItem as parameter. Is there any workaround to make URLRequest and then give it to AVPlayer for online streaming?
0
0
569
Dec ’23