Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Video
    • Overview
    • Control
      • Overview
        • Getting started
    • Browser autoplay policy
  • Access management
  • Pricing policy
  • Audit Trails events
  • Release notes
  • Troubleshooting

In this article:

  • Adding a video player SDK library
  • Importing the libraries
  • Using the SDK
  • Set up the start of playback
  • Connecting a video player skin
  • Playback in SwiftUI
  1. Video Player
  2. SDK
  3. iOS
  4. Getting started

Video player SDK for iOS

Written by
Yandex Cloud
Updated at July 7, 2026
View in Markdown
  • Adding a video player SDK library
  • Importing the libraries
  • Using the SDK
    • Set up the start of playback
    • Connecting a video player skin
    • Playback in SwiftUI

The SDK allows you to embed a player for Cloud Video content into your iOS app.

To use the SDK, you need the Xcode IDE version 16.4 or higher and Swift version 5.8 or higher.

Adding a video player SDK libraryAdding a video player SDK library

Xcode SPM
Package.swift
  1. In the Project Navigator Xcode window, select your project.

  2. In the top panel, click File and select Add Package Dependencies....

  3. In the search box , enter https://github.com/yandex-cloud/cloud-video-player-ios-sdk/. Then, select the cloud-video-player-ios-sdk package.

  4. In the Dependency Rule field, select Up to Next Major Version and specify the version: 0.1.6.

  5. In the Add to Project field, select the project you want to add libraries to and click Add Package.

  6. In the pop-up window, specify the target to add the libraries to and click Add Package.

    The package contains the following libraries:

    • CloudVideoPlayer: Main library of the video player SDK for iOS.
    • CloudVideoPlayerUI: Additional library with a collection of interface elements (video player skin).
  1. In the Project Navigator Xcode window, select your project.

  2. Open Package.swift.

  3. Add the following dependency to the dependencies array:

    dependencies: [
      .package(
        url: "https://github.com/yandex-cloud/cloud-video-player-ios-sdk/",
        from: "0.1.6"
      )
    ],
    
  4. Add the libraries to the dependencies array of the target:

    .target(
      name: "MyTargetName",
      dependencies: [
        .product(name: "CloudVideoPlayer", package: "cloud-video-player-ios-sdk"),
        .product(name: "CloudVideoPlayerUI", package: "cloud-video-player-ios-sdk")
      ]
    ),
    

    Where:

    • CloudVideoPlayer: Main library of the video player SDK for iOS.
    • CloudVideoPlayerUI: Additional library with a collection of interface elements (video player skin).
  5. Save your changes.

Importing the librariesImporting the libraries

To import the libraries, add the following lines to your code file:

import CloudVideoPlayer
import CloudVideoPlayerUI

Using the SDKUsing the SDK

Set up the start of playbackSet up the start of playback

  1. Import a library in the file:

    import CloudVideoPlayer
    
  2. Create the Configuration, Environment, and YaPlayer objects:

    let environment = Environment(configuration: Configuration(from: From(raw: "your-app-bundle")))
    
    class ViewController: UIViewController {
      let player = environment.player()
    }
    
  3. Create the VideoSurface UIView component, add it to the hierarchy, and attach to the player instance:

    let surface = VideoSurface()
    
    override func loadView() {
      super.loadView()
      self.view.addSubview(surface)
      surface.frame = UIScreen.main.bounds
    }
    
    override func viewDidLoad() {
      super.viewDidLoad()
      surface.attach(player: player)
    }
    
  4. Start playback:

    if let source = ContentIdEndpoint(url: URL(string: "https://runtime.video.cloud.yandex.net/player/...")!) {
      player.set(source: source)
      player.play()
    }
    

Where https://runtime.video.cloud.yandex.net/player/... is a link to a video, broadcast, or playlist.

Full code to set up the start of playback
import CloudVideoPlayer

let environment = Environment(configuration: Configuration(from: From(raw: "your-app-bundle")))

class ViewController: UIViewController {

  let player = environment.player()
  let surface = VideoSurface()

  override func loadView() {
    super.loadView()
    self.view.addSubview(surface)
    surface.frame = UIScreen.main.bounds
  }

  override func viewDidLoad() {
    super.viewDidLoad()
    surface.attach(player: player)

    if let source = ContentIdEndpoint(url: URL(string: "https://runtime.video.cloud.yandex.net/player/...")!) {
      player.set(source: source)
      player.play()
    }
  }
}

Where https://runtime.video.cloud.yandex.net/player/... is a link to a video, broadcast, or playlist.

Connecting a video player skinConnecting a video player skin

  1. Import a library in the file:

    import CloudVideoPlayerUI
    
  2. Create the VideoView UIView component, add it to the hierarchy, and connect to the player instance:

    let videoView = VideoView()
    
    override func loadView() {
      super.loadView()
      self.view.addSubview(videoView)
      videoView.frame = UIScreen.main.bounds
    }
    
    override func viewDidLoad() {
      super.viewDidLoad()
      videoView.attach(player: player)
    }
    
Full code to connect a video player skin
import CloudVideoPlayerUI

let videoView = VideoView()

override func loadView() {
  super.loadView()
  self.view.addSubview(videoView)
  videoView.frame = UIScreen.main.bounds
}

override func viewDidLoad() {
  super.viewDidLoad()
  videoView.attach(player: player)
}

Playback in SwiftUIPlayback in SwiftUI

To embed your player in SwiftUI, wrap VideoView from CloudVideoPlayerUI into UIViewRepresentable, then bind it to the YaPlayer instance created via Environment.

  1. Import these libraries in the file:

    import SwiftUI
    import CloudVideoPlayer
    import CloudVideoPlayerUI
    
  2. Create the Environment and YaPlayer objects:

    let environment = Environment(configuration: Configuration(from: From(raw: "your-app-bundle")))
    
    final class PlayerViewModel: ObservableObject {
      let player: YaPlayer = environment.player()
    
      init() {
        guard
          let url = URL(string: "https://runtime.video.cloud.yandex.net/player/..."),
          let source = ContentIdEndpoint(url: url)
        else {
          return
        }
        player.set(source: source)
        player.play()
      }
    }
    
  3. Create the UIViewRepresentable type that creates your VideoView and calls attach(player:):

    struct VideoViewRepresentable: UIViewRepresentable {
      let player: YaPlayer
    
      func makeUIView(context: Context) -> VideoView {
        let view = VideoView()
        view.attach(player: player)
        return view
      }
    
      func updateUIView(_ uiView: VideoView, context: Context) {
        uiView.attach(player: player)
      }
    }
    
  4. Add the wrapper to the SwiftUI hierarchy:

    struct ContentView: View {
      @StateObject private var viewModel = PlayerViewModel()
    
      var body: some View {
        VideoViewRepresentable(player: viewModel.player)
          .aspectRatio(16 / 9, contentMode: .fit)
          .frame(maxHeight: .infinity, alignment: .top)
      }
    }
    

Where https://runtime.video.cloud.yandex.net/player/... is a link to a video, broadcast, or playlist.

Full code for playback in SwiftUI
import SwiftUI
import CloudVideoPlayer
import CloudVideoPlayerUI

let environment = Environment(configuration: Configuration(from: From(raw: "your-app-bundle")))

final class PlayerViewModel: ObservableObject {
  let player: YaPlayer = environment.player()

  init() {
    guard
      let url = URL(string: "https://runtime.video.cloud.yandex.net/player/..."),
      let source = ContentIdEndpoint(url: url)
    else {
      return
    }
    player.set(source: source)
    player.play()
  }
}

struct VideoViewRepresentable: UIViewRepresentable {
  let player: YaPlayer

  func makeUIView(context: Context) -> VideoView {
    let view = VideoView()
    view.attach(player: player)
    return view
  }

  func updateUIView(_ uiView: VideoView, context: Context) {
    uiView.attach(player: player)
  }
}

struct ContentView: View {
  @StateObject private var viewModel = PlayerViewModel()

  var body: some View {
    VideoViewRepresentable(player: viewModel.player)
      .aspectRatio(16 / 9, contentMode: .fit)
      .frame(maxHeight: .infinity, alignment: .top)
  }
}

Where https://runtime.video.cloud.yandex.net/player/... is a link to a video, broadcast, or playlist.

Useful linksUseful links

SDK library references:

  • CloudVideoPlayer: Main library with Environment, YaPlayer, and VideoSurface objects and playback settings.
  • CloudVideoPlayerUI: Additional UI component library with a ready-made VideoView player shell.

Was the article helpful?

Previous
Player events
Next
Environment
© 2026 Direct Cursus Technology L.L.C.