Skip to main content

SDK v1 Docs

Installation

If you have installed v1 from Cocoapods previously

Use the following SDK version instead of the existing cocoapods version. Before proceeding, remove the VdoCipherKit pod from your podfile and clean the build directory.

requires account activation

If you do not have Fairplay DRM in your account, this might require some activation to use. Contact us through the "Support" section in dashboard.

Go to Xcode 13 > File > Add Packages and search the following URL:

https://github.com/VdoCipher/swift-pm-repo

Select 'Up to Next Major Version' in Dependency Rule and set value as '1.2.3'. We will be following semantic versioning for the version numbers.

The underlying package is a binary xcframework which should work well in both simulators and physical devices. However, note that videos will still not run on simulator.

This version is currently not available via cocoapods. Let me know if there is any concern with Swift PM and if you face any issues setting it up. If you are using the legacy build system, then adding swift package might not work. In that case, you will have to download the xcframework file and copy the framework folder from the arm64 folder.

Usage

The custom view called VdoPlayerView has a loadVideo method which can be used to play using OTP and playbackInfo. The View also provides a callback when the video is ready. This View provides access to the instance of AVPlayer which can be used to observe or read any parameters. The view does not contain controls of its own. The instance of AVPlayer can be used to create any controls.

  1. Create a UIView on Storyboard
  2. Change the attributes of the UIView to VdoPlayerView and Module to VdoCipherKit
  3. Import VdoCipherKit to ViewController
  4. Connect the UIView to the controller file
  5. Use the loadVideo method to start video playback
  6. Obtain the AVPlayer object instance from the onPlayerReady callback

Screenshot of UIView custom class

setting up uiview custom class

Sample code

import UIKit
import VdoCipherKit

class ViewController: UIViewController {
@IBOutlet weak var playerView: VdoPlayerView!
override func viewDidLoad() {
super.viewDidLoad()
try! playerView.loadVideo(
otp: "OTP",
playbackInfo: "PLAYBACKINFO",
onPlayerReady: {() -> Void in
print("player1 loaded")
// self.playerView.player is the AVPlayer instance
self.playerView.player?.play()
}
)
}
}

Frequently asked questions

Getting the error "no compatible resources"

This is due to an account configuration. Please contact us using the help icon on the bottom-right on your dashboard. Let us know your account email, and we shall fix it for your account.

Library path not found

The build folder needs clean up. Please try cleaning build folder. Close and open xcode and try again. If the error still happens, please check if you are using "legacy build system" in your project. "Legacy build system" does not support swift package manager and you will need to install the framework file directly in your project's "Frameworks, Libraries" section. Contact us if you need help with this.

Not compatible with Swift 5.x

Older v1 version available through cocoapods might have been installed. Please ensure that there are no other VdocipherKit.framework folder in your project.