ListVideoPlay


Source link: https://github.com/brucetoo/ListVideoPlay

Maybe this is a better user interaction of play video in List.

Play video in ListView,RecyclerView,and support full-screen,and more feature about video play control

EFFECT

Detail Implements

Android??????????

  • Define a IViewTrakcer to track the view

  • Define FloatLayerView added into { @link android.view.Window#ID_ANDROID_CONTENT } decor view

     * It contains:  * 1. rootLayout which hold all views to be added in {
    @link FloatLayerView
    }
    ,height must be WRAP_CONTENT  * 2. {
    @link #mVideoTopView
    }
     that play video  * 3. {
    @link #mVideoBottomView
    }
     in bottom layer of {
    @link #mVideoPlayerView
    }
    , which can be used to add some mask view...  * 4. {
    @link #mVideoTopView
    }
     in top layer of {
    @link #mVideoPlayerView
    }
    ,which can add some video controller view...
  • Define IScrollDetector to observer scroll state

  • Define IControllerView added in FloatLayerView


/** 

* Normal video controller view added in {
@link com.brucetoo.videoplayer.VideoTracker#mVideoTopView
}
 

* when attach to portrait(normal) tracker view 

*/

View normalScreenController(IViewTracker tracker);

/** 

* Detail video controller view added in {
@link com.brucetoo.videoplayer.VideoTracker#mVideoTopView
}
 

* when attach to detail tracker view 

*/

View detailScreenController(IViewTracker tracker);

/** 

* Full screen video controller view added in {
@link com.brucetoo.videoplayer.VideoTracker#mVideoTopView
}
 

* when attach to landscape screen 

*/

View fullScreenController(IViewTracker tracker);

/** 

* Loading state controller view added in {
@link com.brucetoo.videoplayer.VideoTracker#mVideoTopView
}
 

* when video is preparing 

*/

View loadingController(IViewTracker tracker);

 /** 

* Another controller view need be added in {
@link com.brucetoo.videoplayer.VideoTracker#mVideoTopView
}
 

*/

View anotherController(IViewTracker tracker);
 

More details see VideoPlayer

USAGE

Tracker

  • Tracker attach
 Tracker

 .attach(activity) // A activity only has a single IViewTracker

 .trackView(trackView) // Set track view,let IViewTracker's getFollowerView() can observe it scroll change

 .into(IScrollDetector) // Observe tracker view's parent scroll state change, see demo in ListScrollDetector

 .controller(IControllerView)// Switch video controller view in different scene,see demo in DefaultControllerView

 .visibleListener(this);
// Observe tracker view visible rect changed in screen.

NOTE: IScrollDetector and IControllerView will still BE THE SAME when change tracker view by Tracker#changeTrackView unless we re-call Tracker#into or Trakcer#controller again to bind new one

  • Tracker detach
 Tracker.detach(getActivity());
 //just remove all view in decor view
  • Tracker destroy
 Tracker.destroy(getActivity());
 //remove all view in decor view and clear all instanses
  • Change tracker view
Tracker.changeTrackView(getActivity(),newTrackerView);
// re-bound to new tracker view

Video Play Control

  • Register item changed listener
  Tracker.addPlayerItemChangeListener(this);
  • Register video play listener
  Tracker.addVideoPlayerListener(this);
  Tracker.playNewVideo(this, mVideoPlayView, mMetaData.getVideoUrl());

MetaData can bind origin date information along with IViewTracler

  • Stop playing one
  Tracker.stopAnyPlayback();

All Demo you can see in ListSupportFragment and DetailFragment

Known issues

  • When tracker view be re-used in ListView/RecyclerView may cause re-tracked

THANKS

VideoPlayerManager: Changes happened in many places, so there is no plan PR to origin lib.

VideoControllerView: For more feature about video play control

License

Copyright 2016 - 2017 Bruce too

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

See LICENSE file for details.

Resources

RexWeather is a sample Android Studio project demonstrating the use of Retrofit and RxJava to interact with web services.

A custom SwipeRefreshLayout.

A rich and dynamic sheet selector.

Calculon is a testing DSL for Google Android. It allows you to write activity tests and user story tests.

A small library which helps to use TabLayout with ViewPager more easily.

This is a specified proportion to the size of the Layout or View support library, with which you can easily set a fixed ratio of the size of the Layout or View, internal adaptive size calculation, completely abandon the code to calculate the size!

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