Akamai AMP Player for iOS and tvOS

Akamai AMP player, is a HLS player for iOS and tvOS. Akamai AMP player can manage different plugins like Chromecast Playback, Akamai Media Analytics, Playback Statistics and Octoshape.

How to Use

Using AMP player on your iOS project is very simple, you need to first to declare a variable with the type AmpPlayerManager

var ampPlayerManager: AmpPlayerManager!

Then create a instance and assigned to this variable for example on your viewDidLoad() function

override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        // Instantiate player
        let rect = CGRectMake(10, 40, 300, 180)

        self.ampPlayerManager = AmpPlayerManager(parentView: self.view, playerFrame: rect)
    }

This will create a player with a the size defined (300x180) on the position x=10 and y=40 related to the current view.

AMP Player also offers custom callbacks to manage the Playback events and plugin events.

For example if you want to track the Playback events, you need to implement the PlayerEventObserver and register to the manager.

class ViewController: UIViewController, PlayerEventObserver

Now register the the observer on the AmpPlayerManager using the AmpPlayer reference

self.ampPlayerManager.ampPlayer.registerObserver(self)

Finally you can implement the callbacks on your class, we are listeng here when the stream is ready to play, to generate a auto play feature.

func onBufferingStateChanged(ampPlayer: AmpPlayer) {
  if (ampPlayer.bufferingState == BufferingState.Ready) {
    print("BufferingState.Ready")
    ampPlayer.play()
  }
}

Installation

To install the AMP Player on you project you only need to import the frameworks related:

  • AmpCore.framework

If you need plugins you have to add it to:

  • AmpOctoshape.framework
  • AmpMediaAnalytics.framework
  • AmpStatistics.framework
  • AmpChromecast.framework
  • AmpUICore.framework

Need help?

If you need help trying to integrate the player on your project, or you want to report issues or problems you can send a email to amp-sdk-support@akamai.com