PTMediaPlayer Class Reference
Inherits from | NSObject |
Declared in | PTMediaPlayer.h |
Overview
PTMediaPlayer class is the root component for the PMP framework.
Applications create an instance of this class to playback a media. Notifications are dispatched by this component to let the application know about the status of the player at any given time.
ADOBE CONFIDENTIAL
Copyright 2013 Adobe Systems Incorporated All Rights Reserved.
NOTICE: All information contained herein is, and remains the property of Adobe Systems Incorporated and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to Adobe Systems Incorporated and its suppliers and are protected by all applicable intellectual property laws, including trade secret and copyright laws. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Adobe Systems Incorporated.
Tasks
Logging
-
+ enableDebugLog:
Toggles debug console logging from the SDK on or off. Default is NO.
Creating a Player
-
+ playerWithMediaPlayerItem:
Convenience method to create a media player using a media player item.
-
+ playerWithURL:mediaId:metadata:
Convenience method to create a media player using the specified url and metadata.
-
– initWithMediaPlayerItem:
Initializes the media player with the specified media player item.
-
– initWithURL:mediaId:metadata:
Creates a media player using the specified url and metadata.
Reset a Player
Properties
-
volume
Indicates the current audio volume of the player; 0.0 means “silence all audio,” 1.0 means “play at the full volume of the current item.” Available in iOS 7.0 and later. This property is not observable.
property -
muted
Indicates whether the audio output of the player is muted. Available in iOS 7.0 and later. This property is not observable.
property -
rate
Indicates the current rate of playback; 0.0 means “stopped”, 1.0 means “play at the natural rate of the current item”
property -
autoPlay
Flag indicating if the player will automatically play the media after intialization.
property -
status
Returns the state of the player.
property -
duration
Media player duration.
property -
currentTimeUpdateInterval
Interval between the dispatch of change events for the current time in milliseconds.
The default is 250 milliseconds. A non-positive value disables the dispatch of the change events.
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 -
seekableRange
The playback range of a stream or empty if the stream is not processed yet. This range includes the duration of any additional content inserted into the stream (ex: ads).
property -
currentItem
The current playback item.
property -
drmManager
The DRMManager instance associated with the content.
property -
error
The media player last error.
property -
isPlayingAd
Returns whether the player is playing a linear ad.
property -
view
The video view which will host the playback surface.
property -
videoGravity
Scaling policy for video display.
property -
allowsAirPlayVideo
Indicates whether the player allows AirPlay video playback.
property -
closedCaptionDisplayEnabled
Indicates whether the display of subtitles is enabled or not
property
Managing Playback
-
– replaceCurrentItemWithPlayerItem:
Replaces the current media player item with the one specified.
-
– prepareToPlay
Prepares a movie for playback.
-
– play
Initiate the playback of the current media item.
-
– pause
Pauses the playback of the current media item.
-
– stop
Stops the playback of the current media item.
-
– seekToTime:
Initiates a seek to the specified time.
-
– seekToTime:completionHandler:
Initiates a seek to the specified time and executes the specified block when the seek operation has either been completed or been interrupted.
Properties
allowsAirPlayVideo
Indicates whether the player allows AirPlay video playback.
@property (nonatomic) BOOL allowsAirPlayVideo
Discussion
Indicates whether the player allows AirPlay video playback.
Enable AirPlay by setting the allowsAirPlayVideo property to YES. disable AirPlay, set the allowsAirPlayVideo property to NO.
Declared In
PTMediaPlayer.h
autoPlay
Flag indicating if the player will automatically play the media after intialization.
@property (nonatomic) BOOL autoPlay
Discussion
Flag indicating if the player will automatically play the media after intialization.
If the flag is TRUE, the framework will start playing the media stream once all the data is available. If the flag is FALSE, the application must call play to start the media playback
Declared In
PTMediaPlayer.h
closedCaptionDisplayEnabled
Indicates whether the display of subtitles is enabled or not
@property (nonatomic, getter=isClosedCaptionDisplayEnabled) BOOL closedCaptionDisplayEnabled
Discussion
Indicates whether the display of subtitles is enabled or not
Enable/Disable the display of CC by setting the closedCaptionDisplayEnabled property to YES/NO.
Declared In
PTMediaPlayer.h
currentItem
The current playback item.
@property (readonly, nonatomic, strong) PTMediaPlayerItem *currentItem
Discussion
The current playback item.
Declared In
PTMediaPlayer.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
PTMediaPlayer.h
currentTimeUpdateInterval
Interval between the dispatch of change events for the current time in milliseconds.
The default is 250 milliseconds. A non-positive value disables the dispatch of the change events.
@property (nonatomic) NSTimeInterval currentTimeUpdateInterval
Discussion
Interval between the dispatch of change events for the current time in milliseconds.
The default is 250 milliseconds. A non-positive value disables the dispatch of the change events.
Declared In
PTMediaPlayer.h
drmManager
The DRMManager instance associated with the content.
@property (readonly, nonatomic) DRMManager *drmManager
Discussion
The DRMManager instance associated with the content.
Declared In
PTMediaPlayer.h
duration
Media player duration.
@property (readonly, nonatomic) CMTime duration
Discussion
Media player duration.
Declared In
PTMediaPlayer.h
error
The media player last error.
@property (readonly, nonatomic, strong) PTMediaError *error
Discussion
The media player last error.
When an error occurs the media player dispatches a notification containing the error, but also saves it internally.
Declared In
PTMediaPlayer.h
isPlayingAd
Returns whether the player is playing a linear ad.
@property (readonly, nonatomic) BOOL isPlayingAd
Return Value
a BOOL indicating the current player is playing ad
Discussion
Returns whether the player is playing a linear ad.
Declared In
PTMediaPlayer.h
muted
Indicates whether the audio output of the player is muted. Available in iOS 7.0 and later. This property is not observable.
@property (nonatomic, getter=isMuted) BOOL muted
Discussion
Indicates whether the audio output of the player is muted. Available in iOS 7.0 and later. This property is not observable.
Declared In
PTMediaPlayer.h
rate
Indicates the current rate of playback; 0.0 means “stopped”, 1.0 means “play at the natural rate of the current item”
@property (nonatomic) float rate
Discussion
Indicates the current rate of playback; 0.0 means “stopped”, 1.0 means “play at the natural rate of the current item”
Declared In
PTMediaPlayer.h
seekableRange
The playback range of a stream or empty if the stream is not processed yet. This range includes the duration of any additional content inserted into the stream (ex: ads).
@property (readonly, nonatomic) CMTimeRange seekableRange
Discussion
The playback range of a stream or empty if the stream is not processed yet. This range includes the duration of any additional content inserted into the stream (ex: ads).
Declared In
PTMediaPlayer.h
status
Returns the state of the player.
@property (readonly, nonatomic) PTMediaPlayerStatus status
Discussion
Returns the state of the player.
This property is observable.
Declared In
PTMediaPlayer.h
videoGravity
Scaling policy for video display.
@property (nonatomic) PTMediaPlayerVideoGravity videoGravity
Discussion
Scaling policy for video display.
Declared In
PTMediaPlayer.h
view
The video view which will host the playback surface.
@property (readonly, nonatomic, strong) PTMediaPlayerView *view
Discussion
The video view which will host the playback surface.
The client will use this property to position and resize the video display.
Declared In
PTMediaPlayer.h
volume
Indicates the current audio volume of the player; 0.0 means “silence all audio,” 1.0 means “play at the full volume of the current item.” Available in iOS 7.0 and later. This property is not observable.
@property (nonatomic) float volume
Discussion
Indicates the current audio volume of the player; 0.0 means “silence all audio,” 1.0 means “play at the full volume of the current item.” Available in iOS 7.0 and later. This property is not observable.
Declared In
PTMediaPlayer.h
Class Methods
enableDebugLog:
Toggles debug console logging from the SDK on or off. Default is NO.
+ (void)enableDebugLog:(BOOL)enable
Parameters
- enable
YES to turn on debug messages logging to console and NO otherwise
Discussion
Toggles debug console logging from the SDK on or off. Default is NO.
Declared In
PTMediaPlayer.h
playerWithMediaPlayerItem:
Convenience method to create a media player using a media player item.
+ (PTMediaPlayer *)playerWithMediaPlayerItem:(PTMediaPlayerItem *)item
Parameters
- item
The PTMediaPlayerItem instance to be used for playback
Discussion
Convenience method to create a media player using a media player item.
Declared In
PTMediaPlayer.h
playerWithURL:mediaId:metadata:
Convenience method to create a media player using the specified url and metadata.
+ (PTMediaPlayer *)playerWithURL:(NSURL *)url mediaId:(NSString *)mediaId metadata:(PTMetadata *)metadata
Parameters
- url
The url to be used for playback
- mediaId
The unique id associated with the current media
- metadata
The PTMetadata instance describing the metadata for the current media
Discussion
Convenience method to create a media player using the specified url and metadata.
Declared In
PTMediaPlayer.h
Instance Methods
initWithMediaPlayerItem:
Initializes the media player with the specified media player item.
- (id)initWithMediaPlayerItem:(PTMediaPlayerItem *)item
Parameters
- item
The PTMediaPlayerItem instance to be used for playback
Discussion
Initializes the media player with the specified media player item.
Declared In
PTMediaPlayer.h
initWithURL:mediaId:metadata:
Creates a media player using the specified url and metadata.
- (id)initWithURL:(NSURL *)url mediaId:(NSString *)mediaId metadata:(PTMetadata *)metadata
Parameters
- url
The url to be used for playback
- mediaId
The unique id associated with the current media
- metadata
The PTMetadata instance describing the metadata for the current media
Discussion
Creates a media player using the specified url and metadata.
Declared In
PTMediaPlayer.h
pause
Pauses the playback of the current media item.
- (void)pause
Discussion
Pauses the playback of the current media item.
If the playback was already paused or stopped, this method has no effect. In order to resume the playback of the current media item, call the play method.
Declared In
PTMediaPlayer.h
play
Initiate the playback of the current media item.
- (void)play
Discussion
Initiate the playback of the current media item.
If the current media item was paused, then invoking this command will resume the playback for where it was paused, other wise it will start the playback from the beginning. if the current media item is not yet initialized or is not ready to play it will invoke prepareToPlay first.
Declared In
PTMediaPlayer.h
prepareToPlay
Prepares a movie for playback.
- (void)prepareToPlay
Discussion
Prepares a movie for playback.
If the client calls play method directly and the media item is not yet initialized or ready to play, the media player will invoked this method automatically.
Declared In
PTMediaPlayer.h
replaceCurrentItemWithPlayerItem:
Replaces the current media player item with the one specified.
- (void)replaceCurrentItemWithPlayerItem:(PTMediaPlayerItem *)item
Parameters
- item
The PTMediaPlayerItem instance to be used for playback
Discussion
Replaces the current media player item with the one specified.
The replacement is asynchronous. The client need to observe currentItem property in order to detect when the replacement was completed.
Declared In
PTMediaPlayer.h
reset
Resets the player. Destroys the current Item and clears the status to “Created”.
- (void)reset
Discussion
Resets the player. Destroys the current Item and clears the status to “Created”.
Declared In
PTMediaPlayer.h
seekToTime:
Initiates a seek to the specified time.
- (void)seekToTime:(CMTime)time
Discussion
Initiates a seek to the specified time.
This method will not change the status of the MediaPlayer.
Declared In
PTMediaPlayer.h
seekToTime:completionHandler:
Initiates a seek to the specified time and executes the specified block when the seek operation has either been completed or been interrupted.
- (void)seekToTime:(CMTime)time completionHandler:(void ( ^ ) ( BOOL finished ))completionHandler
Discussion
Initiates a seek to the specified time and executes the specified block when the seek operation has either been completed or been interrupted.
This method will not change the status of the MediaPlayer. The seek operation is asynchronous. A notification will be dispatched to signal the completion of the seek operation.
Declared In
PTMediaPlayer.h
stop
Stops the playback of the current media item.
- (void)stop
Discussion
Stops the playback of the current media item.
If the media playback was already stopped, this method has no effect. The stop method releases any hardware resources which were associated with the current media and reset the currentTime or currentDate properties, so a call to play will resume the playback from the begining.
Declared In
PTMediaPlayer.h