AMP iOS/tvOS SDK Reference
On iOS, the SDK deliverable consists of a set of iOS libraries and resource files to be integrated into an existing iOS application project and a demo player.
The SDK is able to play live and on-demand streams using the Apple HLS streaming format, with the following features:
Features
- Support of multiple player instances
- Support for DVR and seeking
- Support of fullscreen mode and auto rotation in such mode
- AES content encryption
- Token authentication support
- Adaptive bitrate
- Hardware-accelerated playback
- Support of Media Analytics from Akamai Media Player configuration files
- Support for WebVTT closed captions
- Support for progressive media downloads (MP4 format) for advertisement
- Support for Apple Airplay.
- Support fo ChromeCast.
The SDK
- Is already integrated with the following third party plugins:
- Google DoubleClick for Published (DFP) – Advertisement
- Google ChromeCast device
- Supports almost any iOS device in the market running iOS 7.0 minimum
- Supports closed captioning in compliance with the rules set by the Federal Communications Commission (FCC) for Internet video.
Getting Started
- Modules
- AmpCore
- Ads
- Analytics
- AmpMediaAnalytics
- AmpNielsenDCR
- AmpComScore (Beta)
- AmpGoogleAnalytics (Beta)
- AmpAdobeHeartbeat (Beta)
- UI Controllers
- AmpOctoshape
- AmpVirtualReality (Beta)
- AmpMediaAcceleration (Beta)
- AmpChromecast
AMP Core
Akamai Adaptive Media Player is a media player for iOS and tvOS. Akamai AMP can manage different plugins like Chromecast Playback, Akamai Media Analytics, Playback Statistics, Octoshape, ComScore, and VR.
Main module, it basically takes the AVPlayer and augments its functionality to provide proper event notifications, using a well defined and documented protocol stating what events exist and what they are all about. It also ships with a custom UI
Installation
AmpCore: manage basic playback and functions related to playback like ID3 Tracks, Multi-Language and Closed Caption support.
Implementing the Core
To initialize the Core and use basic playback, first make sure to implement the PlayerEventObserver protocol on your View Controller
import UIKit
import AmpCore
class ViewController: UIViewController, PlayerEventObserver {
Declare a variable for the AmpPlayer and create the instance on your viewDidLoad function for example.
var ampPlayer: AmpPlayer!
override func viewDidLoad() {
super.viewDidLoad()
// Instantiate the AmpPlayer
self.ampPlayer = AmpPlayer(parentView: self.view)
// Set your respective license
self.ampPlayer.setLicense(license)
// Register the current class as observer to receive notifications
self.ampPlayer.registerObserver(self)
// Start handling the url
self.ampPlayer.handleUrl(url)
}
The previous initializes the player, sets the license, registers the class as an observer and then starts handling the stream, this will not start your playback, there are a couple of ways you can implement autoplay in our player. The first way is to simply set the autoplay property of the AmpPlayer’s instance to true:
self.ampPlayer.autoplay = true
The other way to accomplish autoplay in our play is to listen to the onBufferingStateChanged in and check for the state BufferingState.ready, then you would proceed to call play in your AmpPlayer instance:
func onBufferingStateChanged(_ ampPlayer: AmpPlayer) {
if (ampPlayer.bufferingState == BufferingState.ready) {
// Here we use the manual way to achieve autoplay
ampPlayer.play()
}
}