public interface Player
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Player.Settings
Interface used for setting optional Player settings.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(PKEvent.Listener listener,
java.lang.Enum... events)
Add event listener to the player.
|
void |
addStateChangeListener(PKEvent.Listener listener)
Add state changed listener to the player.
|
void |
changeTrack(java.lang.String uniqueId)
Change current track, with specified one by uniqueId.
|
void |
destroy()
Should be called when you want to destroy the player.
|
long |
getBufferedPosition() |
<T extends PKController> |
getController(java.lang.Class<T> type)
Generic getters for playkit controllers.
|
long |
getCurrentPosition()
Getter for the current playback position.
|
long |
getDuration() |
PKMediaFormat |
getMediaFormat() |
float |
getPlaybackRate()
get current player speed
|
java.lang.String |
getSessionId()
Get the Player's SessionId.
|
Player.Settings |
getSettings()
Get the Player's
Player.Settings object, for setting some optional properties. |
PlayerView |
getView()
The Player's View.
|
boolean |
isLive() |
boolean |
isPlaying() |
void |
onApplicationPaused()
Player lifecycle method.
|
void |
onApplicationResumed()
Player lifecycle method.
|
void |
onOrientationChanged()
Player lifecycle method.
|
void |
pause()
Pause playback of the media.
|
void |
play()
Start playback of the media.
|
void |
prepare(PKMediaConfig playerConfig)
Prepare the player for playback.
|
void |
replay()
Replay the media.
|
void |
seekTo(long position)
Seek player to the specified position.
|
void |
setPlaybackRate(float rate)
Change player speed (pitch = 1.0f by default)
|
void |
setVolume(float volume)
Change the volume of the current audio track.
|
void |
stop()
stop player and back to initial playback state.
|
void |
updatePluginConfig(java.lang.String pluginName,
java.lang.Object pluginConfig) |
Player.Settings getSettings()
Player.Settings object, for setting some optional properties.void prepare(@NonNull
PKMediaConfig playerConfig)
playerConfig - - media configurations to apply on the player.void updatePluginConfig(@NonNull
java.lang.String pluginName,
@Nullable
java.lang.Object pluginConfig)
void onApplicationPaused()
void onApplicationResumed()
void onOrientationChanged()
void destroy()
void stop()
void play()
void pause()
void replay()
PlayerView getView()
long getCurrentPosition()
Consts.POSITION_UNSET if position is unknown or player engine is null.long getDuration()
Consts.TIME_UNSET if the duration is unknown or player engine is null.long getBufferedPosition()
Consts.POSITION_UNSET if the position is unknown or player engine is null.void setVolume(float volume)
volume - - volume to set.boolean isPlaying()
void addEventListener(@NonNull
PKEvent.Listener listener,
java.lang.Enum... events)
listener - - event listener.events - - events the subscriber interested in.void addStateChangeListener(@NonNull
PKEvent.Listener listener)
listener - - state changed listenervoid changeTrack(java.lang.String uniqueId)
IllegalArgumentException.
Example of the valid uniqueId for regular video track: Video:0,0,1.
Example of the valid uniqueId for adaptive video track: Video:0,0,adaptive.uniqueId - - the unique id of the new track that will play instead of the old one.void seekTo(long position)
position - - desired position.java.lang.String getSessionId()
boolean isLive()
PKMediaFormat getMediaFormat()
null if the media format is not set yetvoid setPlaybackRate(float rate)
rate - - desired rate (ex. 0.5f 1.0f 1.5f, 2.0f).float getPlaybackRate()
<T extends PKController> T getController(java.lang.Class<T> type)
type - - type of the controller you want to obtain.PKController instance if specified controller type exist,
otherwise return null.