Cloudflare Docs
Stream
Edit this page on GitHub
Set theme to dark (⇧+D)

iOS

You can stream both on-demand and live video to native iOS, tvOS and macOS apps using AVPlayer.

​​ Example Apps

​​ Using AVPlayer

Play a video from Cloudflare Stream using AVPlayer:

import SwiftUI
import AVKit
struct MyView: View {
// Change the url to the Cloudflare Stream HLS manifest URL
private let player = AVPlayer(url: URL(string: "https://customer-9cbb9x7nxdw5hb57.cloudflarestream.com/8f92fe7d2c1c0983767649e065e691fc/manifest/video.m3u8")!)
var body: some View {
VideoPlayer(player: player)
.onAppear() {
player.play()
}
}
}
struct MyView_Previews: PreviewProvider {
static var previews: some View {
MyView()
}
}