Getting Started

Available Tracking Events

  • The APSMediaPlayer handles playback and rendering of APSMediaUnits and APSMediaOverlays.

    Notifications

    • APSMediaPlayerToggleFullscreenNotification - Posted with each toggle of the fullscreen status
    • APSMediaPlayerWillEnterFullscreenNotification - Posted before the media player enters fullscreen
    • APSMediaPlayerDidEnterFullscreenNotification - Posted after the media player enters fullscreen
    • APSMediaPlayerWillExitFullscreenNotification - Posted before the media player exists fullscreen
    • APSMediaPlayerDidExitFullscreenNotification - Posted after the media player exits fullscreen
    • APSMediaPlayerWasTappedNotification - Posted when the user taps on the media player surface
    • APSMediaPlayerControlsDisplayedNotification - Posted when the video controls bar becomes visible
    • APSMediaPlayerControlsHiddenNotification - Posted when the video controls bar becomes hidden
    • APSMediaPlayerUpdateNotification - Posted every time the internal status of the media player changes. This will happen roughly once every second.
    • APSMediaPlayerUnitFinishedNotification - Posted when a media unit finishes playback, before the remaining playlist units are processed. The userInfo dictionary contains the APSMediaUnit object that just finished playback under the KAPSMediaPlayerCurrentUnit key.
    • APSMediaPlayerErrorNotification - Posted when the media player encounters an error in the process of unit playback. The userInfo dictionary contains the NSError object that represents the error under the kAPSMediaPlayerError key.
    • APSMediaPlayerStatusChangedNotification - Posted when the media player playback state has changed. You can immediately get the new state using the playbackState method of the APSMediaPlayer instance.
    • APSMediaPlayerTrackedEventNotification - Posted when a trackable playback event occurs. The userinfo dictionary contains additional information about the tracked event:
    • the kAPSMediaPlayerEventDescription key returns a string description of the tracked event
    • the kAPSMediaPlayerEventType key returns one of the possible event type constants
    • the kAPSMediaPlayerEventURLs key returns an array of NSURLs that were pinged to track the event
    • the kAPSMediaPlayerCurrentPlaybackTime key returns the playback time when the event was triggered
    • the kAPSMediaPlayerCurrentDuration key returns the total duration of the unit that triggered the event
    • the kAPSMediaPlayerError is present in case the event signals an error
    • the kAPSMediaPlayerSeekStart is present for APSMediaPlayerEventSeeked events and indicates the playback time when the seek started
    • the kAPSMediaPlayerSeekTo is present for APSMediaPlayerEventSeeked events and indicates the requested playback time to seek to
    • APSMediaPlayerInvalidLicenseNotification - Posted when the player license is invalid. Playback will be disabled.
    • APSMediaPlayerWillOpenMiniBrowser - Posted when the internal minibrowser will be opened.
    • APSMediaPlayerWillCloseMiniBrowser - Posted when the internal minibrowser will be dismissed.
    • APSMediaPlayerPlaybackDidFinishNotification - Posted when the internal player backend finished playback. The reason for playback finish in the form of a APSMovieFinishReason value can be retrieved from the userInfo dictionary attached to the notification, under the kAPSMediaPlayerPlaybackDidFinishReason key.
    • APSMediaPlayerLoadStateDidChangeNotification - Posted when the media load state changed. Value can be retrieved from player shared instance.
    • APSMediaPlayerDurationAvailableNotification - Posted when the duration of the played media becomes available. Value can be retrieved from player shared instance.
    • APSMediaPlayerPlaybackStateDidChangeNotification - Posted when the media playback state changed. Value can be retrieved from player shared instance.
    • APSMediaPlayerVolumeDidChangeNotification - Posted when the volume changed. Value can be retrieved from player shared instance.

    Adapter groups

    • kAPSMediaPlayerOverlayControllersGroup - The group name that 3rd party overlay controllers must use when registering with the player. See APSMediaPlayerOverlayControllerProtocol for more details.
    • kAPSMediaPlayerUnitManagersGroup - The group name that 3rd party unit managers must use when registering with the player. See APSUnitManagerProtocol for more details.
    • kAPSMediaPlayerBackendsGroup - The group name that 3rd party backend renderers must use when registering with the player. See APSMediaPlayerProtocol for more details.
    • kAPSMediaPlayerControlPluginsGroup - The group name that 3rd party control plugins must use when registering with the player. See APSControlPluginProtocol for more details.
    See more

    Declaration

    Objective-C

    @interface APSMediaPlayer : KRHub <UIViewControllerTransitioningDelegate,
                                       UIViewControllerAnimatedTransitioning,
                                       SFSafariViewControllerDelegate>

    Swift

    class APSMediaPlayer : KRHub, UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning, SFSafariViewControllerDelegate
  • The APSMediaBuilder assists in creating playlists of fully configurable APSMediaUnits, together with attached, configurable APSMediaOverlays, using JSON files or using a NSDictionary, both following the same structure.

    The media builder also has class methods that assist with the generation of individual APSMediaUnit and APSMediaOverlay objects from corresponding JSON or NSDictionary structures.

    Plugins can be attached to a media builder. Each plugin can dynamically insert, edit or remove units and/or overlays from the generated playlist.

    See more

    Declaration

    Objective-C

    @interface APSMediaBuilder : KRHub

    Swift

    class APSMediaBuilder : KRHub
  • The APSMediaUnit class represents a clip that’s ready to be rendered by the player. A media unit also references an array of APSMediaOverlay objects, defining the overlays connected to the unit.

    See more

    Declaration

    Objective-C

    @interface APSMediaUnit : NSObject <NSCopying, APSMediaTrackableObject>

    Swift

    class APSMediaUnit : NSObject, NSCopying, APSMediaTrackableObject
  • The APSMediaEvent class describes a container that developers can use to instruct the player to run specific blocks of code at specific moments of time. Objects extending this class and implementing the corresponding APSMediaEventProtocol protocol can be added to the player’s main queue and can also be attached to a specific APSMediaUnit object, for runtime triggering.

    See more

    Declaration

    Objective-C

    @interface APSMediaEvent : NSObject <APSMediaEventProtocol>

    Swift

    class APSMediaEvent : NSObject, APSMediaEventProtocol
  • An APSVASTAdBreak object defines an ad break for which the builder plugin will try to generate APSMediaUnits and insert them into the playlist.

    See more

    Declaration

    Objective-C

    @interface APSVASTAdBreak : APSMediaEvent <NSCopying, APSMediaTrackableObject>

    Swift

    class APSVASTAdBreak : APSMediaEvent, NSCopying, APSMediaTrackableObject