• Stars
    star
    306
  • Rank 136,456 (Top 3 %)
  • Language
    Java
  • Created about 8 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

list_video_play

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

EFFECT

IMAGE ALT TEXT HERE

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.

More Repositories

1

PickView

Date and Province WheelView like IOS
Java
1,101
star
2

PinterestView

Pinterest like awesome menu control for Android
Java
419
star
3

ImageBrowse

ImageBrowseFragment like WeChat moments image transition on Lollipop..
Java
318
star
4

VideoControllerView

Custom media controller view https://github.com/brucetoo/VideoControllerView
Java
244
star
5

ComboView

A view of clicking effect by combo action
Java
201
star
6

GradientTabStrip

See branch demo-text....Change from PagerSlidingTabStrip.Scroll to make tab text gradient
Java
80
star
7

Yingke

映客直播间IOS布局设计的一种实现方式demo
Java
45
star
8

Animation-with-fragment

idea from custom-animations-with-fragments and Code refrence from https://git.mika-dev.com/Mika/custom-animations-with-fragment I add click listener in "editmode",and handle bugs when Double clicking sticky item
Java
19
star
9

DrawerView

Detect how to use ViewDragHelper to custom ViewGroup
Java
11
star
10

AutoSwipeRefesh

A demo how to implement auto refresh using SwipeRefreshLayout
Java
10
star
11

Android-ObservableScrollView

from https://github.com/ksoichiro/Android-ObservableScrollView 主要是对FlexibleSpaceWithImageListViewActivity分析加上了注释
Java
7
star
12

MaterilaNewsApp

a news app with material design
Java
6
star
13

ExpandRecyclerView

Java
4
star
14

JNItest

Android Studio下NDK使用的例子,以及生成SO的方法
Java
4
star
15

PlantVsZombies

cocos2d-android版本应用
Java
3
star
16

ExpandableRecyclerAdaper

Make RecyclerView has Header and Footer easily!!!
Java
2
star
17

Side-Menu

from http://yalantis.com/
Java
2
star
18

DrawCircleProgress

something in CircleProgress onDraw() method about canvas.save,and canvas.restore() I dont realize
Java
2
star
19

Spotlight

idea from http://www.curious-creature.com/2012/12/13/android-recipe-2-fun-with-shaders/ i change something to make activity transition smooth, just create a bitmap about targetView's snap,reveal background when activity transition So lazy, no GIF
Java
2
star
20

Cocos2D-Game

简单cocos2D-android的入门demo
Java
1
star
21

UpdataFile

android 上传文件, Tomcat Servlet 接收文件,并读取文件
Java
1
star
22

ChatUI

IM Chat UI
C
1
star
23

Material-Whole

Material everywhere use some 3rd library
HTML
1
star
24

AndroidTools

It's a plugin not only contains Adb command...
Java
1
star
25

Materia-Design

大神的代码,研究中
Java
1
star
26

WifiTransport

Wifi transform and p2p
Java
1
star
27

ScrollToHide

Scroll to hide toolBar and FAB
Java
1
star
28

weex-demo

weex demo working...
Vue
1
star