OpenTV Player SDK For iOS  version 2.30.0
NMPAVPlayer Class Reference

NMPAVPlayer is the Nagra extension of iOS system AVPlayer class to support AES-128 scrambled Http Adaptive Streaming protocol stream with hybrid integration with Nagra CPAK library. More...

#import <NMPAVPlayer.h>

Inheritance diagram for NMPAVPlayer:

Instance Methods

(instancetype) - initWithURL:
 Returns an instance of NMPAVPlayer that plays a single AES-128 encrypted audiovisual resource referenced by URL. More...
 
(instancetype) - initWithPlayerItem:
 Returns an instance of NMPAVPlayer that plays a single AES-128 encrypted audiovisual resource referenced by the AVPlayerItem. More...
 
(void) - replaceCurrentItemWithPlayerItem:
 Replaces the player's current item with the specified player item. More...
 
(BOOL) - addSubtitleWithUrl:MIMEType:Language:
 Add an external subtitle content through URL. More...
 
(BOOL) - addSubtitleWithContent:MIMEType:Language:
 Add an external subtitle content through payload. More...
 
(void) - registerTrackChangedListener:
 Register the INMPTrackChangedListener to get track changed notification. More...
 
(void) - unregisterTrackChangedListener:
 Unregister the INMPTrackChangedListener. More...
 
(NSArray *) - getTrackInfo
 Returns an array of the NMPTrackInfo of the current playing stream. More...
 
(void) - selectTrack:
 Select the specific subtitle track to decode and display. More...
 
(void) - deselectTrack:
 Select the specific subtitle track to deselect and remove from display. More...
 
(void) - registerTagListener:forTags:
 Register the INMPTagListener to get the specified tags parsed from media playlists. More...
 
(void) - unregisterTagListener:
 Unregister the INMPTagListener. More...
 
(void) - unregisterAllTagListeners
 Unregister all INMPTagListeners. More...
 

Class Methods

(id) + playerWithURL:
 Returns an instance of NMPAVPlayer that plays a single AES-128 encrypted audiovisual resource referenced by URL. More...
 
(id) + playerWithPlayerItem:
 Returns an instance of NMPAVPlayer that plays a single AES-128 encrypted audiovisual resource referenced by the the AVPlayerItem. More...
 

Properties

UIView * videoView
 Property to set video renderView, and it also used as subtitle parent view. More...
 
int maxBandwidth
 Property to set and get max bandwidth in unit of bit per second. More...
 
CGSize maxResolution
 Property to set and get max resolution in pixels; For http adaptive streaming any stream with greater resolution than this value will be ignored. More...
 

Detailed Description

NMPAVPlayer is the Nagra extension of iOS system AVPlayer class to support AES-128 scrambled Http Adaptive Streaming protocol stream with hybrid integration with Nagra CPAK library.

To learn more about AVPlayer, please refer to Apple online document: https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html

Definition at line 33 of file NMPAVPlayer.h.

Method Documentation

◆ addSubtitleWithContent:MIMEType:Language:()

- (BOOL) addSubtitleWithContent: (const NSData *)  xContent
MIMEType: (NSString *)  xMIMEType
Language: (NSString *)  xLanguage 

Add an external subtitle content through payload.

Parameters
[in]xContentThe subtitle content data.
[in]xMIMETypeThe MIMEType of the subtitle.
[in]xLanguageThe language code of the subtitle.
Returns
YES when the subtitle is added correctly. NO when there is something wrong in the parameters.
Note
  1. Only SRT subtitles are supported currently.
  2. For SRT subtitles, MIMEType must be set as value "application/x-subrip".

◆ addSubtitleWithUrl:MIMEType:Language:()

- (BOOL) addSubtitleWithUrl: (const NSString *)  xUrl
MIMEType: (NSString *)  xMIMEType
Language: (NSString *)  xLanguage 

Add an external subtitle content through URL.

Parameters
[in]xUrlThe URL of the subtitle.
[in]xMIMETypeThe MIMEType of the subtitle.
[in]xLanguageThe language code of the subtitle.
Returns
YES when the subtitle is added correctly. NO when there is something wrong in the parameters.
Note
  1. Only SRT subtitles are supported currently.
  2. For SRT subtitles, MIMEType must be set as value "application/x-subrip".

◆ deselectTrack:()

- (void) deselectTrack: (unsigned int)  xIndex

Select the specific subtitle track to deselect and remove from display.

Parameters
[in]xIndexThe index of the track to be deselected. The valid range of the index is 0 ... total number of tracks - 1. The total number of the tracks as well as the type of each individual track can be found by calling getTrackInfo method.

◆ getTrackInfo()

- (NSArray*) getTrackInfo

Returns an array of the NMPTrackInfo of the current playing stream.

Returns
A collection of NMPTrackInfo objects or nil if there there is no NMPTrackInfo for the stream.
Note
This API should be invoked after INMPTrackChangedListener is invoked.

◆ initWithPlayerItem:()

- (instancetype) initWithPlayerItem: (AVPlayerItem *)  NS_DESIGNATED_INITIALIZER

Returns an instance of NMPAVPlayer that plays a single AES-128 encrypted audiovisual resource referenced by the AVPlayerItem.

Parameters
[in]itemInstance of AVPlayerItem
Returns
An instance of NMPAVPlayer
Note
To play AES-128 encrypted HLS stream AVPlayerItem must be instantiated as NMPAVPlayerItem type.

◆ initWithURL:()

- (instancetype) initWithURL: (NSURL *)  URL

Returns an instance of NMPAVPlayer that plays a single AES-128 encrypted audiovisual resource referenced by URL.

Parameters
[in]URLInstance of NSURL that references a media resource
Returns
An instance of NMPAVPlayer

◆ playerWithPlayerItem:()

+ (id) playerWithPlayerItem: (AVPlayerItem *)  item

Returns an instance of NMPAVPlayer that plays a single AES-128 encrypted audiovisual resource referenced by the the AVPlayerItem.

Parameters
[in]itemInstance of AVPlayerItem
Returns
An instance of NMPAVPlayer
Note
To play AES-128 encrypted HLS stream AVPlayerItem must be instanined as NMPAVPlayerItem type.

◆ playerWithURL:()

+ (id) playerWithURL: (NSURL *)  URL

Returns an instance of NMPAVPlayer that plays a single AES-128 encrypted audiovisual resource referenced by URL.

Parameters
[in]URLInstance of NSURL that references a media resource
Returns
An instance of NMPAVPlayer

◆ registerTagListener:forTags:()

- (void) registerTagListener: (id< INMPTagListener >)  xListener
forTags: (NSArray< NSString * > *)  xTags 

Register the INMPTagListener to get the specified tags parsed from media playlists.

The strings in the tags array do not need to be prefixed with a # to match, but can be.

Note that this function will be called immediately with tags from the last media playlist downloaded by the SDK (if any) for the current content.

Parameters
[in]xListenerINMPTagListener implementation instance to register.
[in]xTagsArray of HLS tags to call the listener with.

◆ registerTrackChangedListener:()

- (void) registerTrackChangedListener: (id< INMPTrackChangedListener >)  xListener

Register the INMPTrackChangedListener to get track changed notification.

Parameters
[in]xListenerINMPTrackChangedListener implementation instance to register.

◆ replaceCurrentItemWithPlayerItem:()

- (void) replaceCurrentItemWithPlayerItem: (AVPlayerItem *)  item

Replaces the player's current item with the specified player item.

Parameters
[in]itemThe AVPlayerItem that will become the player's current item.
Note
To play AES-128 encrypted HLS stream AVPlayerItem must be instantiated as NMPAVPlayerItem type.

◆ selectTrack:()

- (void) selectTrack: (unsigned int)  xIndex

Select the specific subtitle track to decode and display.

Parameters
[in]xIndexThe index of the track to be selected. The valid range of the index is 0 ... total number of tracks - 1. The total number of the tracks as well as the type of each individual track can be found by calling getTrackInfo method.

◆ unregisterAllTagListeners()

- (void) unregisterAllTagListeners

Unregister all INMPTagListeners.

◆ unregisterTagListener:()

- (void) unregisterTagListener: (id< INMPTagListener >)  xListener

Unregister the INMPTagListener.

This will unregister the listener for all tags it's been added for.

Parameters
[in]xListenerINMPTagListener implementation instance to unregister.

◆ unregisterTrackChangedListener:()

- (void) unregisterTrackChangedListener: (id< INMPTrackChangedListener >)  xListener

Unregister the INMPTrackChangedListener.

Parameters
[in]xListenerINMPTrackChangedListener implementation instance to unregister.

Property Documentation

◆ maxBandwidth

- (int) maxBandwidth
readwritenonatomicassign

Property to set and get max bandwidth in unit of bit per second.

For http adaptive streaming any stream with bit rate higher than this value will be ignored.

Note
This property should be set before stream playback.

Definition at line 104 of file NMPAVPlayer.h.

◆ maxResolution

- (CGSize) maxResolution
readwritenonatomicassign

Property to set and get max resolution in pixels; For http adaptive streaming any stream with greater resolution than this value will be ignored.

Note
This property should be set before stream playback.

Definition at line 114 of file NMPAVPlayer.h.

◆ videoView

- (UIView*) videoView
readwritenonatomicassign

Property to set video renderView, and it also used as subtitle parent view.

Note
This property should be set for subtitle render

Definition at line 94 of file NMPAVPlayer.h.