Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Cloud Video
    • Overview
    • Control
    • Troubleshooting
      • Overview
      • IFrame
      • iOS
  • Access management
  • Pricing policy
  • Audit Trails events
  • Release notes

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
  1. Video Player
  2. SDK
  3. iOS

Video player SDK for iOS

Written by
Yandex Cloud
Updated at March 6, 2025
  • Adding a video player SDK library
  • Importing the libraries
  • Using the SDK
    • Set up the start of playback
    • Connecting a video player skin

You can embed a video player with Cloud Video content into your mobile app for iOS. The video player SDK for iOS will help you do this.

To use the SDK, install and configure the Xcode development environment (version 15.3 or higher) with the Swift programming language (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.0-beta.

  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.0-beta"
      )
    ],
    
  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 Environment and YaPlayer objects:

    let environment = Environment(from: From(raw: "you-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:

    player.set(source: ContentId(rawValue: "https://runtime.video.cloud.yandex.net/player/..."))
    player.play()
    

Where https://runtime.video.cloud.yandex.net/player/... is a link to playable content, e.g., https://runtime.video.cloud.yandex.net/player/video/vplvmyqsxi7dlwndvb4y. For more information, see Getting an embed code or link to a video and Getting an embed code or link to a broadcast.

Full code to set up the start of playback
import CloudVideoPlayer

let environment = Environment(from: From(raw: "you-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)

    player.set(source: ContentId(rawValue: "https://runtime.video.cloud.yandex.net/player/..."))
    player.play()
  }
}

Where https://runtime.video.cloud.yandex.net/player/... is a link to playable content, e.g., https://runtime.video.cloud.yandex.net/player/video/vplvmyqsxi7dlwndvb4y. For more information, see Getting an embed code or link to a video and Getting an embed code or link to a broadcast.

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(surface)
      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(surface)
  videoView.frame = UIScreen.main.bounds
}

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

Was the article helpful?

Previous
IFrame
Next
Getting started
© 2025 Direct Cursus Technology L.L.C.