V1.0.3 Exoplayer for AppInventor | Play media with Google's Exoplayer

Exoplayer

A better free video player such as Google’s Exoplayer has always been missing from AppInventor based platforms. But now its here and its free and open source.

Important Note :

With the new release of Version 1.0.2, the extension has been seprated into two extensions namely core and ui. This is done to separate ui from core functionality.

Docs


Exoplayer Core

create_player

Create an instance of exoplayer

get_player

Get instance of exoplayer to use in exoplayer ui.

add_media

Add a new media item to the player.

remove_media

Remove media item at a specific index.

clear_media_items

Clear all media items.

play

Play video.

pause

Pause video.

stop

Stop media playback

format

Convert milliseconds to time string.

state_buffering

state_ended

state_idle

state_ready

Playback states.

current_position

Current position of media.

duration

Current media duration.

buffered_location

Buffered location.

buffered_percentage

Buffered percentage.

is_loading

Check if current media is loading.

is_playing

Check if media is currently playing

play_when_ready

Should automatically play media when ready.


Exoplayer UI

create_simple

Create player view in a layout.

create_styled

Create styled player view.

show_controls

Show controls.

hide_controls

Hide Controls.

fast_forward_button_visible

next_button_visible

previous_button_visible

rewind_button_visible

shuffle_button_visible

subtitle_button_visible

Show or hide player controls

use_artwork

Set whether to show an image when playing an audio file.

default_thumbnail

Set default thumbnail in case if there is no thumbnail in media metadata, the player will show this thumbnail. It works only for audio files.

repeat_mode

Set repeat toggle modes. This will show/hide repeat toggle button.

show_loading

Set when to show loading progress indicator

resize_mode

Set video resize mode

auto_show_controller

Automatically show controller when media is interupted during playback.

controller_timeout

Milliseconds after which the controller should hide.

hide_on_touch

Hide controller on touch.

use_controller

Whether to use default controller or not.

animation_enabled

Enable/Disable controls animation.


Player Design

Simple Player View:

Styled Player View :


Downloads

Version 1.0

AIX File : com.dreamers.exoplayer.aix
AIA File : video_player.aia

Version 1.0.2

Exoplayer Core : Exoplayer Core
Exoplayer UI : Exoplayer UI

Version 1.0.3

Core : Aix
UI : Aix

AIA File : Exoplayer Modules Test

Note : You need to upload icon files with the exact names as of the icons given in this zip :
Icons


Open Source

I have made this project open-soure so other developers can benefit from it and make contributions. This initial release is a gateway to whole new opportuinities. A lot of cool and awesome stuff is coming and I would really love to see your contributions to it as well. Make sure to star the repo.


Exoplayer UI

The UI library that is being used in the extension is also open source. You can create your own custom user interfaces using this module.

Become a Supporter

18 Likes

There is a lot missing in the initial release. So therefore I would ask everyone to let me know the features and blocks that should be added.

4 Likes

Awesome Extension :star_struck:

please show some exmple

This is the best creation of yours after Plyr Extension, Keep it up. :love_you_gesture:

1 Like

Great extension !! Thanks @zainulhassan

:heart: Great :ok_hand: i need video player

subtitle, quality, thumbnail

Please Add m3u8 Quality control, Same as Plyr Video Player,

Brightness :high_brightness: , Valum control, Subtitle on / of , Dual Audio Support

& many more…

Send Personal Massage

1 Like

subtitle, quality, thumbnail. thanks for your contribution

It is there check out the extension
I just tried and was working well.

Great extension that we have been waiting for a long time! :+1:
It is also possible to play audio formats (e.g. audio/ogg).

I did a quick test with AI2 (Android 9 / 11, Companion).
Some points:

  • Playing from the assets does not work.
  • I don’t see any controls (play - pause - stop, skip, rewind etc.) neither with videos nor with audio.
  • Please add a loop function (as the ExoPlayer can basically loop seamlessly).

Did you try in companion?? It never worked for me in companion. Its a new thing if it worked in companion and I am super excited. Actually I had to rewrite the Exoplayer UI library as it depends on layout/xml files and it was a headache. The ui wont show up if you are using a companion. I tried alot but wasn’t able to make it work in the companion. It always showed lots of issues in the companion. But however the player works fine in compiled app.

Here is the code that I am using to load assets in a compiled app :

private Drawable getDrawable(Context context,String fileName) {
        try {
            InputStream is = context.getAssets().open(fileName);
            Drawable drawable = Drawable.createFromStream(is,null);
            is.close();
            return drawable;
        } catch (Exception e) {
            Log.v(LOG_TAG,"getDrawable : Error = " + e);
            return null;
        }
    }
1 Like

Ok, did you mention this in the description?
Tested on Android 11 with Companion:

I forgot about it :smiley:

If it does work in companion than I will fix the issue of controls.

2 Likes

And we also need an ExoPlayer.Completed event.

You can use this :

blocks

1 Like

This also doesn’t work with the compiled app (APK).

Did you upload asset files?

Screenshot 2021-08-01 125540

Icons : pngs.zip (2.5 KB)

If yes then can you check logcat. The log tag is : ExoplayerUi