OTVAVPlayer


@interface OTVAVPlayer : AVPlayer

OTVAVPlayer is derived from AVPlayer, please refer to apple’s documentation for further information.

  • 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;
  • Private init with AVPlayerItem which should not be called outside. Creates an instance of OTVAVPlayer using an AVPlayerItem. Make sure the item is initialized with OTVAVPlayerItem, otherwise a fatal error will be raised. \param item AVPlayerItem item to be played.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPlayerItem:(AVPlayerItem *_Nullable)item;
  • Creates an instance of OTVAVPlayer using a URL. note: Calling this function before loading the OTVSDK (with OTVSDK.load() or OTVSDK.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 an OTVAVPlayerItem, otherwise it will be ignored. \param item AVPlayerItem 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;