ExVipPlayer


Source link: https://github.com/karanvs/ExVidPlayer

ExVidPlayer

ExVidPlayer is simple library that abstracts ExoPlayer.

Getting Started

  • Add this to build.gradle
allprojects {

repositories {

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

}
  
}
 
  • Add dependency for library
dependencies {

 compile 'com.github.karanvs:ExVidPlayer:v2.8'  
}
 

Usage

What's New

  • ExVpSimpleFragment

On account of a case for simple video player without the need for brigtness and volume controls, this is the latest addition to exvidplayer, this fragment provides simple playback without controls.

  • New methods added for ExVpListener for more control.

Add permissions to your manifest


<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" /> //this permission is not needed for ExSimpleVpFragment 

Settings permission will used for brightness controls, If you are using only ExVidPlayer, then you may skip it. This will work pre Marshmallow, however for Marshmallow and above, you will have to explicity demand permission at runtime. Initialize your ExVidPlayer instance only when you have the permissions otherwise it may lead to runtime error. ExVidPlayerActivity automatically handles this for you , but you may lose the flexbility to place the video in layout as per your need, you may achieve this either by ExVpCompleteFragment (with controls) and ExVpFragment with your custom controls.

ExVidPlayer(Simple)

  • Define an instance of ExVidPlayer and set player event listener,
// initialize the new player instance ExVidPlayer exVidPlayer = ExVidPlayer.Factory.newInstance(getActivity(), surfaceView, mainHandler,aspectRatioFrameLayout);
 exVidPlayer.setListener(mPlayerListener);
 exVidPlayer.setSource(video_url, video_type,currentTrackIndex);
  //define listener  ExVidPlayerListener mPlayerListener = new ExVidPlayerListener() {

 @Override public void onError(String message) {

  
}

  @Override public void onBufferingStarted() {

  
}

  @Override public void onBuffering(String percentage) {

 
}

  @Override public void onBufferingFinished() {

 
}

  @Override public void onRendereingstarted() {

  
}

  @Override public void onCompletion() {

}

  @Override public void hideControls() {

}

  @Override public void showControls() {

 
}

  @Override public void onProgressChanged(int progress) {

 
}

  
}
;  

ExVidPlayerFragment(Complete)

  • Gesture controls.

  • Brightness controls with one single touch vertical scroll.

  • Volume controls with multitouch vertical scroll.

  • Forward on left swipe.

  • Reverse on right swipe.

  • Player controls

  • Usage

//set up fragment private ExVidPlayerListener mPlayerListener;
FragmentManager fragmentManager=getSupportFragmentManager();
 FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
 ExVpCompleteFragment exVpCompleteFragment =new ExVpCompleteFragment();
 mPlayerListener=exVpCompleteFragment. Bundle bundle=new Bundle();
 bundle.putStringArrayList("urls",video_url);
 bundle.putStringArrayList("type",video_type);
 bundle.putInt("currentIndex",0);
 exVpCompleteFragment.setArguments(bundle);
 fragmentTransaction.add(R.id.parent, exVpCompleteFragment);
//replace parent with id of your framelayout fragmentTransaction.commit();
  

ExVidPlayerFragment (without controls)

  • Gesture controls.

  • Brightness controls with one single touch vertical scroll.

  • Volume controls with multitouch vertical scroll.

  • Forward on left swipe.

  • Reverse on right swipe.

  • Usage

ExVpListener exVpControls;  FragmentManager fragmentManager = getSupportFragmentManager();
 FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
 ExVpFragment exVpFragment = new ExVpFragment();
 exVpControls=exVpFragment.getExVpListener();
 Bundle bundle = new Bundle();
 bundle.putStringArrayList("urls", video_url);
 bundle.putStringArrayList("type", video_type);
 bundle.putInt("currentIndex",0);
 exVpFragment.setArguments(bundle);
 fragmentTransaction.add(R.id.parent, exVpFragment);
 fragmentTransaction.commit();
 

// set up controls layouts

exVpControls.setControlLayout(root);
 exVpControls.setProgressBar(mProgress);
 exVpControls.setCurrentText(tvCurrent);
 exVpControls.setDurationText(tvTotal);
 

ExVpListener has following events, you can call them on yout events.

void setControlLayout(ViewGroup viewGroup);

 void play();

 void stop();

 void forward();

 void reverse();

 void nextTrack();

 void previousTrack();

 void setProgressBar(SeekBar seekBar);

 void setDurationText(TextView textView);

 void setCurrentText(TextView te);

 void changeQuality(View v);

 void addTrack(String url,String type);

 void setCurrent(int position);

 boolean isPlaying();

 void removeTrack(int position);

 void seekToProgress(int progress);
  

ExVidPlayerActivity

Declare in your manifest

 <activity android:name="com.veer.exvidplayer.VideoPlayer.ExVidPlayerActivity" android:configChanges="orientation|screenSize"></activity>  

Use as

Intent intent = new Intent(HomeDetailScreen.this, ExVidPlayerActivity.class);
 intent.putStringArrayListExtra("urls", video_urls);
 intent.putStringArrayListExtra("types", video_types);
 intent.putExtra("currentIndex", postion);
 startActivity(intent);
  
  • Device orientation handling,

ExVidPlayer handler by default screen orientation, playback will continue without disruption. You need to make changes to your activity decleration in your manifest

Add this to your activity tag. android:configChanges="orientation|screenSize" 

License

This project is licensed under the Apache 2.0 License - see the LICENSE.txt file for details

Resources

A View for cropping images that is similar to Instagram's crop. Also an Activity for cropping is included.

ApiResponse simplifies handling standardized API JSON responses. It follows the API response format as produced by Api Response Builder library.

Casty is a small Android library that provides a simple media player for Chromecast. It's fully consistent with Google Cast v3.

A modern Android oAuth2 library using OkHttp with resource owner password grant types and easy token refreshing. This library aims to provide a solution for the less commonly used resource owner password grant type as well as providing dynamic parameter support that can be used with frameworks that allow for more flexible and dynamic oAuth2 parameters.

Android Starter is a starter project which implements MVP Pattern. It includes libraries:

  • RxJava2
  • RxAndroid
  • Dagger2
  • Butterknife
  • Crashlytics
  • Timber
  • GreenDao
  • Realm
  • Retrofit
  • OkHttp
  • Gson
  • Picasso

Implementation of List Item from Material Design guidelines.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes