philippe44 / LMS-Cast

Chromecast to LMS bridge
64 stars 10 forks source link

Status of castDevice after pausing a media from LMS #33

Closed coxifred closed 8 months ago

coxifred commented 9 months ago

Hi Phil,

Thanks for your plugin, very usefull !

Here is my problem:

{
    "appId": "46C1A819",
    "appType": "WEB",
    "displayName": "Receiver for AirConnect & CastBridge",
    "iconUrl": "***************",
    "isIdleScreen": false,
    "launchedFromCloud": false,
    "namespaces": [
        {
            "name": "urn:x-cast:com.google.cast.debugoverlay"
        },
        {
            "name": "urn:x-cast:com.google.cast.cac"
        },
        {
            "name": "urn:x-cast:com.google.cast.media"
        }
    ],
    "sessionId": "f739efaa-bfde-4caa-8457-9b6a18724a74",
    "statusText": "Diffusion: Marooned",
    "transportId": "f739efaa-bfde-4caa-8457-9b6a18724a74",
    "universalAppId": "46C1A819"
}

The song is paused (from LMS view), but you can see that the statusText is still displaying Diffusion: Marooned (Pink floyd ;) ) I was expected to have the default status when nothing is played:

{
"statusText" : "Receiver for AirConnect & CastBridge"
}

The only way to get this default status is to restart the plugin. I've take a look into your code, it seems that the connection stays until disconnect call is done (ping failure,...).

Do you think it's possible (perhaps in the tuning ?) to update the googleCastDevice status (Pause, Casting...), or session timeout ? If not, i'll understand.

Why am i asking that ?

A domotic use case: Not sending a notification on the googleCastDevice when its status looks playing something (from LMS, YT or other stuff), so i need to retrieve the current status.

Thanks, and again congratulations for your work, i use it everyday ! Fred

philippe44 commented 9 months ago

I'm not sure but I think this is the CC device that is deciding its status: I do send it a pause command when you pause in on and it's probably that pausing is still considered "diffusion". When I query status directly using the raw protocol, it says paused. Maybe there is another query to be made using the api (I don't use it obviously). Otherwise, when you stop playback (empty the playlist in LMS) then after 30s I release the CC

coxifred commented 9 months ago

Thank you Phil, i'll have a look, and forcing a stop command. Perhaps the component (nodered googlecast) i use transforms the real status, i"ll have a look into the code.

Regards. Fred.