You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to detect that media has finished for CastPlayer? For Exoplayer there is state STATE_ENDED but CastPlayer goes into STATE_IDLE. The STATE_IDLE occurs when I connect to Chromecast device so I cannot use it as well.
The player is READY when I cast, when I stop casting and return to casting it goes to IDLE and then to READY so I would get the recognize it as complete then as well. Is that normal behaviour that it goes to IDLE during connecting to Chromecast or I messed up something?
Is that normal behaviour that it goes to IDLE during connecting to Chromecast or I messed up something?
It is normal. This has generated internal discussions, actually. When Cast ends playing a media queue, it empties it. In Player terms, this means the timeline gets emptied. Now, transitioning to ENDED state makes sense. It is documented as follows:
The player has finished playing the media.
However, transitioning to IDLE state also makes sense due to the behavior described above:
The player does not have any media to play.
This has put on the table the possibility of removing the ended state. For the time being, the discussion is in stand by.
when I stop casting
Do you mean the session ends? I don't fully understand your usecase, but tracking the session state + the player state does not solve your issue?
By stoping casting I mean tapping MediaRouteButton and tap the button "Stop Casting". The CastPlayer is in the READY state and when I want to reconnect to Chromecast by tapping MediaRouteButton and selecting device I get IDLE (current state is still READY) and READY then.
With that information one could use getIdleReason(). That value would be one of IDLE_REASON_CANCELED, IDLE_REASON_ERROR, IDLE_REASON_FINISHED, IDLE_REASON_INTERRUPTED, or IDLE_REASON_NONE.
Activity
AquilesCanta commentedon Apr 16, 2018
Would it be not possible for you to track changes from READY to IDLE? Session state needs to be tracked separately, though.
mkaflowski commentedon Apr 16, 2018
The player is READY when I cast, when I stop casting and return to casting it goes to IDLE and then to READY so I would get the recognize it as complete then as well. Is that normal behaviour that it goes to IDLE during connecting to Chromecast or I messed up something?
AquilesCanta commentedon Apr 16, 2018
It is normal. This has generated internal discussions, actually. When Cast ends playing a media queue, it empties it. In Player terms, this means the timeline gets emptied. Now, transitioning to ENDED state makes sense. It is documented as follows:
The player has finished playing the media.However, transitioning to IDLE state also makes sense due to the behavior described above:
The player does not have any media to play.This has put on the table the possibility of removing the ended state. For the time being, the discussion is in stand by.
Do you mean the session ends? I don't fully understand your usecase, but tracking the session state + the player state does not solve your issue?
mkaflowski commentedon Apr 16, 2018
By stoping casting I mean tapping MediaRouteButton and tap the button "Stop Casting". The CastPlayer is in the READY state and when I want to reconnect to Chromecast by tapping MediaRouteButton and selecting device I get IDLE (current state is still READY) and READY then.
[Edit] The use-case video: Video
deRonbrown commentedon Aug 29, 2018
Would it be possible to make
CastPlayer#getMediaStatus()public?With that information one could use getIdleReason(). That value would be one of
IDLE_REASON_CANCELED,IDLE_REASON_ERROR,IDLE_REASON_FINISHED,IDLE_REASON_INTERRUPTED, orIDLE_REASON_NONE.deRonbrown commentedon Aug 29, 2018
Actually, no need to make that method public. Just grab the
IDLE_REASONdirectly from theCastSession:meenukrishnamurthy commentedon Mar 4, 2019
Any update on this??
ojw28 commentedon Sep 14, 2019
Marking as a duplicate of #3969