vkay94 / doubletapplayerview Goto Github PK
View Code? Open in Web Editor NEWYouTube's Fast-Forward-Rewind double tapping feature built on top of ExoPlayer
License: MIT License
YouTube's Fast-Forward-Rewind double tapping feature built on top of ExoPlayer
License: MIT License
Hello, I was wondering why you rather used a java interface instead of a kotlin interface ?
Hi sir,
I'm a newbie to the ExoPlayer
. I really like your library. I tried to implement it to my project through using the java code. But It had a problem when I implemented it. In my ExoPlayerManager
class that contains all my Player code such as create the player
. And in my PlayerActivity
that contains my layout, I set the playerView
through the DoubleTabPlayer
and tried to put it to the YoutubeOverlay
by using mYouTubeOverlay.setPlayerView(DoubleTabPlayer);
but it can't not assign to the mYoutubeOverlay
and always null
. I didn't know why, and I tried to check the playerView
in that time, it had the parameter but it couldn't assign to the YoutubeOverlay
. Below is my code.
Here is my ExoPlayerManager
class:
private void createPlayers() {
if (player != null) {
player.release();
}else {
player = createPlayer();
playerView.setPlayer(player);
}
}
private SimpleExoPlayer createPlayer() {
SimpleExoPlayer player = new SimpleExoPlayer.Builder(playerView.getContext()).build();
player.setPlayWhenReady(true);
player.prepare(mediaSourceBuilder.getMediaSource(false));
player.addListener(eventListener);
return player;
}
Here is my PlayerActivity
:
@BindView(R.id.player_view)
DoubleTapPlayerView mPlayerView;
@BindView(R.id.progressBar)
ProgressBar mProgressBar;
private ExoPlayerManager exoPlayerManager;
private PreviewTimeBar previewTimebar;
private ScaleGestureDetector mGestureDetector;
private float mScaleVideo = 1f;
private SimpleExoPlayer player;
private YouTubeOverlay mYouTubeOverlay;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player);
ButterKnife.bind(this);
previewTimebar = mPlayerView.findViewById(R.id.exo_progress);
mYouTubeOverlay = mPlayerView.findViewById(R.id.youtubeDoubleTap);
previewTimebar.addOnPreviewVisibilityListener((previewBar, isPreviewShowing) -> {
Log.d("PreviewShowing", String.valueOf(isPreviewShowing));
});
previewTimebar.addOnScrubListener(new PreviewBar.OnScrubListener() {
@Override
public void onScrubStart(PreviewBar previewBar) {
Log.d("Scrub", "START");
}
@Override
public void onScrubMove(PreviewBar previewBar, int progress, boolean fromUser) {
Log.d("Scrub", "MOVE to " + progress / 1000 + " FROM USER: " + fromUser);
}
@Override
public void onScrubStop(PreviewBar previewBar) {
Log.d("Scrub", "STOP");
}
});
exoPlayerManager = new ExoPlayerManager(mPlayerView, previewTimebar, findViewById(R.id.imageView), getString(R.string.url_thumbnails), mProgressBar);
exoPlayerManager.play(Uri.parse(getString(R.string.media_url_mp4)));
player = ExoPlayerFactory.newSimpleInstance(this);
mGestureDetector = new ScaleGestureDetector(this, new scaleListener());
requestFullScreenIfLandscape();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
requestFullScreenIfLandscape();
}
}
@Override
public void onStart() {
super.onStart();
exoPlayerManager.OnStart();
initializeDoubleTapPlayerView();
mYouTubeOverlay.setPlayerView(mPlayerView);
mYouTubeOverlay.setPlayer(player);
}
P/s: You can clone my project to see the problem. And I use the ExoPlayer 2.11.1
version. Hope to see your support.
Best regard,
An Nguyen Hoang
┬───
│ GC Root: System class
│
├─ android.os.Looper class
│ Leaking: NO (Thread↓ is not leaking and a class is never leaking)
D/LeakCanary: │ ↓ static Looper.sMainLooper
├─ android.os.Looper instance
│ Leaking: NO (Thread↓ is not leaking)
│ ↓ Looper.mThread
├─ java.lang.Thread instance
│ Leaking: NO (the main thread always runs)
│ Thread name: 'main'
│ ↓ Thread.threadLocals
│ ~~~~~~~~~~~~
├─ java.lang.ThreadLocal$ThreadLocalMap instance
│ Leaking: UNKNOWN
│ Retaining 2,0 kB in 57 objects
│ ↓ ThreadLocal$ThreadLocalMap.table
│ ~~~~~
├─ java.lang.ThreadLocal$ThreadLocalMap$Entry[] array
│ Leaking: UNKNOWN
│ Retaining 2,0 kB in 56 objects
│ ↓ ThreadLocal$ThreadLocalMap$Entry[].[8]
│ ~~~
├─ java.lang.ThreadLocal$ThreadLocalMap$Entry instance
│ Leaking: UNKNOWN
│ Retaining 28 B in 1 objects
│ ↓ ThreadLocal$ThreadLocalMap$Entry.value
│ ~~~~~
├─ android.animation.AnimationHandler instance
│ Leaking: UNKNOWN
│ Retaining 429,8 kB in 6701 objects
│ ↓ AnimationHandler.mAnimationCallbacks
│ ~~~~~~~~~~~~~~~~~~~
├─ java.util.ArrayList instance
│ Leaking: UNKNOWN
│ Retaining 429,6 kB in 6696 objects
│ ↓ ArrayList.elementData
│ ~~~~~~~~~~~
├─ java.lang.Object[] array
│ Leaking: UNKNOWN
│ Retaining 429,6 kB in 6695 objects
│ ↓ Object[].[2]
│ ~~~
├─ android.animation.ValueAnimator instance
│ Leaking: UNKNOWN
│ Retaining 429,4 kB in 6694 objects
│ ↓ Animator.mListeners
│ ~~~~~~~~~~
├─ java.util.ArrayList instance
│ Leaking: UNKNOWN
│ Retaining 84 B in 4 objects
│ ↓ ArrayList.elementData
│ ~~~~~~~~~~~
├─ java.lang.Object[] array
│ Leaking: UNKNOWN
│ Retaining 64 B in 3 objects
│ ↓ Object[].[0]
│ ~~~
├─ com.github.vkay94.dtpv.youtube.views.SecondsView$thirdAnimator$2$invoke$lambda-3$$inlined$doOnStart$1 instance
│ Leaking: UNKNOWN
│ Retaining 12 B in 1 objects
│ Anonymous class implementing android.animation.Animator$AnimatorListener
│ ↓ SecondsView$thirdAnimator$2$invoke$lambda-3$$inlined$doOnStart$1.this$0
│ ~~~~~~
├─ com.github.vkay94.dtpv.youtube.views.SecondsView instance
│ Leaking: YES (View.mContext references a destroyed activity)
│ Retaining 428,8 kB in 6675 objects
│ View is part of a window view hierarchy
│ View.mAttachInfo is null (view detached)
│ View.mID = R.id.null
│ View.mWindowAttachCount = 1
│ mContext instance of me.a.Stream with mDestroyed = true
│ ↓ View.mContext
i tried to stop all animation but doesn't work
and i tried add to my onDestroy Activity still same
playerView.cancelInDoubleTapMode();
secondsView.setCycleDuration(0);
secondsView.cancelPendingInputEvents();
secondsView.stop();
When I added the Double tap player view My app crashes saying kotlin.TypeCastException: null cannot be cast to non-null type
Can't launch my app, because somehow it generates duplicate.
Android resource compilation failed
\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:7849: AAPT: error: duplicate value for resource 'attr/show_buffering' with config ''.
\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:7849: AAPT: error: resource previously defined here.
\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml: AAPT: error: file failed to compile.
I have dev my app with java base how to implement double tab for java
I couldn't use this library in my java project
Any help here?
please Migrate to media3.
Hello! Your library is very interesting but I'm running in an issue, I have a heavily customised exoplayer layout and I'd like to use your library on top of it ? I need the doubletap and the animation. is it possible or should I get your DoubleTapPlayerView and modify the layout ?
Thanks
who knows where has iOS version?
On doubleTap has text "xx seconds".
How can i Add own language?
How can i use this library as simple as adding it in constraint layout and set double tap listeners
while it animates the beautiful ripples without caring if its a video being played or anything else
I am seeing this with DPTV version 1.0.4.
After integrating this dependency into our app, we noticed that the video player is "zoomed" in when changing the configuration to landscape, but returns to look as expected when in portrait.
After downloading and building the demo app, I noticed that the behavior is the same there. I've attached a video that should hopefully be clear enough to demonstrate what is going on without needed to build from source yourself. Most notably, details from the bottom of the video get cropped when in landscape.
Tested with a Google Pixel 6 on Android 12:
If user keeps toggling between portrait and Landscape mode. Arc animation is shown only on the right end even if user doubled tap on left side of the screen
I want to pause the controller for a while.
The code below doesn't work.
.setEnabled(false)
I got error, when o just put xml code to my layout
AAPT: error: attribute yt_playerview not found.
ExoPlayer version: r2.13.2
UncaughtExceptionHandler
java.lang.NoSuchFieldError: No static field DRM_UNSUPPORTED of type Lcom/google/android/exoplayer2/drm/DrmSessionManager; in class Lcom/google/android/exoplayer2/drm/DrmSessionManager; or its superclasses (declaration of 'com.google.android.exoplayer2.drm.DrmSessionManager' appears in /data/app/com.*****==/base.apk)
at com.google.android.exoplayer2.drm.DefaultDrmSessionManagerProvider.get(DefaultDrmSessionManagerProvider.java:82)
at com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory.createMediaSource(HlsMediaSource.java:395)
at com.adisalagic.thedoctorsteam.ui.video.VideoActivity.hlsFromURI(VideoActivity.java:337)
at com.adisalagic.thedoctorsteam.ui.video.VideoActivity.getSources(VideoActivity.java:299)
at com.adisalagic.thedoctorsteam.ui.video.VideoActivity.start(VideoActivity.java:283)
at com.adisalagic.thedoctorsteam.ui.video.VideoActivity.initPlayer(VideoActivity.java:274)
at com.adisalagic.thedoctorsteam.ui.video.VideoActivity.onCreate(VideoActivity.java:201)
I'm receiving the following error on the youtube_overlay.performListener
Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option
does this library get update to media 3 exoplayer
I try code from guide and add in Java this
YouTubeOverlay youTubeOverlay = getView().findViewById(R.id.youtube_overlay);
youTubeOverlay.performListener(new YouTubeOverlay.PerformListener() {
@Override
public void onAnimationStart() {
youTubeOverlay.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd() {
youTubeOverlay.setVisibility(View.GONE);
}
});
XML:
<com.keeppixel.kompot.CustomPlayerView
android:id="@+id/videoView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:show_timeout="0"
app:hide_on_touch="true"
app:player_layout_id="@layout/playerview"
android:animateLayoutChanges="true"
app:controller_layout_id="@layout/contollervidfull"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="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:layout_constraintTop_toTopOf="@id/videoView2"
app:layout_constraintBottom_toBottomOf="@id/videoView2"
app:layout_constraintStart_toStartOf="@id/videoView2"
app:layout_constraintEnd_toEndOf="@id/videoView2"
app:yt_playerView="@+id/videoView2" />
But double top don’t work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.