Skip to content

iOS SDK

Current version: v1.0.0

Native iOS player built with SwiftUI and AVPlayer.

Requirements

  • Xcode 15 or later
  • iOS 15.0 minimum deployment target
  • Swift 5.9+
  • An active xStreams stream ID and token endpoint

Installation

  1. In Xcode, go to File → Add Package Dependencies.
  2. Enter the URL:
    https://github.com/xStreams-io/xstreams-player-ios.git
  3. Select version 1.0.0 and add to your target.

Option B: Manual download

  1. Download the ZIP from CDN:
    https://cdn.xstreams.io/sdk/ios/XStreamsPlayer-1.0.0.zip
  2. Unzip and drag the XStreamsPlayer folder into your Xcode project.
  3. Make sure "Copy items if needed" is checked.

Usage

swift
import XStreamsPlayer

struct LiveView: View {
    let config = XStreamsPlayerConfig(
        streamId: "YOUR_STREAM_ID",
        tokenEndpoint: "https://api.yoursite.com/api/v1/ssai/YOUR_STREAM_ID/token/",
        streamKey: "sk_abc123..."
    )

    @StateObject private var player = XStreamsPlayer(config: config)

    var body: some View {
        XStreamsPlayerView(player: player)
            .aspectRatio(16/9, contentMode: .fit)
            .onAppear { player.play() }
            .onDisappear { player.destroy() }
    }
}

Features

  • HLS live playback via AVPlayer
  • Ad break detection
  • Picture-in-Picture
  • AirPlay support
  • Quality selection
  • Silent token refresh
  • SwiftUI and UIKit support

See also

Live streaming infrastructure for developers.