Inherits from NSObject
Declared in PTMediaPlayerItem.h

Overview

PTMediaPlayerItem class represents a specific audio-video media.

Tasks

Other Methods

  •   url

    The URL for retrieving the media m3u8 playlist.

    property
  •   state
    • Specifies whether the media is being loaded or ready to play.
    • States: PTMediaPlayerItemStateCreated(Default), PTMediaPlayerItemStateLoadingPreroll, PTMediaPlayerItemStateReadyToPlayPreroll, PTMediaPlayerItemStateLoading, PTMediaPlayerItemStateReadyToPlay, PTMediaPlayerItemStateError
    property
  •   mediaId

    Media identifier.

    property
  •   metadata

    Custom metadata associated with this media item.

    property
  •   secure

    Specifies whether media playlist is SSL secured

    property
  •   isLocal

    Specifies whether media is being served from a local file system or through a local server

    property
  •   isDrmProtected

    Specifies whether the media is protected by Adobe Access DRM

    property
  •   duration

    Media player item duration.

    property
  •   currentTime

    The current playhead time as reported by the underlying components. The playhead time is calculated relative to the resolved stream, one which can contain multiple ads inserted.

    property
  •   currentDate

    The current playhead date as reported by the underlying component.

    property
  •   nativeSize

    Native size of the media item.

    property
  •   nativeDuration

    Native duration of media item.

    property
  •   isLive

    Flag indicating if the stream is live or not. Returns YES if the stream is a live stream, NO otherwise. Default value = NO

    property
  •   isDynamic

    Flag indicating that the media has multiple bit-rate profiles. Returns YES if multiple profiles are available, NO otherwise. Default value = NO

    property
  •   profiles

    List of currently available bit-rates profiles for the current playback window.

    property
  •   subtitlesOptions

    List of currently available subtitles tracks for the current stream. NSArray of PTMediaSelectionOption instances

    property
  •   audioOptions

    List of currently available audio tracks for the current stream. NSArray of PTMediaSelectionOption instances

    property
  •   selectedSubtitleOption

    PTMediaSelectionOption instance of the selected preferred subtitles track option. Returns nil if there is not preferred track.

    property
  •   selectedAudioOption

    PTMediaSelectionOption instance of the default selected alternate audio track option. Returns nil if there is not preferred track.

    property
  •   ccStyle

    Represents text styling rules that can be applied to text in a media item.

    property
  •   notificationHistory

    An instance of the PTNotificationHistory class.

    property
  •   drmMetadataInfos

    Array of all the DRMMetadataInfo instances associated with the current playback window. This property is not observable.

    property
  •   adResolverClass

    A Class following PTAdResolver protocol used for custom ad resolving.

    property
  •   timedMetadataCollection

    A collection of PTTimedMetadata objects. Use this property to access all unique PTTimedMetadata objects for each subscribed tag.

    property

Creating a Player Item

Managing Media Options

Managing Playback

Properties

adResolverClass

A Class following PTAdResolver protocol used for custom ad resolving.

@property (nonatomic, assign) Class<PTAdResolver> adResolverClass

Discussion

A Class following PTAdResolver protocol used for custom ad resolving.

Use this property to define a Class that would be used for dynamically creating an ad resolver. The property must be set on the PTMediaPlayerItem during initialization and must not be modified later. The Class provided must follow the PTAdResolver protocol.

Default Class is PTAuditudeAdResolver

Declared In

PTMediaPlayerItem.h

audioOptions

List of currently available audio tracks for the current stream. NSArray of PTMediaSelectionOption instances

@property (readonly, nonatomic) NSArray *audioOptions

Discussion

List of currently available audio tracks for the current stream. NSArray of PTMediaSelectionOption instances

Declared In

PTMediaPlayerItem.h

ccStyle

Represents text styling rules that can be applied to text in a media item.

@property (nonatomic, retain) PTTextStyleRule *ccStyle

Discussion

Represents text styling rules that can be applied to text in a media item.

Use this property to format subtitles, closed captions, and other text-related content of the item. The rules you specify can be applied to all or part of the text in the media item.

Declared In

PTMediaPlayerItem.h

currentDate

The current playhead date as reported by the underlying component.

@property (readonly, nonatomic, strong) NSDate *currentDate

Discussion

The current playhead date as reported by the underlying component.

The playhead date is calculated based on the current playhead time and the date mapped to the starting of the segment.

Declared In

PTMediaPlayerItem.h

currentTime

The current playhead time as reported by the underlying components. The playhead time is calculated relative to the resolved stream, one which can contain multiple ads inserted.

@property (readonly, nonatomic) CMTime currentTime

Discussion

The current playhead time as reported by the underlying components. The playhead time is calculated relative to the resolved stream, one which can contain multiple ads inserted.

Declared In

PTMediaPlayerItem.h

drmMetadataInfos

Array of all the DRMMetadataInfo instances associated with the current playback window. This property is not observable.

@property (nonatomic, readonly) NSArray *drmMetadataInfos

Discussion

Array of all the DRMMetadataInfo instances associated with the current playback window. This property is not observable.

Declared In

PTMediaPlayerItem.h

duration

Media player item duration.

@property (readonly, nonatomic) CMTime duration

Discussion

Media player item duration.

Declared In

PTMediaPlayerItem.h

isDrmProtected

Specifies whether the media is protected by Adobe Access DRM

@property (readonly, nonatomic) BOOL isDrmProtected

Discussion

Specifies whether the media is protected by Adobe Access DRM

Declared In

PTMediaPlayerItem.h

isDynamic

Flag indicating that the media has multiple bit-rate profiles. Returns YES if multiple profiles are available, NO otherwise. Default value = NO

@property (readonly, nonatomic) BOOL isDynamic

Discussion

Flag indicating that the media has multiple bit-rate profiles. Returns YES if multiple profiles are available, NO otherwise. Default value = NO

Declared In

PTMediaPlayerItem.h

isLive

Flag indicating if the stream is live or not. Returns YES if the stream is a live stream, NO otherwise. Default value = NO

@property (readonly, nonatomic) BOOL isLive

Discussion

Flag indicating if the stream is live or not. Returns YES if the stream is a live stream, NO otherwise. Default value = NO

Declared In

PTMediaPlayerItem.h

isLocal

Specifies whether media is being served from a local file system or through a local server

@property (readwrite, nonatomic) BOOL isLocal

Discussion

Specifies whether media is being served from a local file system or through a local server

Declared In

PTMediaPlayerItem.h

mediaId

Media identifier.

@property (readonly, nonatomic, strong) NSString *mediaId

Discussion

Media identifier.

External services (ad resolving, ad and anc content tracking, custom CMS) might use this identifier to retrieve and store information related to this media.

Declared In

PTMediaPlayerItem.h

metadata

Custom metadata associated with this media item.

@property (readonly, nonatomic, strong) PTMetadata *metadata

Discussion

Custom metadata associated with this media item.

Declared In

PTMediaPlayerItem.h

nativeDuration

Native duration of media item.

@property (readonly, nonatomic) NSTimeInterval nativeDuration

Discussion

Native duration of media item.

Once the playback starts, the inherent duration of the media will be retrieved. This duration does not include any additional elements ( slates, ads etc) which might be inserted into the stream.

Declared In

PTMediaPlayerItem.h

nativeSize

Native size of the media item.

@property (readonly, nonatomic) CGSize nativeSize

Discussion

Native size of the media item.

Once the playback starts, the actual size of the media will be retrieved. The client can observe this property to detect when the video must be scale down or up to match the desired presentation size.

Declared In

PTMediaPlayerItem.h

notificationHistory

An instance of the PTNotificationHistory class.

@property (nonatomic, readonly) PTNotificationHistory *notificationHistory

Discussion

An instance of the PTNotificationHistory class.

Use this property to access the list of events stored in the notification history or to insert new notifications to the player items notification history.

Declared In

PTMediaPlayerItem.h

profiles

List of currently available bit-rates profiles for the current playback window.

@property (readonly, nonatomic) NSArray *profiles

Discussion

List of currently available bit-rates profiles for the current playback window.

Declared In

PTMediaPlayerItem.h

secure

Specifies whether media playlist is SSL secured

@property (readwrite, nonatomic) BOOL secure

Discussion

Specifies whether media playlist is SSL secured

Declared In

PTMediaPlayerItem.h

selectedAudioOption

PTMediaSelectionOption instance of the default selected alternate audio track option. Returns nil if there is not preferred track.

@property (readonly, nonatomic) PTMediaSelectionOption *selectedAudioOption

Discussion

PTMediaSelectionOption instance of the default selected alternate audio track option. Returns nil if there is not preferred track.

Declared In

PTMediaPlayerItem.h

selectedSubtitleOption

PTMediaSelectionOption instance of the selected preferred subtitles track option. Returns nil if there is not preferred track.

@property (readonly, nonatomic) PTMediaSelectionOption *selectedSubtitleOption

Discussion

PTMediaSelectionOption instance of the selected preferred subtitles track option. Returns nil if there is not preferred track.

Declared In

PTMediaPlayerItem.h

state

  • Specifies whether the media is being loaded or ready to play.
  • States: PTMediaPlayerItemStateCreated(Default), PTMediaPlayerItemStateLoadingPreroll, PTMediaPlayerItemStateReadyToPlayPreroll, PTMediaPlayerItemStateLoading, PTMediaPlayerItemStateReadyToPlay, PTMediaPlayerItemStateError
@property (readonly, nonatomic) PTMediaPlayerItemState state

Discussion

  • Specifies whether the media is being loaded or ready to play.
  • States: PTMediaPlayerItemStateCreated(Default), PTMediaPlayerItemStateLoadingPreroll, PTMediaPlayerItemStateReadyToPlayPreroll, PTMediaPlayerItemStateLoading, PTMediaPlayerItemStateReadyToPlay, PTMediaPlayerItemStateError

Declared In

PTMediaPlayerItem.h

subtitlesOptions

List of currently available subtitles tracks for the current stream. NSArray of PTMediaSelectionOption instances

@property (readonly, nonatomic) NSArray *subtitlesOptions

Discussion

List of currently available subtitles tracks for the current stream. NSArray of PTMediaSelectionOption instances

Declared In

PTMediaPlayerItem.h

timedMetadataCollection

A collection of PTTimedMetadata objects. Use this property to access all unique PTTimedMetadata objects for each subscribed tag.

@property (nonatomic, readonly) NSArray *timedMetadataCollection

Discussion

A collection of PTTimedMetadata objects. Use this property to access all unique PTTimedMetadata objects for each subscribed tag.

Declared In

PTMediaPlayerItem.h

url

The URL for retrieving the media m3u8 playlist.

@property (readonly, nonatomic, strong) NSURL *url

Discussion

The URL for retrieving the media m3u8 playlist.

Declared In

PTMediaPlayerItem.h

Instance Methods

initWithUrl:mediaId:metadata:

Creates a new PTMediaPlayerItem instance with specified properties.

- (id)initWithUrl:(NSURL *)url mediaId:(NSString *)mediaId metadata:(PTMetadata *)metadata

Parameters

url

The url source of the player item

mediaId

The unique mediaId of the player item

metadata

The PTMetadata instance describing the player item metadata

Discussion

Creates a new PTMediaPlayerItem instance with specified properties.

Declared In

PTMediaPlayerItem.h

loadDRMMetadataWithCompletionHandler:errorHandler:

Loads the DRM Metadata on the item before playback.

- (void)loadDRMMetadataWithCompletionHandler:(void ( ^ ) ( PTDRMMetadataInfo *metadata ))completionHandler errorHandler:(void ( ^ ) ( PTMediaError *error ))errorHandler

Parameters

completionHandler

The block that gets called once the DRM Metadata is available. The completionHandler receives the DRM Metadata as an argument.

errorHandler

The block that gets called if the loading of the DRM Metadata failed. The errorHandler receives a PTMediaError with the description of the operatation failure.

Discussion

Loads the DRM Metadata on the item before playback.

If needed, the client may call loadDRMMetadataWithCompletionHandler:errorHandler: to load the DRM Metadata before the playback. This is used to manually handle authentication or any other DRM operation. completionHandler.

Declared In

PTMediaPlayerItem.h

prepareToPlay

Prepares an item for playback.

- (void)prepareToPlay

Discussion

Prepares an item for playback.

If the client calls play method directly in the PTMediaPlayer and the media item is not yet initialized or ready to play, the media player will invoke this method automatically.

Declared In

PTMediaPlayerItem.h

selectAudioOption:

Set an alternate audio track to be played.

- (void)selectAudioOption:(PTMediaSelectionOption *)mediaSelectionOption

Discussion

Set an alternate audio track to be played.

This methods requires a PTMediaSelectionOption for the desired alternate audio track. Use the audioOptions @property of PTMediaPlayerItem to get access to the available tracks. audioOptions @property is only available after the status of the player is PTMediaPlayerStatusReady.

Declared In

PTMediaPlayerItem.h

selectSubtitleOption:

Set a subtitles track to be displayed.

- (void)selectSubtitleOption:(PTMediaSelectionOption *)mediaSelectionOption

Discussion

Set a subtitles track to be displayed.

This methods requires a PTMediaSelectionOption for the desired subtitles track. Use the subtitlesOptions @property of PTMediaPlayerItem to get access to the available tracks. subtitlesOptions @property is only available after the status of the player is PTMediaPlayerStatusReady.

Declared In

PTMediaPlayerItem.h