[Paid] Media3 the upgraded Version of Exoplayer, Play media with Androidx Media3

Title
[Paid] Media3 the upgraded Version of Exoplayer, Play media with Androidx Media3

Media Player Extension based on Androidx Media3 Library for AppInventor, Kodular and Niotron, Media3 is upgraded version of Exoplayer

Hello dear! it’s Media Player Extension based on Androidx Media3 Library in this extension i used Androidx Media3 library version 1.3.1 it’s latest version of Media3. Why i not used Exoplayer library to create this extension because Exoplayer is deprecated and google will not continue exoplayer because Google launched Media3, Media3 contains all exciting Exoplayer features and even more basically Media3 is upgraded version of Exoplayer.
Our extension support all Media protocols like MP4, HLS, DASH, RTSP and SmoothStreaming. This Extension will be best choice for Developers who demand the best performance and flexibility in media.

Feature’s

:heavy_check_mark: Support all DRM protected media’s.

:heavy_check_mark: Most highlighted feature is developer can create custom controls, Any type he/she want…

:heavy_check_mark: Default Controls.

:heavy_check_mark: Custom Controls

:heavy_check_mark: Quality selection, user can change quality.

Supported formats

:heavy_check_mark: Streaming: HLS, DASH, RTSP and SmoothStreaming
:heavy_check_mark: Containers: MP4, MOV, FLV, MKV, WebM, Ogg, MPEG
:heavy_check_mark: Video: H.263, H.264 AVC, H.265 HEVC, MPEG-4 SP, VP8, VP9, AV1
:heavy_check_mark: Audio: Vorbis, Opus, FLAC, ALAC, MP1, MP2, MP3, AAC, AC-3, E-AC-3, DTS, DTS-HD, TrueHD

DRM

:heavy_check_mark: Widevine
:heavy_check_mark: Clearkey
:heavy_check_mark: Playready

Events

OnAudioSessionIdChanged

OnAudioSessionIdChanged

Event raised when audio session change.

audioSessionId = Number

OnControlsVisibilityChanged

OnAudioSessionIdChanged

Event raised when controls visible or hide.

visible = Boolean

OnCues

OnCues

Event raised when Text output changes.

cues = List

OnFullscreenButtonClick

OnFullscreenButtonClick

Event raised when fullscreen button clicked.

isFullscreen = Boolean

OnIsLoadingChanged

OnIsLoadingChanged

Event raised when the player starts or stops loading.

isLoading = Boolean

OnIsPlayingChanged

Event raised when the player’s play/pause state changes.

isPlaying = Boolean

OnMaxSeekToPreviousPositionChanged

Event raised when maximum seek to previous position change.

maxSeekToPreviousPositionMs = Number

OnMetadataChanged

OnMetadataChanged

Event raised when media metadata changes.

data = Dictionary

Keys

title,      
artist,     
albumTitle,    
albumArtist,     
displayTitle,   
subtitle,     
description,      
mediaType,     
artwork_uri,      
track_number,      
total_tracks,   
releaseYear,      
playable

OnPlayWhenReadyChanged

OnPlayWhenReadyChanged

Event raised when play when ready change.

playWhenReady = Boolean
reason = Number

OnPlaybackStateChanged

OnPlaybackStateChanged

Event raised when playback state has been changed.

state = Number

OnPlayerError

OnPlayerError

Event raised when player got error.

error = Text

OnPositionDiscontinuity

Event raised when position discontinuity.

oldContentPositionMs = Number
oldPositionMs = Number
newContentPositionMs = Number
newPositionMs = Number

OnProgressUpdate

Event raised when progress update.

positionMs = Number
bufferedPositionMs = Number
durationMs = Number

OnRenderedFirstFrame

OnRenderedFirstFrame

Event raised when video first frame rendered.

OnRepeatModeChanged

OnRepeatModeChanged

Event raised when repeat mode change.

repeatMode = Text

OnSeekBackIncrementChanged

Event raised when seek back imcrement change.

seekBackIncrementMs = Number

OnSeekForwardIncrementChanged

Event raised when seek forward imcrement change.

seekForwardIncrementMs = Number

OnShuffleModeEnabledChanged

Event raised when shuffle mode enabled change.

shuffleModeEnabled = Boolean

OnTracksChanged

OnTracksChanged

Event raised when tracks changes.

videoTracks = List of Dictionary
audioTracks = List of Dictionary
textTracks = List of Dictionary

Keys

id,      
bitrate,     
accessibilityChannel,    
averageBitrate,     
channelCount,   
codecs,     
containerMimeType,      
cryptoType,     
frameRate,      
roleFlags,      
maxInputSize,   
width,      
height,     
language,       
label

OnVolumeChanged

OnVolumeChanged

Event raised when device volume change.

volume = Number
muted = Boolean

Functions

CustomControls

Add Custom controls layout in player view.

CustomControls

Required
controlsLayout = Arrangement

PlayerView

Create a player view for player.

PlayerView

Required
playerLayout = Arrangement
defaultControls = Boolean Set False if you set CustomControls

MovePlayerView

Move player view in another layout…

MovePlayerView

Required
newLayout = Arrangement

SetBufferingProgress

Set Buffering Progress Layout.

SetBufferingProgress

Required
progressLayout = Arrangement
Set Circle Progress in VerticalArragement then pass VerticalArragement.

BufferingProgress

CreateTimeBar

CreateTimeBar

Required
layout = Arrangement

TimeBar

HideControls

Hide the play view controls

HideControls

ShowControls

Show the play view controls

ShowControls

SetVolume

Volume must be between device minimum volume to device maximum volume.

SetVolume

Required number

SetBrightness

Brightness must be 0.1 to 1

SetBrightness

Required number

Subbtitles sample

MediaItems

DefaultMediaItem

Create MediaItem for player.

DefaultMediaItem

Required*
url = Text
subtitles = List

Return MediaItem

MediaItem

Create MediaItem for player with custom perameters.

MediaItem

Required
url = Text
subtitles = List
mimeType = Text
mediaId = Text
startPositionMs = Number
endPositionMs = Number
sartsAtKeyFrame = Boolean
relativeToLiveWindow = Boolean
relativeToDefaultPosition = Boolean

Default Values

Return MediaItem

AddMediaItem

Add MediaItem in MediaItemList.

AddMediaItem

Required
index = Number
Set index 0 if want to add MediaItem at last in MediaItemList

mediaItem = MediaItem

SetMediaItemList

SetMediaItemList

Required List of MediaItems

GetMediaItemList

Get MediaItem List you seted using SetMediaItemList/AddMediaItem.

GetMediaItemList

RemoveMediaItems

Remove MediaItems from MediaItemList.

RemoveMediaItems

Required
fromIndex = Number
toIndex = Number

ClearMediaItemList

Clear MediaItem List as you seted using SetMediaItemList/AddMediaItem.

ClearMediaItemList

MimeTypes

Use DefaultMimeType if you didn’t know MimeType.

DefaultMimeType

MediaSoures

HlsMediaSource

Create HlsMediaSource for HLS playback.

HlsMediaSource

Required
httpDataSource = HttpDataSource
mediaItem = MediaItem
allowChunklessPreparation = Boolean
useSessionKeys = Boolean
metadataType = Number
timestampAdjusterInitializationTimeoutMs = Number

MetadataTypes

Metadatas

Default Values

Return MediaSource

RtspMediaSource

RtspMediaSource

Required
mediaItem = MediaItem
userAgent = Text
timeoutMs = Number
debugLoggingEnabled = Boolean
forceUseRtpTcp = Boolean

Default Values

Return MediaSource

SsMediaSource

Create SsMediaSource for smooth streaming.

SsMediaSource

Required
httpDataSource = HttpDataSource
mediaItem = MediaItem
livePresentationDelayMs = Number

Default Value

LivePresentationDelayMs

Return MediaSource

DashMediaSource

Create DashMediaSource for Dynamic Adaptive Streaming over HTTP (DASH) content.

DashMediaSource

Required
drmMedia = DrmMedia
httpDataSource = HttpDataSource
mediaItem = MediaItem
fallbackTargetLiveOffsetMs = Number
minLiveStartPositionUs = Number

Default Values

Return MediaSource

AddMediaSource

Add AddMediaSource in MediaSourceList.

AddMediaSource

Required
index = Number
Set index 0 if want to add MediaSource at last in MediaSourceList

mediaSource = MediaSource

SetMediaSourceList

SetMediaSourceList

Required List of MediaSources

GetMediaSourceList

Get MediaSource List you seted using SetMediaSourceList/AddMediaSource.

GetMediaSourceList

RemoveMediaSources

Remove MediaSources from MediaSourceList.

RemoveMediaSources

Required
fromIndex = Number
toIndex = Number

ClearMediaSourceList

Clear MediaSource List as you seted using SetMediaSourceList/AddMediaSource.

ClearMediaSourceList

DrmMedia’s

DrmMedia

Create Drm Media for drm encrypted media. this fetch license keys from license url.

DrmMedia

Required
drmScheme = Text
licenseUrl = Text
multiSession = Boolean
forceDefaultLicenseUri = Boolean
forceSessionsForAudioAndVideoTracks = Boolean
playClearContentWithoutKey = Boolean

Return DrmMedia

LocalDrmMedia

Create Drm Media with key id and key.

LocalDrmMedia

Required
drmScheme = Text
keyId = Text
key = Text
inHex = Boolean
multiSession = Boolean
forceDefaultLicenseUri = Boolean
forceSessionsForAudioAndVideoTracks = Boolean
playClearContentWithoutKey = Boolean

Return DrmMedia

Default Values

Drm Scheme’s

Schemes

NoDrmMedia

Use this if media doesn’t required license.

NoDrmMedia

HttpDataSource

HttpDataSource

Required
allowCrossProtocolRedirects = Boolean
connectTimeoutMs = Number
keepPostFor302Redirects = Boolean
readTimeoutMs = Number
requestHeaders = Dictionary
userAgent = Text

Default Values

Return HttpDataSource

Request Headers sample

SetHttpDataSource

Use this only when you use just MediaItems not any MediaSources else this not work. If you’re using MediaSources then you can set HttpDataSource directly in MediaSources…

SetHttpDataSource

Required
httpDataSource = HttpDataSource

ShowSpeedSelectionDialog

ShowSpeedSelectionDialog

Required
title = Text

ShowTrackSelectionDialog

ShowTrackSelectionDialog

Required
title = Text
trackType = Number
showDisableOption = Boolean
allowAdaptiveSelections = Boolean
allowMultipleOverrides = Boolean

GetTracks

Get Tracks of current playback content.

GetTracks

Required
trackType = Number

Return List of Dictionary

SelectTrack

Select track from current tracks.

SelectTrack

Required
trackType = Number
index = Number
Set index 0 for Auto.

TrackTypes

TrackTypes

SeekToPrevious

SeekToPrevious

SeekToNext

SeekToNext

SeekTo

Seek to a specific position, set position in milliseconds.

SeekTo

Required
positionMs = Number

Rewind

Set rewind milliseconds in properties mean how much they should rewind.

Rewind

FastForward

Set FastForward milliseconds in properties mean how much they should forward.

FastForward

Prepare

Call this before calling Play.

Prepare

Play

Call this after calling Prepare.

Play

Pause

Pause current player.

Pause

Resume

Resume current player.

Resume

Stop

Stop current player.

Stop

Release

Release current player.

Release

Destroy

Destroy current player, Note this reset all functions and properties before you called.

Destroy

Format

Format milliseconds to in time.

Format

Required
ms = Number

Properties

AutoHideControls

Set controls will auto hide after timeout.

AutoHideControls

Required Boolean

AutoShowControls

Set controls will auto show.

AutoShowControls

Required Boolean

BufferedPercentage

Return current BufferedPercentage in Number.

BufferedPercentage

BufferedPosition

Return current BufferedPosition in Number.

BufferedPosition

Buttons

Set True if want to show else False.

Buttons

ControlsTimeout

Set ControlsTimeout in milliseconds.

ControlsTimeout

Required Number

CurrentBrightness

Return current CurrentBrightness in Number.

CurrentBrightness

CurrentMediaItemIndex

Return current MediaItem/MediaSource index in Number.

CurrentMediaItemIndex

CurrentPosition

Return current playback position in Milliseconds (Number).

CurrentPosition

CurrentVolume

Return current device volume in Number.

CurrentVolume

Customize TimeBar

Required Color

TimebarColors

FastForwardMs

Set FastForward in milliseconds, How should forward after calling FastForward function.

FastForwardMs

Required Number

HasNext

This return true if next MediaItem/MediaSource available, Return type Boolean.

HasNext

HasPrevious

This return true if previous MediaItem/MediaSource available, Return type Boolean.

HasPrevious

Required Number

HideControlsOnTouch

Set controls should hide on touch.

HideControlsOnTouch

Required Boolean

IsControlsFullVisible

This return true if controls visible, Return type Boolean.

IsControlsFullVisible

IsSeekBackAvailable

This return true if seek back/rewind available, Return type Boolean.

IsSeekBackAvailable

IsSeekForwardAvailable

This return true if seek forward available, Return type Boolean.

IsSeekForwardAvailable

KeepScreenOn

Keep device screen always on.

KeepScreenOn

Required Boolean

MaxVolume

This return device maximum volume, Return type Number.

MaxVolume

MinVolume

This return device minimum volume, Return type Number.

MinVolume

PauseAtAndOfMediaItems

Pause playback after each MediaItem/MediaSource.

PauseAtAndOfMediaItems

Required Boolean

PlaybackSpeed

Set playback speed, Which speed player should play.

PlaybackSpeed

Required Number

PlayWhenReady

Set play when playback is ready.

PlayWhenReady

Required Boolean

RepeatMode

Set Repeat Mode.

RepeatMode

Required

RepeatModes

RepeatModes

RewindMs

Set Rewind in milliseconds, How should rewind after calling Rewind function.

RewindMS

Required Number

ResizeMode

Set Resize Mode.

ResizeMode

Required

ResizeModes

ResizeModes

ShowBuffering

Set when buffering show.

ShowBuffering

Required
BufferingModes

TotalBufferedDuration

This return total buffered duration in milliseconds, Return type Number.

TotalBufferedDuration

Extension specifications:

Extension size: 2.14MB
Extension Version: 1.0.0
Media3 Library Version: 1.3.1
Last amendment: 11 June 2024
Demo Application: Media3.apk
Supported builder: Kodular, Niotron, AppZard, AndroidBuilder, App Inventor and it’s other distributions.
Extension price: $10 or (Pkr 2700)

3 Likes

Nice work man!
Anyways the size of the extension is very high.…

1 Like

I think it might be possible to reduce the aix size with strong proguard rules.

I already reduced aix size before it’s size is a 4mb