Comments (4)
Just tried this using the same version:
Index: kohii-sample/src/main/java/kohii/v1/sample/ui/grid/ItemsAdapter.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- kohii-sample/src/main/java/kohii/v1/sample/ui/grid/ItemsAdapter.kt (revision e936e2c8e7043cdf5a0ef589972226ebab3d5c99)
+++ kohii-sample/src/main/java/kohii/v1/sample/ui/grid/ItemsAdapter.kt (date 1622720174945)
@@ -72,7 +72,9 @@
tag = requireNotNull(videoTag)
artworkHintListener = holder
}
- .bind(holder.container)
+ .bind(holder.container) { playback ->
+ playback.addStateListener(holder)
+ }
}
} else holder.bind(position)
}
Where the ViewHolder implements the Playback.StateListener
Index: kohii-sample/src/main/java/kohii/v1/sample/ui/grid/VideoViewHolder.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- kohii-sample/src/main/java/kohii/v1/sample/ui/grid/VideoViewHolder.kt (revision e936e2c8e7043cdf5a0ef589972226ebab3d5c99)
+++ kohii-sample/src/main/java/kohii/v1/sample/ui/grid/VideoViewHolder.kt (date 1622720157556)
@@ -26,10 +26,13 @@
import kohii.v1.core.Rebinder
import kohii.v1.sample.R
import kohii.v1.sample.common.BaseViewHolder
+import timber.log.Timber
internal class VideoViewHolder(
parent: ViewGroup
-) : BaseViewHolder(parent, R.layout.holder_player_container), Playback.ArtworkHintListener {
+) : BaseViewHolder(parent, R.layout.holder_player_container),
+ Playback.ArtworkHintListener,
+ Playback.StateListener {
private val root: AspectRatioFrameLayout = itemView.findViewById(R.id.playerContainer)
internal val container: FrameLayout = itemView.findViewById(R.id.container)
@@ -76,4 +79,40 @@
}
.start()
}
+
+ //region Playback.StateListener
+ override fun onRendered(playback: Playback) {
+ Timber.i("onRendered ${playback.tag}")
+ }
+
+ override fun onBuffering(playback: Playback, playWhenReady: Boolean) {
+ Timber.i("onBuffering ${playback.tag}")
+ }
+
+ override fun onPlaying(playback: Playback) {
+ Timber.i("onPlaying ${playback.tag}")
+ }
+
+ override fun onPaused(playback: Playback) {
+ Timber.i("onPaused ${playback.tag}")
+ }
+
+ override fun onEnded(playback: Playback) {
+ Timber.i("onEnded ${playback.tag}")
+ }
+
+ override fun onVideoSizeChanged(
+ playback: Playback,
+ width: Int,
+ height: Int,
+ unAppliedRotationDegrees: Int,
+ pixelWidthHeightRatio: Float
+ ) {
+ Timber.i("onVideoSizeChanged ${playback.tag}")
+ }
+
+ override fun onError(playback: Playback, exception: Exception) {
+ Timber.i("onError ${playback.tag}")
+ }
+ //endregion
}
and it works well:
I/VideoViewHolder: onBuffering HOLDER::〜3
I/VideoViewHolder: onBuffering HOLDER::〜3
I/VideoViewHolder: onVideoSizeChanged HOLDER::〜3
I/VideoViewHolder: onRendered HOLDER::〜3
I/VideoViewHolder: onPlaying HOLDER::〜3
I/VideoViewHolder: onEnded HOLDER::〜3
Is this what you want to do? Can you double check, or share your setup that doesn't work as expected?
from kohii.
@eneim
I checked the comments you gave and my implementation.
It's clear.
I tried to create custom bridge class like a PlayerViewBridge.kt
in exo-kohiiplayer
module.
But then, my custom class was not seem to be called Player.addListener
...
This is due to my implementation. I apologize for the inconvenience
from kohii.
@FujiKinaga Oh it must be an issue. Let me check the current status. Can you tell me which version you are using?
from kohii.
@eneim
Thanks for your confirmation.
I'm using v1.2.0.2011008 now.
from kohii.
Related Issues (20)
- How to playlist HOT 1
- Lacking documentation on how to change volume HOT 10
- 1.3.0.2011008-20210429.080049-18 is not found at Sonatype HOT 6
- Video player blinks in RecyclerView HOT 5
- Migration from jcenter() to mavenCentral() or google() HOT 2
- Playback.StateListener not return any value HOT 2
- How to stop video playback when the app goes to background HOT 2
- Is the library production ready? HOT 1
- Play Video In Nested Recyclerview
- Why does not you play music in the video? I mean in Recyclerview ... HOT 1
- java.lang.NoSuchMethodError: No static method getNetworkType HOT 2
- Project not building in current stable version of android studio bumblebee HOT 1
- Kohii crash when use exoplayer 2.13.3 NoClassDefFoundError TrackSelection HOT 2
- Kohii with fragment replace HOT 2
- Kohii vs Toro and development status HOT 3
- Caching Video
- is Kohii better than Toro ? HOT 2
- Black Screen while move next video in Recycleview HOT 16
- Can't replay and black screen while play video with same tag in Recycleview
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kohii.