Open luisfelipeas5 opened 7 years ago
Hello @luisfelipeas5, I don't know exactly what was your scenario, but the method pauseCast()
takes into account the state of the cast session, it must be in connected
state for you to control it (e.g. connecting
state is invalid).
As stated in the link you've sent, try using pause()
method from SambaPlayer
class instead. When player is casting, its methods (play, pause, stop...) control the remote cast player on Chromecast and not the local one.
Please let me know if this solves your problem.
Best
So, I want pause the state of the cast session.
And sorry, I forgot to say: the onPause() method that I put before is from my Activity. And even though, the Cast session don't pause.
It's weird because looking at the LogCat the follow message is appeared:
Message Sent OK: namespace:urn:x-cast:com.sambatech.player message:urn:x-cast:com.sambatech.player
I've tried doing the same here and it seems to work. Here's my flow:
onPause()
)SambaPlayer.pause()
method and the remote cast player paused correctlyCould you please provide me the project ID and media ID of the media you're testing? This way I can better simulate it here.
The project ID is and the media ID is
.
But my doubt is: what does SambaCast.pauseCast()
do?
Because I want pause the cast session by the Notification control and I'm trying use this method and not the SambaPlayer.pause()
. Am I wrong? Do I must use SambaPlayer.pause()
instead of SambaCast.pauseCast()
?
In the end SambaPlayer.pause()
will call SambaCast.pauseCast()
(when casting), but it'd be a better choice to use SambaPlayer.pause()
because, before pausing cast, it dispatches the PAUSE
event and also stops the progress event timer (to stop seekbar update on local player).
I just didn't get very well this Notification approach you're using to get this done. Could you please provide more context?
By the way, are you trying to pause a media that is casting or the Chromecast session?
PS: A propósito, podemos falar em Português se preferir. :)
Oh, I got it. But I tried use SambaPlayer.pause()
, but didn't work.
I'm trying pause the media that is casting.
I want implement this:
I play a video and connect with a Chromecast device;
When I exit of the screen of the player in the device, a notification appears with three actions. Like:
The notification control the SambaPlayer with a Service and when the user clicked in:
PS: ah sim, obrigado. Mas acho que o português pode não ser a língua do próximo a ter esse problema e ler essa Issue, correto? E aproveitando, desculpe pelo meu inglês que não é muito bom
Now I see, the point is that when you exit the activity containing the player instance, it'll get destroyed and won't respond anymore.
So in your case it does make sense calling SambaCast.pauseCast()
. It should work.
I'll try some debugging here on my side and get back to you as soon as I have some news.
PS: Não esquenta, sem erro! ;)
I followed the tutorial to set the SambaCast in the player and I can see the casting working perfectly.
When I use sambaCast.stop() method the casting stops. But sambaCast.pauseCast() and sambaCast.playCast() aren't working. My goal is use this method in a notification media controller, but this doesn't work, even if I try: