ComposablePlayer

Properties

Link copied to clipboard
abstract var audioVolume: Float

The value of the audio volume. The range varies from MIN_AUDIO_VOLUME to MAX_AUDIO_VOLUME where MIN_AUDIO_VOLUME being the silence (volume muted).

Link copied to clipboard

Sets or gets the mute state of the player's audio.

Link copied to clipboard

Indicates the Player's current buffering state. Possible values:

Link copied to clipboard
abstract val contentURL: String

Media content URL

Link copied to clipboard
abstract val currentEpochTimeMs: Long

The playback position in the current content window in epoch time or the prospective position in epoch time (in milliseconds).

Link copied to clipboard

The duration of the live offset (in milliseconds).

Link copied to clipboard

The playback position in the current content window or the prospective position (in milliseconds).

Link copied to clipboard

The duration of the current content window (in milliseconds) or com.google.android.exoplayer2.C#TIME_UNSET if the duration is not known.

Link copied to clipboard
abstract var drmDelegate: DRMDelegate?

The DRMDelegate instance.

Link copied to clipboard
Link copied to clipboard

The factor by which playback should be sped up. Must be greater than zero. 1.0 indicates normal speed

Link copied to clipboard

Indicates the Player's current playback state. Possible values:

Link copied to clipboard

The PlayerAdapter instance.

Link copied to clipboard
abstract val playerView: FrameLayout?

The Player's rendering surface

Link copied to clipboard

Represents the order of preference for various audio MIME types. Ex: aac, ec3, ac3, etc. If no preference is provided, the player will automatically pick the best track. Use MimeTypes for all possible values.

Link copied to clipboard

Represents the order of preference for various video MIME types. Ex: avc, hevc, etc. If no preference is provided, the player will automatically pick the best track. Use MimeTypes for all possible values.

Link copied to clipboard
abstract var resizeMode: ResizeMode

The ResizeMode of the player

Link copied to clipboard

Indicates the Player's current seeking state. Possible values:

Link copied to clipboard

Get the stream information

Link copied to clipboard

This optional attribute can be set if positioning of the subtitle is required. The value of this attribute will be set as percentage of bottom margin (extra space) on the bottom side of the subtitle view allowing the client to position the subtitle as required.

Link copied to clipboard
abstract val subtitleView: FrameLayout?

A subtitleView for displaying the subtitles. Add the subtitleView onto the parent view after Player is loaded. NOTE: This is applicable only when application creates its own surface.

Functions

Link copied to clipboard
open fun abort(error: Error)

Aborts Playback with Error which will be propagated via Player.Listener.onError

Link copied to clipboard

Obtain the Active Track variant option for the passed TrackVariantInfo.Type, if available.

Link copied to clipboard

Register a listener to receive events from the core player. The listener's methods will be called on the UI thread.

Link copied to clipboard
abstract fun addHeartBeatStep(step: suspend (player: Player) -> Unit)

Called on Playback progress

Link copied to clipboard
abstract fun addListener(listener: Player.Listener)

Register a listener to receive events from the player. The listener's methods will be called on the UI thread.

Link copied to clipboard
open fun addMediaPlaylistItem(mediaPlaylistItem: MediaPlaylistItem)

Adds a MediaPlaylistItem to the end of the playlist.

Link copied to clipboard
open fun addMediaPlaylistItemAt(index: Int, mediaPlaylistItem: MediaPlaylistItem)

Adds a MediaPlaylistItem at the given index of the playlist.

Link copied to clipboard
open fun addMediaPlaylistItems(mediaPlaylistItems: List<MediaPlaylistItem>)

Adds a collection of MediaPlaylistItems to the end of the playlist.

Link copied to clipboard
open fun addMediaPlaylistItemsAt(index: Int, mediaPlaylistItems: List<MediaPlaylistItem>)

Adds a collection of MediaPlaylistItems at the given index of the playlist.

Link copied to clipboard
abstract fun addPreLoadStep(step: suspend (player: Player) -> Unit)

Called before Player.load is called.

Link copied to clipboard
abstract fun addStateChangeStep(step: suspend (player: Player) -> Unit)

Called on every state-change.

Link copied to clipboard

Returns the collection of MIME types of the Player's track variants available in TrackVariantInfo

Link copied to clipboard

Obtain the Available Track variants for passed TrackVariantInfo.Type.

Link copied to clipboard

Clears the playlist.

Link copied to clipboard

Returns the Entire list of MediaPlaylistItem.

Link copied to clipboard

Returns the Entire list of MediaPlaylistItem.

Link copied to clipboard
abstract fun getComposedPlayer(): Player
Link copied to clipboard

Returns the currently playing MediaPlaylistItem. May be null if the timeline is empty.

Link copied to clipboard

Returns the currently playing MediaPlaylistItem. May be null if the timeline is empty.

Link copied to clipboard

Returns the index of the current MediaPlaylistItem in the timeline, or the prospective index if the current timeline is empty.

Link copied to clipboard

Returns the index of the current MediaPlaylistItem in the timeline, or the prospective index if the current timeline is empty.

Link copied to clipboard
open fun getMaxSupportedSecuredDecoderInstances(mimeType: String = MimeTypes.VIDEO_H264, tunnelingMode: Boolean = false): Int

Provides the maximum number of player's secured hardware decoders that can be instantiated for multi-stream playback. The secured decoder is used for playing DRM content. NOTE: This is a utility function that can be called before the playback starts (before calling play).

Link copied to clipboard

Returns the MediaPlaylistItem at the given index.

Link copied to clipboard

Returns the MediaPlaylistItem at the given index.

Link copied to clipboard

Returns the number of MediaPlaylistItems in the playlist.

Link copied to clipboard

Returns the number of MediaPlaylistItems in the playlist.

Link copied to clipboard

returns the Parcelable Media session token. Represents an ongoing session. This may be passed to apps by the session owner to allow them to create a MediaControllerCompat to communicate with the session.

Link copied to clipboard

Returns the index of the MediaPlaylistItem that will be played if seekToNextMediaPlaylistItem is called, which may depend on the current repeat mode and whether shuffle mode is enabled. Returns INDEX_UNSET if hasNextMediaPlaylistItem returns Boolean.false.

Link copied to clipboard

Returns the index of the MediaPlaylistItem that will be played if seekToNextMediaPlaylistItem is called, which may depend on the current repeat mode and whether shuffle mode is enabled.

Link copied to clipboard

Returns the index of the MediaPlaylistItem that will be played if seekToPreviousMediaPlaylistItem is called, which may depend on the current repeat mode and whether shuffle mode is enabled. Returns INDEX_UNSET if hasPreviousMediaPlaylistItem returns Boolean.false.

Link copied to clipboard

Returns the index of the MediaPlaylistItem that will be played if seekToPreviousMediaPlaylistItem is called, which may depend on the current repeat mode and whether shuffle mode is enabled.

Link copied to clipboard
abstract fun getRawPlayer(): Any?

returns the underlying native player instance e.g. ExoPlayer

Link copied to clipboard
open suspend fun getThumbnail(positionMs: Long, thumbnailHandler: (result: Bitmap?) -> Unit)

Provides video stream preview image that can be shown to the user when seeking (VOD content only).

Link copied to clipboard
open fun getThumbnailUrl(positionMs: Long): String?

Provides, if available, the URL to video stream preview image file. The client uses this URL to load the video stream preview image that can be shown to the user when seeking (VOD content only).

Link copied to clipboard

Returns whether a next MediaPlaylistItem exists, which may depend on the current repeat mode and whether shuffle mode is enabled.

Link copied to clipboard

Returns whether a next MediaPlaylistItem exists, which may depend on the current repeat mode and whether shuffle mode is enabled.

Link copied to clipboard

Returns whether a previous MediaPlaylistItem exists, which may depend on the current repeat mode and whether shuffle mode is enabled.

Link copied to clipboard

Returns whether a previous MediaPlaylistItem exists, which may depend on the current repeat mode and whether shuffle mode is enabled.

Link copied to clipboard
open fun isLive(): Boolean
Link copied to clipboard
open fun isPlayingAd(): Boolean
Link copied to clipboard
open fun load()

Loads the resources needed to play a particular content

Link copied to clipboard
open fun moveMediaPlaylistItem(currentIndex: Int, newIndex: Int)

Moves the MediaPlaylistItem at the current index to the new index.

Link copied to clipboard
open fun pause()

Pauses a Playing content.

Link copied to clipboard
open fun play()

Plays a paused/loaded content.

Link copied to clipboard

Unregister a listener. The listener will no longer receive events from the player.

Link copied to clipboard
open fun removeListener(listener: Player.Listener)

Unregister a listener. The listener will no longer receive events from the player.

Link copied to clipboard
open fun removeMediaPlaylistItem(index: Int)

Removes the MediaPlaylistItem at the given index of the playlist.

Link copied to clipboard
open fun removeMediaPlaylistItems(fromIndex: Int, toIndex: Int)

Removes a range of MediaPlaylistItems from the playlist.

Link copied to clipboard
open fun replaceMediaPlaylistItem(index: Int, mediaPlaylistItem: MediaPlaylistItem)

Replaces the MediaPlaylistItem at the given index of the playlist.

Link copied to clipboard
open fun seek(seekPoint: Long, seekPreference: SeekPreference? = null)

Seeks a content to a particular time position.

Link copied to clipboard
open fun seekBack()

Seeks back in the current content by PlaybackProperties.preferredSeekBackIncrementMs

Link copied to clipboard
open fun seekForward()

Seeks forward in the current content by PlaybackProperties.preferredSeekForwardIncrementMs

Link copied to clipboard
open fun seekTo(mediaItemIndex: Int, positionMs: Long)

Seeks to a position specified in milliseconds in the specified MediaPlaylistItem.

Link copied to clipboard
open fun seekToLiveEdge()

Seeks to the default position associated with the current window. For live streams it will typically be the live edge of the window. For other streams it will typically be the start of the window. Call this api only for DVR enabled LIVE streams.

Link copied to clipboard

Seeks to the default position of the next MediaPlaylistItem, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing if hasNextMediaPlaylistItem returns Boolean.false.

Link copied to clipboard

Seeks to the default position of the previous MediaPlaylistItem, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing if hasPreviousMediaPlaylistItem returns Boolean.false.

Link copied to clipboard
abstract fun send(streamTimelineEvent: StreamTimelineEvent, suggestedAction: Action, streamTimelineMetadata: StreamTimelineMetadata? = null)

Sends the event, action, and metadata related to stream timeline changes.

Link copied to clipboard
open fun setMediaPlaylistItem(mediaPlaylistItem: MediaPlaylistItem)

Clears the playlist, adds the specified MediaItem and resets the position to the default position.

Link copied to clipboard
open fun setPreferredBitrateThresholds(maxBitrate: Int, minBitrate: Int)

Configures the Player's Variant Adaptation Logic with the passed maximum and minimum bitrate constraints.

Link copied to clipboard
open fun setPreferredMimeTypes(type: TrackVariantInfo.Type, preferredMimeTypes: Array<String>)

Activates an Elementary track matching the passed TrackVariantInfo option Sets the order of preference for various MIME types. Ex: aac, ec3, ac3, etc. Use MimeTypes for all possible values.

Link copied to clipboard

Configures the Player's Variant Adaptation Logic with the passed maximum bitrate constraint.

Link copied to clipboard

Activates an Elementary track matching the passed TrackVariantInfo option

Link copied to clipboard
open fun setRepeatMode(enableRepeatMode: Boolean, repeatTimeline: Boolean = true)

Enables or disables the repeat mode for the playlist at any time.

Link copied to clipboard
open fun setShuffleMode(enableShuffleMode: Boolean, shuffledIndices: IntArray?, randomSeed: Long? = DEFAULT_RANDOM_SEED)

Enables or disables (default state) the shuffle mode for the playlist at any time. If the shuffle mode is enabled one can specify the shuffle order with the specified random seed. When in shuffle mode, the player will play the playlist in a precomputed, randomized order. All items will be played once and the shuffle mode can also be combined with playlist repeat mode to repeat the same randomized order in an endless loop. When shuffle mode is turned off, playback continues from the current item at its original position in the playlist. NOTE that the indices as returned by methods like getCurrentMediaPlaylistItemIndex always refer to the original, un-shuffled order. Similarly, seekToNextMediaPlaylistItem will not play the item at getCurrentMediaPlaylistItemIndex + 1, but the next item according to the shuffle order. Inserting new items in the playlist or removing items will keep the existing shuffled order unchanged as far as possible.

Link copied to clipboard
open fun stop()

Stops a Playing Content and releases any held resources if necessary. After successful stop, player moves to PlaybackState.IDLE

Link copied to clipboard
open fun updateMediaMetadata(mediaMetadata: MediaMetadata)

Declares all the methods that can be used to listen to changes and events in varied aspects of the playback.