All Projects → vkay94 → DoubleTapPlayerView

vkay94 / DoubleTapPlayerView

Licence: MIT license
YouTube's Fast-Forward-Rewind double tapping feature built on top of ExoPlayer

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to DoubleTapPlayerView

SuperForwardView
A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.
Stars: ✭ 75 (-7.41%)
Mutual labels:  video-player, forwarding, rewind
KingPlayer
🎬 一个专注于 Android 视频播放器的基础库,无缝切换内核。(IjkPlayer、ExoPlayer、VlcPlayer、MediaPlayer)
Stars: ✭ 35 (-56.79%)
Mutual labels:  video-player, exoplayer
Dkvideoplayer
Android Video Player. 安卓视频播放器,封装MediaPlayer、ExoPlayer、IjkPlayer。模仿抖音并实现预加载,列表播放,悬浮播放,广告播放,弹幕
Stars: ✭ 3,796 (+4586.42%)
Mutual labels:  video-player, exoplayer
Yjplay
一个支持自定义UI布局,流式API, 加密,直播 ,亮度,音量,快进等手势 ,广告视频预览,多种加载模式 ,多种分辨率切换 ,多种封面图, 自定义数据源,列表播放,倍数播放,边播变缓存<font color="red">不是使用AndroidVideoCache</font>,离线播放,神奇的播放器
Stars: ✭ 1,700 (+1998.77%)
Mutual labels:  video-player, exoplayer
Drm wv fp player
Few of the resources from flutter plugin video_player
Stars: ✭ 19 (-76.54%)
Mutual labels:  video-player, exoplayer
Player
Clean and elegant Android video player based on ExoPlayer
Stars: ✭ 116 (+43.21%)
Mutual labels:  video-player, exoplayer
YetAnotherVideoPlayer
Yet Another Video Player for Andoid
Stars: ✭ 62 (-23.46%)
Mutual labels:  video-player, exoplayer
react-native-vlc-media-player
React native media player for video streaming and playing. Supports RTSP, RTMP and other protocols supported by VLC player
Stars: ✭ 221 (+172.84%)
Mutual labels:  video-player
beyondplayer
BeyondPlayer - Video player for English learner
Stars: ✭ 183 (+125.93%)
Mutual labels:  video-player
nplayer
🚀 支持移动端、支持 SSR、支持直播,可以接入任何流媒体。高性能的弹幕系统。高度可定制,所有图标、主题色等都可以替换,并且提供了内置组件方便二次开发。无第三方运行时依赖。
Stars: ✭ 897 (+1007.41%)
Mutual labels:  video-player
anime-cli
A CLI for streaming, downloading anime shows. The shows data is indexed through GogoAnime.
Stars: ✭ 31 (-61.73%)
Mutual labels:  video-player
SAVY
SAVY Player provides service to watch local videos with in a synchronized way.
Stars: ✭ 15 (-81.48%)
Mutual labels:  video-player
angular-youtube-player
Simple youtube player created with angular and typescript. See demo.
Stars: ✭ 35 (-56.79%)
Mutual labels:  video-player
liveme-pro-tools
LiveMe Pro Tools
Stars: ✭ 33 (-59.26%)
Mutual labels:  video-player
flutter subtitle wrapper
This is an subtitle package for flutter video player.
Stars: ✭ 24 (-70.37%)
Mutual labels:  video-player
forward
Port Forwarding Utility
Stars: ✭ 41 (-49.38%)
Mutual labels:  forwarding
voronoi-video
Fragmented HTML5 using the Voronoi diagram
Stars: ✭ 13 (-83.95%)
Mutual labels:  video-player
Flyleaf
Media Player .NET Library for WPF/WinForms (based on FFmpeg/DirectX)
Stars: ✭ 323 (+298.77%)
Mutual labels:  video-player
MetalPlayer
A video player using Metal.
Stars: ✭ 68 (-16.05%)
Mutual labels:  video-player
podcast-app
Podcast App
Stars: ✭ 291 (+259.26%)
Mutual labels:  exoplayer

DoubleTapPlayerView

A simple library to include double tap behavior to ExoPlayer's PlayerView. Created to handle fast forward/rewind behavior like YouTube.

teamwork-flip

Sample app

If you would like to test the YouTube overlay, then you can either download the demo app, which can be found under Assets of the release or build it yourself from code. It provides all main modifications available.

The sample videos own by Blender Foundation and a full list can be found here.

Download

The Gradle dependency is available via jitpack.io. To be able to load this library, you have to add the repository to your project's gradle file:

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

Then, in your app's directory, you can include it the same way like other libraries:

android {
  ...
  // If you face problems during building you should try including the below lines if you
  // haven't already
  
  // compileOptions {
  //   sourceCompatibility JavaVersion.VERSION_1_8
  //   targetCompatibility JavaVersion.VERSION_1_8
  // }
}

dependencies {
  implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.4'
}

The minimum API level supported by this library is API 16 as ExoPlayer does, but I can't verify versions below API level 21 (Lollipop) myself. So feedback is welcomed.

Getting started

In order to start using the YouTube overlay, the easiest way is to include it directly into your XML layout, e.g. on top of DoubleTapPlayerView or inside ExoPlayer's controller:

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    
    <com.github.vkay94.dtpv.DoubleTapPlayerView
        android:id="@+id/playerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        
        app:dtpv_controller="@+id/youtube_overlay" />

    <com.github.vkay94.dtpv.youtube.YouTubeOverlay
        android:id="@+id/youtube_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="invisible"
        
        app:yt_playerView="@+id/playerView" />
</FrameLayout>

Then, inside your Activity or Fragment, you can specify which preparations should be done before and after the animation, but at least, you have got to toggle the visibility of the overlay and reference the (Simple)ExoPlayer to it:

youtube_overlay
    .performListener(object : YouTubeOverlay.PerformListener {
        override fun onAnimationStart() {
            // Do UI changes when circle scaling animation starts (e.g. hide controller views)
            youtube_overlay.visibility = View.VISIBLE
        }

        override fun onAnimationEnd() {
            // Do UI changes when circle scaling animation starts (e.g. show controller views)
            youtube_overlay.visibility = View.GONE
        }
    })
    // Uncomment this line if you haven't set yt_playerView in XML
    // .playerView(playerView)

// Uncomment this line if you haven't set dtpv_controller in XML 
// playerView.controller(youtube_overlay)

// Call this method whenever the player is released and recreated
youtube_overlay.player(simpleExoPlayer)

This way, you have more control about the appearance, for example you could apply a fading animation to it. For a full initialization you can refer to the demo application's MainActivity and layout files.


API documentation

The following sections provide detailed documentation for the components of the library.

DoubleTapPlayerView

DoubleTapPlayerView is the core of this library. It recognizes specific gestures which provides more control for the double tapping gesture. An overview about the added methods can be found in the PlayerDoubleTapListener interface.

You can adjust how long the double tap mode remains after the last action, the default value is 650 milliseconds.

YouTubeOverlay

YouTubeOverlay is the reason for this library. It provides nearly the same experience like the fast forward/rewind feature which is used by YouTube's Android app. It is highly modifiable.

XML attributes

If you add the view to your XML layout you can set some custom attributes to customize the view's look and behavior. Every attributes value can also be get and set programmatically.

Attribute name Description Type
yt_seekSeconds Fast forward/rewind seconds skip per tap. The text xx seconds will be changed where xx is value. int
yt_animationDuration Speed of the circle scaling / time in millis to expand completely. When this time has passed, YouTubeOverlay's PerformListener.onAnimationEnd() will be called. int
yt_arcSize Arc of the background circle. The higher the value the more roundish the shape becomes. This attribute should be set dynamically depending on screen size and orientation. dimen
yt_tapCircleColor Color of the scaling circle after tap. color
yt_backgroundCircleColor Color of the background shape. color
yt_iconAnimationDuration Time in millis to run through an full fade cycle. int
yt_icon One of the three forward icons. Will be multiplied by three and mirrored for rewind. drawable
yt_textAppearance Text appearance for the xx seconds text. style

I'd recommend the sample app to try out the different values for them.

YouTubeOverlay.PerformListener

This interface listens to the lifecycle of the overlay.

// Obligatory: Called when the overlay is not visible and the first valid double tap event occurred.
// Visibility of the overlay should be set to VISIBLE within this interface method.
fun onAnimationStart()

// Obligatory: Called when the circle animation is finished.
// Visibility of the overlay should be set to GONE or INVISIBLE within this interface method.
fun onAnimationEnd()

// Optional: Determines whether the player should forward (true), rewind (false) or ignore (null) taps.
fun shouldForward(player: Player, playerView: DoubleTapPlayerView, posX: Float): Boolean?

SeekListener

This interface reacts to the events during rewinding/forwarding.

// Called when the start of the video is reached
fun onVideoStartReached()

// Called when the end of the video is reached
fun onVideoEndReached()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].