VdoCipher iOS SDK

Latest version: 1.2.4

Swift version: 5.2.2

Note: This SDK can only work on physical device

Installation

If you have cocoapods set up in your project, you already know what to do. If cocoapods is not initialized already, follow the below steps.Within your project, run pod init, and add the following to the Podfile:

pod 'VdoCipherKit', '1.2.4'
If your xcode project swift version is 5.1.2, changed the version as below:
pod 'VdoCipherKit', '1.2.1'
If your xcode project swift version is 5.1, changed the version as below:
pod 'VdoCipherKit', '1.2.0'
If your xcode project swift version is 5.0, changed the version as below:
pod 'VdoCipherKit', '1.1.0'

Then, run

pod install

Reopen the test project's .xcworkspace  file.

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. The 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

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() } ) } }

Sample screenshots

Adding class attributes to UIView

Automated testing and simulator support

Simulator runs on x86_64 architecture (64 bit) which is generally found in Laptops while iOS devices run on amd64 architecture which is different enough that the same compiled framework does not work on both devices. Previously the solution for distributing the binaries was creating a universal binary. This is a binary which has both the architecture combined together. However, App store no longer supports submitting apps with multiple architecture. This has helps make app download size smaller but now universal binary can not be used for both distribution, development and continuous testing. Hence, we have different frameworks for simulator and distribution.

1. This only supports build support. DRM APIs is not available on simulator and we cannot have playback.
2. A before-script for the automated testing can be used to switch to universal version and an after-script can roll back the version to distribution version.

To make it work on simulator, change the version of VdoCipherKit in Podfile to the universal version. e.g.

pod 'VdoCipherKit', '1.2.2-universal'