Open loicsiret opened 3 years ago
Hi,
Any help on this please ?
@loicsiret Sorry I could just get back to the library lately.
But on the second one, playback.manager.play(playable) is called, but it didn't play.
Is the second one the only Video in the screen, or the first video is being played at the same time?
If I set kohiiCanPause to false in my controller, my click listener works, but the video did'n't pause when the visibility threshold is reached.
This is expected because Kohii cannot pause the Video automatically if you say so.
Hi @eneim
The two video are visible at the same time
I ve got some "better" result, but not perfect with this :
override fun kohiiCanPause(): Boolean = kohiiAutomaticPlay
private fun Playback.forcePlay() {
playable?.let { playable ->
// this is needed to force Kohii to consider this as a manual play
kohiiAutomaticPlay = false
manager.play(playable)
// reset flag to activate auto pause/play
kohiiAutomaticPlay = true
}
}
To my knowledge, why looking kohiiCanPause when you checking if it's a manual played ?
@loicsiret Let me pull something together to better understand your requirement:
Say you have 2 Videos vertically: A above B, both are fully visible to the user (so they have the same chance of being played if allowed).
kohiiCanPlay
is false
(so you need to start it manually) and kohiiCanPause
is true
(so Kohii will pause it if needed).Assuming that, no scroll is taken place, which means our Videos' positions never change. Let's consider the scenarios below:
I have an experiment now, but I need your input to see if it can fit the existing spec or not.
To my knowledge, why looking kohiiCanPause when you checking if it's a manual played ?
This flag allows a Video to be manually started, and not be paused automatically (so even if it is scrolled off the screen, it can be kept playing). I actually do not encourage the scenario, but it is kinda a scenario someone might ask for, and it is the responsibility of a library to cover that possible scenario though ...
Assuming that, no scroll is taken place, which means our Videos' positions never change. Let's consider the scenarios below:
When A is playing, B is paused, you manually start B -> what is the expected playback state of A and B? -> A should pause and B start playing When A is paused (in this case, by a manual pause), B is paused, you manually start B -> what is the expected playback state of A and B? -> A should stay paused and B start playing When A is paused (in this case, by a manual pause), B is playing (maybe by a manual start), you manually start A -> what is the expected playback state of A and B? -> A should play paused and B is paused
@loicsiret Thanks, let me consider a snapshot so that you can try. My current manual playback mechanism is having some issues, hope I can handle them as well.
For the last answer, just to clarify, it is
-> A should play ~paused~ and B is paused
right?
oops you are totally right !
@loicsiret I push an update that you can try with the snapshot build:
Follow this step, but add the following line below jcenter()
:
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
Add the following to your app dependency
def releaseVersionName = "1.3.0.2011008-SNAPSHOT"
implementation "im.ene.kohii:kohii-core:${releaseVersionName}"
implementation "im.ene.kohii:kohii-exoplayer:${releaseVersionName}"
implementation "im.ene.kohii:kohii-androidx:${releaseVersionName}"
implementation "im.ene.kohii:kohii-experiments:${releaseVersionName}"
implementation "im.ene.kohii:kohii-ads:${releaseVersionName}"
You can also try the sample app that comes with the source code of this library.
@loicsiret I push an update that you can try with the snapshot build:
Follow this step, but add the following line below
jcenter()
:maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
Add the following to your app dependency
def releaseVersionName = "1.3.0.2011008-SNAPSHOT" implementation "im.ene.kohii:kohii-core:${releaseVersionName}" implementation "im.ene.kohii:kohii-exoplayer:${releaseVersionName}" implementation "im.ene.kohii:kohii-androidx:${releaseVersionName}" implementation "im.ene.kohii:kohii-experiments:${releaseVersionName}" implementation "im.ene.kohii:kohii-ads:${releaseVersionName}"
You can also try the sample app that comes with the source code of this library.
@eneim Hi bro, are you planning to merge this version yet?
@eneim Is this manual playback mechanism code merged into main branch?
Hi,
I face a problem when I have two video on my recyclerview. I Implemented a onclick listener to manual start/pause of my playback.
When I click on the first one, everything is fine it pause/start as required. But on the second one,
playback.manager.play(playable)
is called, but it didn't play.If I set
kohiiCanPause
to false in my controller, my click listener works, but the video did'n't pause when the visibility threshold is reached.Here is my code