B4A Library Exoplayer 2.18.5 Streams Player

Hi, This is Based on the Wrapper of Erel .
I was in need to use the latest Exoplayer for only one purpose is to play RTMP Streams.
also this Exoplayer Replaces deprecated playerview with StyledPlayerView.

You need this Additional Following AArs to be located in your Additional Libraries Folder in order to use this library.

Version 1.40 required aar.

Additional AAR 2.18.2

Version 1.50 required aar.
Additional AAR 2.18.3

Version 1.60 required aar.
Additional AAR 2.18.4

Version 1.70 required aar.
Additional AAR 2.18.5

Functionality :
  • CreateUriSource
  • CreateSmoothStreamingSource
  • CreateHLSSource
  • CreateDashSource
  • CreateFileSource
  • CreateRtspStreamingSource
  • CreateRtmpStreamingSource
  • CreateUdpStreamingSource
  • CreateListSource
  • setReapeatMode
  • getIsPlaying
  • Prepare
  • Play
  • Pause
  • Release
  • getPosition
  • setPosition
  • getDuration
  • getVolume
  • setVolume
  • getCurrentMediaItemIndex
  • GetvideoFormatwidth
  • GetvideoFormatHeight
  • GetAudioTracksLanguages
  • GetVideoTrackSubtitles
  • preferedAudioLanguage
  • preferedtextLanguage
  • EnableSubtitles


DesignerProperties

  • SPlayerView
  • ResizeMode [FIT|FIXED_HEIGHT|FIXED_WIDTH]
  • UseController default is true
  • ShowBuffering [NEVER|PLAYING|ALWAYS] default is NEVER
  • ControllerTimeout default is 5000
I may Extends More functionality in the future .

Requires Appcompat Library

Example is included.

Events :

  • Player_Ready
  • Player_Error
  • Player_Complete
  • IDLE
  • Buffering
Update Version 1.40
  • FFMPEG Extension is Supported
  • FFmpegavailabe << to check weather ffmpeg is available or not.
  • FFMPEG Initialize Choice during initialization Prefer To use FFMPEGAUDIO Decoding only for now
  • player.Initialize("player", UseFFmpeg as boolean, FFMPEGAUDIO As boolean, FFmpegVideo As Boolean)
  • FFMPEG AUDIO AND VIDEO Decoder
Updated Version 1.50
Upgrade to latest exoplayer 2.18.3

Change Log

Updated Version 1.60
  • Upgraded to the latest ExoPlayer 2.18.4 > Change Log
  • Fixed GetvideoFormatwidth, GetvideoFormatHeight when playing media without video it will return -1 if the media doesn't have video.
  • Added Stop method to stop the player.
Updated Version 1.70
  • Upgraded to the latest ExoPlayer 2.18.5
  • Added IDLE EVENT and Buffering Event.
download additional aar to use the latest exoplayer fixes.
 

Attachments

  • addoexo-1.40.zip
    22 KB · Views: 447
  • addoexo-1.50.zip
    22 KB · Views: 333
  • addoexo-1.60.zip
    22 KB · Views: 375
  • addoexo-1.70.zip
    22.1 KB · Views: 693
Last edited:

Zero7

Member
Hello @PassionDEV,

I've tested your library to play MPEG-TS stream but seems to fail to play audio (video works ok).

As you can see, the same problem happens with ExoPlayer wrapper by Erel: https://www.b4x.com/android/forum/t...udio-in-http-mpeg-ts-stream-exoplayer.141533/

Seems that a FFMPEG extension is needed for ExoPlayer to play this kind of stream/files for some audio codecs support: https://github.com/google/ExoPlayer/tree/release-v2/extensions/ffmpeg

B4X:
The FFmpeg module provides FfmpegAudioRenderer, which uses FFmpeg for decoding and can render audio encoded in a variety of formats.

Sample formatDecoder name(s)
Vorbisvorbis
Opusopus
FLACflac
ALACalac
PCM μ-lawpcm_mulaw
PCM A-lawpcm_alaw
MP1, MP2, MP3mp3
AMR-NBamrnb
AMR-WBamrwb
AACaac
AC-3ac3
E-AC-3eac3
DTS, DTS-HDdca
TrueHDmlp truehd

Can you take a look?

If you need, I can send you some mpeg-ts samples.
 
Last edited:

Addo

Well-Known Member
Licensed User
Longtime User
Hello @PassionDEV,

I've tested your library to play MPEG-TS stream but seems to fail to play audio (video works ok).

As you can see, the same problem happens with ExoPlayer wrapper by Erel: https://www.b4x.com/android/forum/t...udio-in-http-mpeg-ts-stream-exoplayer.141533/

Seems that a FFMPEG extension is needed for ExoPlayer to play this kind of stream/files for some audio codecs support: https://github.com/google/ExoPlayer/tree/release-v2/extensions/ffmpeg

B4X:
The FFmpeg module provides FfmpegAudioRenderer, which uses FFmpeg for decoding and can render audio encoded in a variety of formats.

Sample formatDecoder name(s)
Vorbisvorbis
Opusopus
FLACflac
ALACalac
PCM μ-lawpcm_mulaw
PCM A-lawpcm_alaw
MP1, MP2, MP3mp3
AMR-NBamrnb
AMR-WBamrwb
AACaac
AC-3ac3
E-AC-3eac3
DTS, DTS-HDdca
TrueHDmlp truehd

Can you take a look?

If you need, I can send you some mpeg-ts samples.
i will look into this during weekend please send files privately
 

nedium

Active Member
Licensed User
Longtime User
Hi, @PassionDEV

You can add a ResizeMode, which allows you to center the width and height of the screen, the fit option expands until it leaves the screen and does not allow you to use the entire resolution of the device.

You can also add all the options that exoplayer allows you in ResizeMode.

Thank you
 

Addo

Well-Known Member
Licensed User
Longtime User
New Version has been updated in the first Post
Changes

Version 1.10
  • FFMPEG Extension is Supported
  • FFmpegavailabe << to check weather ffmpeg is available or not.
  • player.Initialize("player", True) <<Initialize has a new parameter to give you the choice if you want to use ffmpeg as your audio decoder or not.
  • added a Fullscreen Support >> as already implemented Here Thanks to Erel
  • Example updated to describe More.
Note you need to redownload the additional AAR to get exoplayer-ffmpeg-extension-2.18.2.aar
 
Last edited:

Almora

Well-Known Member
Licensed User
Longtime User
Hello there . I tested but it gave this error.

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 359)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(B4XViewWrapper.java:91)
at anywheresoftware.b4a.objects.B4XViewWrapper.setVisible(B4XViewWrapper.java:117)
at b4a.example.main._activity_create(main.java:359)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.example.main.afterFirstLayout(main.java:105)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
 

Addo

Well-Known Member
Licensed User
Longtime User
That was quite hard to get it done but finally i done it,
Since FFMPEG that been published by google on Exoplayer Repo supports only Audio Decoding it wasnt good to support FFMPEG to decode audio only which is frustrating.
I have compiled FFmpeg and wrapped it my self to be able to add FFMPEg Video Renderer.

library updated in the first Post

Version 1.20
  • FFMPEG Now Support Video Rendering which will give the exoplayer the ability to play many mediacodecs video & audio.
have a nice day everyone.

Note you need to re-download the additional aar and place them in your Additional folder.
 
Last edited:
Top