d8ahazard / Cast.bundle

A Plex Channel To Interact With Local Cast Devices, Via Plex Media Server
59 stars 11 forks source link

Chromecast won't play #7

Closed Christilut closed 5 years ago

Christilut commented 6 years ago

Hey, this plugin is a great idea. Exactly solved the problem I obviously ran into when making a project.

So I got it to mostly work, device scan and all that works. But I'm trying to use the /play endpoint working but my Chromecast says "Sorry! Something went wrong" every time.

I've dived into the code and compared my request payload with a working prototype and they are pretty much identical. So I'm not sure what could be causing this right now.

I'm not finding anything relevant in the Plex logs either. I'd except some kind of error or maybe access denied or something there but nothing.

Any ideas?

d8ahazard commented 6 years ago

What are you trying to play? If you look at the play end point, you'll see the required headers for triggering Plex playback. There's a play audio endpoint as well for sending generic media, but it's not quite as polished as the Plex play endpoint.

On Mon, Apr 9, 2018, 1:36 PM Christiaan Maks notifications@github.com wrote:

Hey, this plugin is a great idea. Exactly solved the problem I obviously ran into when making a project.

So I got it to mostly work, device scan and all that works. But I'm trying to use the /play endpoint working but my Chromecast says "Sorry! Something went wrong" every time.

I've dived into the code and compared my request payload with a working prototype and they are pretty much identical. So I'm not sure what could be causing this right now.

I'm not finding anything relevant in the Plex logs either. I'd except some kind of error or maybe access denied or something there but nothing.

Any ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/d8ahazard/Cast.bundle/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjuNJ5imva2wlC7ESNBB8CwIQTBXJ1iks5tm6oxgaJpZM4TNBMJ .

Christilut commented 6 years ago

I'm trying to play a movie. I'm using the same key as with my prototype project (nodejs with castv2-plex).

I've added all the headers and I've checked the code to see if I'm doing anything wrong but as far as I can tell it seems to be in order.

Here is my request:

GET /chromecast/play HTTP/1.1

X-Plex-Token: <token>
Contenttype: video
Serverid: 41c79cf58215a5d5ee810ae3f9595ee3fc6ce580
Contentid: /library/metadata/2445
Username: username
Clienturi: 192.168.1.24:8009
Requestid: 1
Transienttoken: <same as x-plex-token>
Queueid: 0
d8ahazard commented 6 years ago

Transienttoken and queueid need to be requested from the server with the cast plugin. You can sniff a request from the Plex web app to get the format of these requests. Chrome Dev tools is how I sorted it out in the first place. 😆

On Mon, Apr 9, 2018, 2:00 PM Christiaan Maks notifications@github.com wrote:

I'm trying to play a movie. I'm using the same key as with my prototype project (nodejs with castv2-plex).

I've added all the headers and I've checked the code to see if I'm doing anything wrong but as far as I can tell it seems to be in order.

Here is my request:

GET /chromecast/play HTTP/1.1 Host: 192.168.1.5:32400 X-Plex-Token: Contenttype: video Serverid: 41c79cf58215a5d5ee810ae3f9595ee3fc6ce580 Contentid: /library/metadata/2445 Username: username Clienturi: 192.168.1.24:8009 Requestid: 1 Transienttoken: Queueid: 0

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/d8ahazard/Cast.bundle/issues/7#issuecomment-379858531, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjuNDGo6nX8vEc9sWEUJGoeZnbWCBo3ks5tm6_ggaJpZM4TNBMJ .

Christilut commented 6 years ago

Hmm I thought transienttoken is only required for streaming from another owners' plex. That's why the x-plex-token and transienttoken is the same for me. So I guess that token isn't the problem.

And in the working prototype there is no queueId, so I guess that one isn't required either.

Not sure what's happening here :confused:

d8ahazard commented 6 years ago

It's written to always request the transient and queue. Not sure if required, but every cast session I sniffed worked that way, regardless of server. I'm open to re writing if that's not the case... But from the request you posted, that's what's missing. Server token is for other internal Plex requests.

On Mon, Apr 9, 2018, 2:19 PM Christiaan Maks notifications@github.com wrote:

Hmm I thought transienttoken is only required for streaming from another owners' plex. That's why the x-plex-token and transienttoken is the same for me. So I guess that token isn't the problem.

And in the working prototype there is no queueId, so I guess that one isn't required either.

Not sure what's happening here 😕

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/d8ahazard/Cast.bundle/issues/7#issuecomment-379863671, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjuNFODdOeNyvqeRtP-iKWvJeRXvMOQks5tm7QygaJpZM4TNBMJ .

Christilut commented 6 years ago

Okay, I'll check it out some more.

Shouldn't there be some kind of auth error in the plex logs if the token is wrong or missing?

d8ahazard commented 6 years ago

I'd take a look at the plugin logs for Cast.bundle, if you're missing headers or it gets an error, it should log it there.

On Mon, Apr 9, 2018, 2:23 PM Christiaan Maks notifications@github.com wrote:

Okay, I'll check it out some more.

Shouldn't there be some kind of auth error in the plex logs if the token is wrong or missing?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/d8ahazard/Cast.bundle/issues/7#issuecomment-379864701, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjuNDj6iT31ZOR_OlSKTOnW9IPSg6FNks5tm7UYgaJpZM4TNBMJ .

Christilut commented 6 years ago

Yeah I combed through those a lot. That's where I took the logged payload from and compared it with the working prototype. Didn't see anything strange there

d8ahazard commented 5 years ago

Please check out https://github.com/FlexTV.bundle for the latest iteration of the plugin.

Also, there's an experimental stand-alone app for homes without a PMS server, but you want to control cast devices at https://github.com/d8ahazard/FlexConnect - and docker - https://github.com/d8ahazard/docker-FlexConnect

If you have issues, feel free to report them there!