OTVAVPlayer
@interface OTVAVPlayer : AVPlayer
/// Network analytics for the player
@property (nonatomic, readonly, strong) OTVNetworkAnalytics * _Nullable networkAnalytics;
/// Playback analytics for the player
@property (nonatomic, readonly, strong) OTVPlaybackAnalytics * _Nullable playbackAnalytics;
/// A view for rendering non-native subtitles to. This view should be at least as large as the relevant AVPlayerLayer.videoRect, but no wider.
@property (nonatomic, strong) UIView * _Nullable subtitleView;
/// :nodoc:
/// Private init with AVPlayerItem which should not be called outside. Creates an instance of <code>OTVAVPlayer</code> using an <code>AVPlayerItem</code>.
/// Make sure the item is initialized with OTVAVPlayerItem, otherwise a fatal error will be raised.
/// \param item <code>AVPlayerItem</code> item to be played.
///
- (nonnull instancetype)initWithPlayerItem:(AVPlayerItem * _Nullable)item OBJC_DESIGNATED_INITIALIZER;
/// Creates an instance of <code>OTVAVPlayer</code> using a URL.
/// note:
/// Calling this function before loading the <code>OTVSDK</code> (with <code>OTVSDK.load()</code> or <code>OTVSDK.load(licence)</code>) will result in a playback error.
/// \param URL URL of the content to be played.
///
- (nonnull instancetype)initWithURL:(NSURL * _Nonnull)URL;
/// Replaces the current item being played with another <code>AVPlayerItem</code>.
/// note:
/// the item should be an <code>OTVAVPlayerItem</code>, otherwise it will be ignored.
/// \param item <code>AVPlayerItem</code> to be played.
///
- (void)replaceCurrentItemWithPlayerItem:(AVPlayerItem * _Nullable)item;
/// :nodoc:
- (void)play;
/// :nodoc:
- (void)playImmediatelyAtRate:(float)rate;
/// Returns an array of tracks available for the specified type.
/// \param type The type of tracks to return
///
- (NSArray<OTVTrackInfo *> * _Nonnull)tracksWithType:(enum OTVTrackType)type SWIFT_WARN_UNUSED_RESULT;
/// Returns the selected track index for the specified type, or -1 if nothing is selected.
/// \param type The type of track to return
///
- (NSInteger)selectedTrackWithType:(enum OTVTrackType)type SWIFT_WARN_UNUSED_RESULT;
/// Selects the specified track
/// \param type The type of the track to select
///
/// \param index The index of the track to select
///
- (void)selectTrackWithType:(enum OTVTrackType)type index:(NSInteger)index;
/// Deselects the specified track.
/// \param type The type of the track to deselect
///
/// \param index The index of the track to deselect
///
- (void)deselectTrackWithType:(enum OTVTrackType)type index:(NSInteger)index;
/// Registers a listener for when the tracks available change.
/// The listener may be called at any point during playback.
/// \param tracksChangedListener The listener
///
- (void)registerWithTracksChangedListener:(id <OTVTracksChangedListener> _Nonnull)tracksChangedListener;
/// Unregisters a listener for when the tracks available change
/// \param tracksChangedListener The listener
///
- (void)unregisterWithTracksChangedListener:(id <OTVTracksChangedListener> _Nonnull)tracksChangedListener;
/// Add an external SRT subttile from a given URL
/// \param subtitleURL The URL of the subtitle
///
/// \param mimeType The mimeType of the subtitle
///
/// \param language The Language of the subtitle
///
- (void)addSubtitleWithUrl:(NSString * _Nonnull)subtitleURL mimeType:(NSString * _Nonnull)mimeType language:(NSString * _Nonnull)language;
@end
-
Network analytics for the player
Declaration
Objective-C
@property (nonatomic, strong, readonly) OTVNetworkAnalytics *_Nullable networkAnalytics;
-
Playback analytics for the player
Declaration
Objective-C
@property (nonatomic, strong, readonly) OTVPlaybackAnalytics *_Nullable playbackAnalytics;
-
A view for rendering non-native subtitles to. This view should be at least as large as the relevant AVPlayerLayer.videoRect, but no wider.
Declaration
Objective-C
@property (nonatomic, strong) UIView *_Nullable subtitleView;
-
Creates an instance of
OTVAVPlayer
using a URL. note: Calling this function before loading theOTVSDK
(withOTVSDK.load()
orOTVSDK.load(licence)
) will result in a playback error. \param URL URL of the content to be played.Declaration
Objective-C
- (nonnull instancetype)initWithURL:(NSURL *_Nonnull)URL;
-
Replaces the current item being played with another
AVPlayerItem
. note: the item should be anOTVAVPlayerItem
, otherwise it will be ignored. \param itemAVPlayerItem
to be played.Declaration
Objective-C
- (void)replaceCurrentItemWithPlayerItem:(AVPlayerItem *_Nullable)item;
-
Returns an array of tracks available for the specified type. \param type The type of tracks to return
Declaration
Objective-C
- (NSArray<OTVTrackInfo *> *_Nonnull)tracksWithType:(enum OTVTrackType)type;
-
Returns the selected track index for the specified type, or -1 if nothing is selected. \param type The type of track to return
Declaration
Objective-C
- (NSInteger)selectedTrackWithType:(enum OTVTrackType)type;
-
Selects the specified track \param type The type of the track to select
\param index The index of the track to select
Declaration
Objective-C
- (void)selectTrackWithType:(enum OTVTrackType)type index:(NSInteger)index;
-
Deselects the specified track. \param type The type of the track to deselect
\param index The index of the track to deselect
Declaration
Objective-C
- (void)deselectTrackWithType:(enum OTVTrackType)type index:(NSInteger)index;
-
Registers a listener for when the tracks available change. The listener may be called at any point during playback. \param tracksChangedListener The listener
Declaration
Objective-C
- (void)registerWithTracksChangedListener: (id<OTVTracksChangedListener> _Nonnull)tracksChangedListener;
-
Unregisters a listener for when the tracks available change \param tracksChangedListener The listener
Declaration
Objective-C
- (void)unregisterWithTracksChangedListener: (id<OTVTracksChangedListener> _Nonnull)tracksChangedListener;
-
Add an external SRT subttile from a given URL \param subtitleURL The URL of the subtitle
\param mimeType The mimeType of the subtitle
\param language The Language of the subtitle
Declaration
Objective-C
- (void)addSubtitleWithUrl:(NSString *_Nonnull)subtitleURL mimeType:(NSString *_Nonnull)mimeType language:(NSString *_Nonnull)language;