STSPlayerPlaybackEventDelegate
@protocol STSPlayerPlaybackEventDelegate <NSObject>
Implements the STSPlayerPlaybackEventDelegate protocol to respond to playback events.
-
Sent when playback starts.
Declaration
Objective-C
- (void)playerViewStartPlaying:(nonnull STSSDKPlayerView *)playerView;
Swift
func playerViewStartPlaying(_ playerView: STSSDKPlayerView!)
Parameters
playerView
The player view that sent the message.
-
Sent when buffering starts or stops.
Declaration
Objective-C
- (void)playerView:(nonnull STSSDKPlayerView *)playerView onBuffering:(BOOL)buffering;
Swift
func playerView(_ playerView: STSSDKPlayerView!, onBuffering buffering: Any!)
Parameters
playerView
The player view that sent the message.
buffering
YES when the player is buffering, No if not.
-
Sent when the playback did end.
Declaration
Objective-C
- (void)playerViewDidPlayToEnd:(nonnull STSSDKPlayerView *)playerView;
Swift
func playerViewDidPlay(toEnd playerView: STSSDKPlayerView!)
Parameters
playerView
The player view that sent the message.
-
Sent when playback is paused.
Declaration
Objective-C
- (void)playerViewPaused:(nonnull STSSDKPlayerView *)playerView;
Swift
func playerViewPaused(_ playerView: STSSDKPlayerView!)
Parameters
playerView
The player view that sent the message.
-
Called when an error occurs.
Declaration
Objective-C
- (void)playerView:(nonnull STSSDKPlayerView *)playerView error:(nonnull NSError *)error;
Swift
func playerView(_ playerView: STSSDKPlayerView!, error: Any!)
Parameters
playerView
The player view that sent the message.
-
Called when the duration of the current media changed.
Declaration
Objective-C
- (void)playerView:(nonnull STSSDKPlayerView *)playerView mediaDurationChanged:(Float64)duration;
Swift
optional func playerView(_ playerView: STSSDKPlayerView!, mediaDurationChanged duration: Any!)
Parameters
playerView
The player view that sent the message.
duration
The new duration (in seconds) of the current media.
-
Called when the current time of the current media changed.
Declaration
Objective-C
- (void)playerView:(nonnull STSSDKPlayerView *)playerView mediaCurrentTimeChanged:(Float64)currentTime;
Swift
optional func playerView(_ playerView: STSSDKPlayerView!, mediaCurrentTimeChanged currentTime: Any!)
Parameters
playerView
The player view that sent the message.
currentTime
The curent time (in seconds) of the media.
-
Called when the loaded time range of the current media changed.
Declaration
Objective-C
- (void)playerView:(nonnull STSSDKPlayerView *)playerView loadedTimeRangesChanged:(nonnull NSArray<NSValue *> *)loadedTimeRanges;
Swift
optional func playerView(_ playerView: STSSDKPlayerView!, loadedTimeRangesChanged loadedTimeRanges: Any!)
Parameters
playerView
The player view that sent the message.
loadedTimeRanges
An array contains NSValue objects containing a CMTimeRange value indicating the time ranges for which the player has media data readily available. The time ranges returned may be discontinuous.
-
Called when the seekable time ranges of the current media changed.
Declaration
Objective-C
- (void)playerView:(nonnull STSSDKPlayerView *)playerView seekableTimeRangesChanged:(nonnull NSArray<NSValue *> *)seekableTimeRanges;
Swift
optional func playerView(_ playerView: STSSDKPlayerView!, seekableTimeRangesChanged seekableTimeRanges: Any!)
Parameters
playerView
The player view that sent the message.
seekableTimeRanges
An array contains NSValue objects containing a CMTimeRange value indicating the time ranges for which the player can seek. The time ranges returned may be discontinuous.
-
Called when the audio session interruption starts or ends.
This method may be called when a phone call arrives, a Clock or Calendar alarm sounds, or another app activates its audio session. The playback will be paused when the audio session interruption starts. Some of the player view methods will not work when the audio session is interrupted, see the description of each method for details.
Declaration
Objective-C
- (void)playerView:(nonnull STSSDKPlayerView *)playerView onAudioSessionInterrupt:(BOOL)isInterrupted;
Swift
optional func playerView(_ playerView: STSSDKPlayerView!, onAudioSessionInterrupt isInterrupted: Any!)
Parameters
playerView
The player view that sent the message.
isInterrupted
YES
if the audio session interruption starts,NO
if the interruption ends.