Git Product home page Git Product logo

enhancedplayerview's Introduction

EnhancedPlayerView

EnhancedPlayerView is a good idea for you to improve your design and make things more easy with Media3 PlayerView

StandWithPalestine


StandWithPalestine


Usage

Step 1

Add this line to root build.gradle at allprojects block code:

allprojects {
  repositories {
   //...
   maven { url 'https://jitpack.io' }
  }
 }

then add this line into your build.gradle app level.

dependencies {
    implementation 'com.github.A0ks9:EnhancedPlayerView:1.0-Beta'
}

Step 2

Add this widget to your xml activity file

<com.better.player.EnhancedPlayerView android:id="@+id/view_name"
    android:layout_width="match_parent" android:layout_height="match_parent"
    app:animation_enabled="false" app:controller_layout_id="@layout/exo_control_view"
    app:auto_show="true" app:hide_by_touching="true" app:hide_during_ads="true"
    app:hide_on_touch="false" app:show_timeout="0" />

important

  • you should add without changing anything
app:animation_enabled="false"app:hide_on_touch="false"app:show_timeout="0"app:controller_layout_id="@layout/exo_control_view"

Step 3

add ExoPlayer to your project and use it normally


Step 4

After adding ExoPlayer to the project and intializing it then use it with the EnhancedPlayerView like this

binding.playerView.setPlayer(player);
player.

setMediaSource(binding.playerView.EnableCaching(mediaUrl));
        player.

prepare();

Step 5

Add this Code in onResume of your Activity/Fragment

binding.playerView.onResumeActivity();

Add this code in onPause of your Activity/Fragment

binding.playerView.onPauseActivity();

Add this code in onDestory of your Activity/Fragment

binding.playerView.onDestroyActivity();
if(player !=null){
        binding.playerView.

setPlayer(null);
    player.

release();
}

OPTIONAL

If you want to hide UserID text that moves on the screen then use this in xml

app:show_floating_text="false"

If you want to hide Close Image then use this in xml

app:show_close="false"

listener of Additional Button Clicks

yourPlayerView.addListener(() ->{
        //clicked
        });

If you want to cache the video, so it doesn't download every time the user opens the app. Then add this to the EnhancedPlayerView view

binding.playerView.initializeDatabaseProvider();
binding.playerView.

initializeActivityResult(getActivityResultRegistry());

If you are looking for video orientation based on phone orientation then Add this code in your Activity/Fragment

@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    binding.playerView.onConfigurationChangedActivity(newConfig);
}

If tou are looking for PIP for the video then Add this code in your Activity/Fragment

@Override
public void onUserLeaveHint() {
    binding.playerView.onUserLeaveHintActivity();
}

@Override
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
    super.onPictureInPictureModeChanged(isInPictureInPictureMode);
    binding.playerView.onPictureInPictureModeChanged(isInPictureInPictureMode);
}

IMPORTANT

If you want to add new features to the library, you can change and add codes to the library. but when you add a new code then use a comment to explain the code for other developers to make the things easy to understand.

enhancedplayerview's People

Contributors

a0ks9 avatar abodinagdat16 avatar

Stargazers

 avatar Obieda avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.