I want to play a set of video files from a remote server on iOS. I don’t want to use an HLS playlist.
I am trying to use AVQueuePlayer. Here’s how I initialize it:
let url = URL(string: "https://example.com/video.ts")! // 10 second video
let item = AVPlayerItem(url: url)
let player = AVQueuePlayer(items: [item])
player.play()
When I show this player on screen, using an AVPlayerLayer and a custom view or with an AVPlayerViewController, it just shows a loading icon and no content. When I check the player.items()
array after a few seconds, there is nothing there.
Is it the expected behavior? How to accomplish my task?