-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I get the callback when Google Assistant command is triggered? #7206
Comments
@marcbaechinger Marc, mind taking a look? |
Can you give more details on the root problem, why the player was not resuming. Agree that the workaround you are trying is complicated as we can not distinguish from actual intended pausing. I'd prefer to find the root cause of why the player is not resuming after a seek. That does not sound right to me. If we can remove that, it would be the better solution than a workaround which is dificult to keep away from valid use cases. Can you put breakpoints in the callback methods of MediaSessionConnector to find out what commands Assistant is sending when it starts? |
Thanks for the response @marcbaechinger. I've added some breakpoints on
MyTimelineQueueNavigator:
MyControlDispatcher:
MyExoPlayerEventListener:
|
Thanks! That looks good actually. It seems that some ATV devices do exhibit the behaviour you are describing (like pausing when Assistant is activated). It seems that it does not happen on all devices though, which is of course a bit unfortunate, because there is no way to keep these apart. Can you tell me on what device you are experiencing this behaviour? Would it be possible for you to check on another device as well like on a Nvidia Shield? Or can you test on an emulator to see what the behaviour is there? |
We've been testing on Nvidia Shield, the problem is always happening there |
Ok. Would be interesting to know how other ATV devices/Assistant versions behave. I can't see how ExoPlayer or the The ony thing you can do is just resume playback after seek. Obviously this hinders a real user to pause and then seek without resuming, but I can't see another approach fin case of the behaviour exhibited by Assistant. |
I see, one thing we noticed was that on version 2.9.6 of Exoplayer, if we added a breakpoint or delay on |
Hmmm. I was under the impression that Assistant is sending an onPause which is causing the problem that after the seek you need to resume playback again from app code. How can delaying the onSeekTo help not pausing the player? I probably understand not properly, sorry. Can you elaborate? |
|
Any updates on this @marcbaechinger ? We are open to help investigating the issue, I think this could be solved on Exoplayer's side, let me know, thanks! |
Please let me know about your ideas. :) |
The main problem, as you said @marcbaechinger, is that on the MediaSessionConector the More info on device tested: |
Yes, I agree that This onPause event from Assistant is the same like when a user issues a 'Ok Google, pause' voice command. Pausing the app in Android Auto or on a watch running WearOS results in the same command. All these clients are using the same events which end up in the Because of this just ignoring the onPause event seems not a solution and there is no way to distinguish these event like for a source of origin. The |
I see, so should I open an issue on Google Assistant's side @marcbaechinger ? |
The underlying issue appears to be that the MediaSession is in the STATE_BUFFERING after the seek dispatch. According to the documentation:
So the assistant probably assumes that there is no need dispatch the play event, since it thinks that it is already playing. This is however not true while playWhenReady is not set. |
That looks interesting. Thanks for your comment and the PR. I look into this. I think the problem above is that Assistant is sending a pause event which is not expected, but it's very well possible this is caused by the same reason. @aureobeck Seems like the semantics described by @inv3rse indicates the problem is in the MediaSessionConnector. |
We merged the pr #7367 of @inv3rse into thee dev2 branch. |
I'm closing this issue assuming the pr #7367 fixed the problem. Please re-open if you think this is required. |
Greetings, @marcbaechinger , sorry for late response. I'm still having trouble to test a local branch of Exoplayer on our Cordova app. Since we have some dependency complexity, but we're working on it. I'll let you know if the problem persists. |
FYI @marcbaechinger @inv3rse we were able to test this and resuming after seeking seems to be working now on dev2 branch 🚀️🚀️ |
Any ideas when can we expect a new version @marcbaechinger? |
This should be in 2.11.5, which will hopefully go out sometime next week. |
Searched documentation and issues
Official
ExoPlayer
documentation and source code ofMediaControllerCompat
,MediaSessionConnector
,MediaSession
classes.My issue is similar to #6057 and #6446 but none of the solutions worked as expected (details on question).
Question
I have an Android cordova app which has Exoplayer Media Session enabled, the player was not resuming after seeking on AndroidTV using Google Assistant.
So I tried to save the
playWhenReady
on thedispatchSetPlayWhenReady
(which is called when Google Assistant is opened) in a local propertywasPlaying
, to check if it should resume after seeking (if it was playing before).That solved the initial problem, but then I have a problem when user pauses and then seeks, both using Google Assistant. It will save
wasPlaying
astrue
when user callsPAUSE
command (on thedispatchSetPlayWhenReady
when assistant is opened) and resume after seeking when it shouldn't.So basically I need to somehow get the
PAUSE
command callback from google assistant so I can differentiate from thedispatchSetPlayWhenReady
which is called when assistant is opened. And guarantee thatwasPlaying
is set tofalse
when user callsPAUSE
command and prevent it from resuming after seeking.Tried so far:
And:
But none of them are called on PAUSE command of Google Assistant, but only when it's opened.
The text was updated successfully, but these errors were encountered: