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
-
volumeIndicates 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 -
mutedIndicates whether the audio output of the player is muted. Available in iOS 7.0 and later. This property is not observable.
property -
rateIndicates the current rate of playback; 0.0 means “stopped”, 1.0 means “play at the natural rate of the current item”
property -
autoPlayFlag indicating if the player will automatically play the media after intialization.
property -
statusReturns the state of the player.
property -
durationMedia player duration.
property -
currentTimeUpdateIntervalInterval 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 -
currentTimeThe 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 -
seekableRangeThe 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 -
currentItemThe current playback item.
property -
drmManagerThe DRMManager instance associated with the content.
property -
errorThe media player last error.
property -
isPlayingAdReturns whether the player is playing a linear ad.
property -
viewThe video view which will host the playback surface.
property -
videoGravityScaling policy for video display.
property -
allowsAirPlayVideoIndicates whether the player allows AirPlay video playback.
property -
closedCaptionDisplayEnabledIndicates whether the display of subtitles is enabled or not
property
Managing Playback
-
– replaceCurrentItemWithPlayerItem:Replaces the current media player item with the one specified.
-
– prepareToPlayPrepares a movie for playback.
-
– playInitiate the playback of the current media item.
-
– pausePauses the playback of the current media item.
-
– stopStops 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 allowsAirPlayVideoDiscussion
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.hautoPlay
Flag indicating if the player will automatically play the media after intialization.
@property (nonatomic) BOOL autoPlayDiscussion
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.hclosedCaptionDisplayEnabled
Indicates whether the display of subtitles is enabled or not
@property (nonatomic, getter=isClosedCaptionDisplayEnabled) BOOL closedCaptionDisplayEnabledDiscussion
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.hcurrentItem
The current playback item.
@property (readonly, nonatomic, strong) PTMediaPlayerItem *currentItemDiscussion
The current playback item.
Declared In
PTMediaPlayer.hcurrentTime
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 currentTimeDiscussion
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.hcurrentTimeUpdateInterval
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 currentTimeUpdateIntervalDiscussion
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.hdrmManager
The DRMManager instance associated with the content.
@property (readonly, nonatomic) DRMManager *drmManagerDiscussion
The DRMManager instance associated with the content.
Declared In
PTMediaPlayer.hduration
Media player duration.
@property (readonly, nonatomic) CMTime durationDiscussion
Media player duration.
Declared In
PTMediaPlayer.herror
The media player last error.
@property (readonly, nonatomic, strong) PTMediaError *errorDiscussion
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.hisPlayingAd
Returns whether the player is playing a linear ad.
@property (readonly, nonatomic) BOOL isPlayingAdReturn Value
a BOOL indicating the current player is playing ad
Discussion
Returns whether the player is playing a linear ad.
Declared In
PTMediaPlayer.hmuted
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 mutedDiscussion
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.hrate
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 rateDiscussion
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.hseekableRange
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 seekableRangeDiscussion
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.hstatus
Returns the state of the player.
@property (readonly, nonatomic) PTMediaPlayerStatus statusDiscussion
Returns the state of the player.
This property is observable.
Declared In
PTMediaPlayer.hvideoGravity
Scaling policy for video display.
@property (nonatomic) PTMediaPlayerVideoGravity videoGravityDiscussion
Scaling policy for video display.
Declared In
PTMediaPlayer.hview
The video view which will host the playback surface.
@property (readonly, nonatomic, strong) PTMediaPlayerView *viewDiscussion
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.hvolume
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 volumeDiscussion
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.hClass Methods
enableDebugLog:
Toggles debug console logging from the SDK on or off. Default is NO.
+ (void)enableDebugLog:(BOOL)enableParameters
- 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.hplayerWithMediaPlayerItem:
Convenience method to create a media player using a media player item.
+ (PTMediaPlayer *)playerWithMediaPlayerItem:(PTMediaPlayerItem *)itemParameters
- 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.hplayerWithURL:mediaId:metadata:
Convenience method to create a media player using the specified url and metadata.
+ (PTMediaPlayer *)playerWithURL:(NSURL *)url mediaId:(NSString *)mediaId metadata:(PTMetadata *)metadataParameters
- 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.hInstance Methods
initWithMediaPlayerItem:
Initializes the media player with the specified media player item.
- (id)initWithMediaPlayerItem:(PTMediaPlayerItem *)itemParameters
- item
The PTMediaPlayerItem instance to be used for playback
Discussion
Initializes the media player with the specified media player item.
Declared In
PTMediaPlayer.hinitWithURL:mediaId:metadata:
Creates a media player using the specified url and metadata.
- (id)initWithURL:(NSURL *)url mediaId:(NSString *)mediaId metadata:(PTMetadata *)metadataParameters
- 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.hpause
Pauses the playback of the current media item.
- (void)pauseDiscussion
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.hplay
Initiate the playback of the current media item.
- (void)playDiscussion
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.hprepareToPlay
Prepares a movie for playback.
- (void)prepareToPlayDiscussion
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.hreplaceCurrentItemWithPlayerItem:
Replaces the current media player item with the one specified.
- (void)replaceCurrentItemWithPlayerItem:(PTMediaPlayerItem *)itemParameters
- 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.hreset
Resets the player. Destroys the current Item and clears the status to “Created”.
- (void)resetDiscussion
Resets the player. Destroys the current Item and clears the status to “Created”.
Declared In
PTMediaPlayer.hseekToTime:
Initiates a seek to the specified time.
- (void)seekToTime:(CMTime)timeDiscussion
Initiates a seek to the specified time.
This method will not change the status of the MediaPlayer.
Declared In
PTMediaPlayer.hseekToTime: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 ))completionHandlerDiscussion
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.hstop
Stops the playback of the current media item.
- (void)stopDiscussion
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