SDK v1 Docs
#
InstallationIf 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 12 > File > Swift Packages > Add Package Dependency and use the following URL:
https://github.com/VdoCipher/swift-pm-repo
The latest version will be 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.
#
UsageThe 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.
- Create a UIView on Storyboard
- Change the attributes of the UIView to VdoPlayerView and Module to VdoCipherKit
- Import VdoCipherKit to ViewController
- Connect the UIView to the controller file
- Use the loadVideo method to start video playback
- Obtain the AVPlayer object instance from the onPlayerReady callback
#
Screenshot of UIView custom class#
Sample codeimport UIKitimport 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 foundThe 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.xOlder v1 version available through cocoapods might have been installed.
Please ensure that there are no other VdocipherKit.framework
folder in
your project.