go-chromecast icon indicating copy to clipboard operation
go-chromecast copied to clipboard

PLUTO.TV

Open juliodiz opened this issue 4 years ago • 21 comments

Hey

Its possible to send PlutoTV ?

https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=&appName=&appVersion=unknown&architecture=&buildVersion=&clientTime=&deviceDNT=web&deviceId=unknown&deviceLat=-22.9201&deviceLon=-43.3307&deviceMake=chromecast&deviceModel=chromecast&deviceType=chromecast&deviceVersion=unknown&includeExtendedEvents=false&marketingRegion=BR&sid=chromecast&userId=chromecast

juliodiz avatar Jan 08 '21 23:01 juliodiz

What is PlutoTV? I looked at their website but couldn't tell. Did you want to cast PlutoTV to the chromecast? Or something else?

vishen avatar Jan 08 '21 23:01 vishen

Hey! Channels IPTV They have this API and want to casting to my chromecast

https://api.pluto.tv/v2/channels.json?%s

juliodiz avatar Jan 09 '21 00:01 juliodiz

I run using -v

DEBU[0000] (1)sender-0 -> receiver-0 [urn:x-cast:com.google.cast.tp.connection]: {"type":"CONNECT","requestId":1} package=cast DEBU[0000] (2)sender-0 -> receiver-0 [urn:x-cast:com.google.cast.receiver]: {"type":"GET_STATUS","requestId":2} package=cast DEBU[0000] (2)sender-0 <- receiver-0 [urn:x-cast:com.google.cast.receiver]: {"requestId":2,"status":{"applications":[{"appId":"CC1AD845","appType":"WEB","displayName":"Default Media Receiver","iconUrl":"","isIdleScreen":false,"launchedFromCloud":false,"namespaces":[{"name":"urn:x-cast:com.google.cast.cac"},{"name":"urn:x-cast:com.google.cast.debugoverlay"},{"name":"urn:x-cast:com.google.cast.broadcast"},{"name":"urn:x-cast:com.google.cast.media"}],"sessionId":"61eb4110-7b4b-4b8b-8890-1f94ecabe37e","statusText":"Default Media Receiver","transportId":"61eb4110-7b4b-4b8b-8890-1f94ecabe37e","universalAppId":"CC1AD845"}],"userEq":{},"volume":{"controlType":"master","level":0.25999999046325684,"muted":false,"stepInterval":0.009999999776482582}},"type":"RECEIVER_STATUS"} package=cast DEBU[0000] (3)sender-0 -> 61eb4110-7b4b-4b8b-8890-1f94ecabe37e [urn:x-cast:com.google.cast.tp.connection]: {"type":"CONNECT","requestId":3} package=cast DEBU[0000] (4)sender-0 -> 61eb4110-7b4b-4b8b-8890-1f94ecabe37e [urn:x-cast:com.google.cast.media]: {"type":"GET_STATUS","requestId":4} package=cast DEBU[0000] (4)sender-0 <- 61eb4110-7b4b-4b8b-8890-1f94ecabe37e [urn:x-cast:com.google.cast.media]: {"type":"MEDIA_STATUS","status":[],"requestId":4} package=cast DEBU[0000] (5)sender-0 -> 61eb4110-7b4b-4b8b-8890-1f94ecabe37e [urn:x-cast:com.google.cast.media]: {"type":"LOAD","requestId":5,"media":{"contentId":"https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=\u0026appName=\u0026appVersion=unknown\u0026architecture=\u0026buildVersion=\u0026clientTime=\u0026deviceDNT=web\u0026deviceId=unknown\u0026deviceLat=-22.9201\u0026deviceLon=-43.3307\u0026deviceMake=chromecast\u0026deviceModel=chromecast\u0026deviceType=chromecast\u0026deviceVersion=unknown\u0026includeExtendedEvents=false\u0026marketingRegion=BR\u0026sid=chromecast\u0026userId=chromecast","contentType":"application/x-mpegurl; charset=utf-8","streamType":"BUFFERED","duration":0,"metadata":{"MetadataType":0,"artist":"","title":"","subtitle":"","images":null,"releaseDate":""}},"currentTime":0,"autoplay":true,"queueData":{"startIndex":0},"customData":null} package=cast DEBU[0000] (-1)* <- 61eb4110-7b4b-4b8b-8890-1f94ecabe37e [urn:x-cast:com.google.cast.media]: {"type":"MEDIA_STATUS","status":[{"mediaSessionId":2,"playbackRate":1,"playerState":"IDLE","currentTime":0,"supportedMediaCommands":274447,"volume":{"level":1,"muted":false},"media":{"contentId":"https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=&appName=&appVersion=unknown&architecture=&buildVersion=&clientTime=&deviceDNT=web&deviceId=unknown&deviceLat=-22.9201&deviceLon=-43.3307&deviceMake=chromecast&deviceModel=chromecast&deviceType=chromecast&deviceVersion=unknown&includeExtendedEvents=false&marketingRegion=BR&sid=chromecast&userId=chromecast","contentType":"application/x-mpegurl; charset=utf-8","streamType":"BUFFERED","duration":0,"metadata":{"MetadataType":0,"artist":"","title":"","subtitle":"","releaseDate":""}},"queueData":{"startIndex":0},"currentItemId":1,"extendedStatus":{"playerState":"LOADING","media":{"contentId":"https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=&appName=&appVersion=unknown&architecture=&buildVersion=&clientTime=&deviceDNT=web&deviceId=unknown&deviceLat=-22.9201&deviceLon=-43.3307&deviceMake=chromecast&deviceModel=chromecast&deviceType=chromecast&deviceVersion=unknown&includeExtendedEvents=false&marketingRegion=BR&sid=chromecast&userId=chromecast","contentType":"application/x-mpegurl; charset=utf-8","streamType":"BUFFERED","duration":0,"metadata":{"MetadataType":0,"artist":"","title":"","subtitle":"","releaseDate":""}},"mediaSessionId":2},"repeatMode":"REPEAT_OFF"}],"requestId":0} package=cast DEBU[0001] (-1)* <- 61eb4110-7b4b-4b8b-8890-1f94ecabe37e [urn:x-cast:com.google.cast.media]: {"type":"MEDIA_STATUS","status":[{"mediaSessionId":2,"playbackRate":1,"playerState":"BUFFERING","currentTime":0,"supportedMediaCommands":274447,"volume":{"level":1,"muted":false},"currentItemId":1,"repeatMode":"REPEAT_OFF"}],"requestId":0} package=cast DEBU[0003] (5)sender-0 <- 61eb4110-7b4b-4b8b-8890-1f94ecabe37e [urn:x-cast:com.google.cast.media]: {"requestId":5,"type":"LOAD_FAILED","detailedErrorCode":311,"itemId":1} package=cast

juliodiz avatar Jan 09 '21 01:01 juliodiz

Thanks! I think it should be possible, you can try loading that URL directly and see if that works?:

$ go-chromecast load "https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=&appName=&appVersion=unknown&architecture=&buildVersion=&clientTime=&deviceDNT=web&deviceId=unknown&deviceLat=-22.9201&deviceLon=-43.3307&deviceMake=chromecast&deviceModel=chromecast&deviceType=chromecast&deviceVersion=unknown&includeExtendedEvents=false&marketingRegion=BR&sid=chromecast&userId=chromecast"

If that does work then it should be possible to play any PlutoTV movies on the chromecast.

vishen avatar Jan 10 '21 18:01 vishen

Hey!

unable to load media: unable to change to default media receiver: context deadline exceeded

And don't play , just show icon for cast.

juliodiz avatar Jan 11 '21 01:01 juliodiz

DEBU[0002] (5)sender-0 <- 9b5cc6e5-885e-441f-a3ed-f6bfcc554b18 [urn:x-cast:com.google.cast.media]: {"requestId":5,"type":"LOAD_FAILED","detailedErrorCode":311,"itemId":1} package=cast

juliodiz avatar Jan 11 '21 01:01 juliodiz

Ah, my apologies, I need to make it so you can specify the chromecast app as well, I didn't think of that initially. Let me push out a change today for this and this should allow you to specify the PlutoTV chromecast app in order to test this out.

vishen avatar Jan 11 '21 12:01 vishen

Ah, my apologies, I need to make it so you can specify the chromecast app as well, I didn't think of that initially. Let me push out a change today for this and this should allow you to specify the PlutoTV chromecast app in order to test this out.

Perfetct! Thanks!

juliodiz avatar Jan 11 '21 14:01 juliodiz

Hey! This change will work example for directvgo?

https://www.directvgo.com/player/station/ https://www.bitmovin.com/

juliodiz avatar Jan 11 '21 21:01 juliodiz

Apologies for the delay in all of this. In the latest master there is a new command load-app, this should allow you to change the chromecast app and specify a content id for it to load. I don't have a good way to test this, so I am hoping it works.

You should be able to try the following, but you will need to find the pluto.tv chromecast app id:

$ go-chromecast load-app <app_id>  "https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=&appName=&appVersion=unknown&architecture=&buildVersion=&clientTime=&deviceDNT=web&deviceId=unknown&deviceLat=-22.9201&deviceLon=-43.3307&deviceMake=chromecast&deviceModel=chromecast&deviceType=chromecast&deviceVersion=unknown&includeExtendedEvents=false&marketingRegion=BR&sid=chromecast&userId=chromecast"

To get the pluto.tv chromecast app id, you will need to run a $ go-chromecast status --debug while pluto.tv is being casted to the chromecast, and it should be in the logs with "app_id":

vishen avatar Jan 31 '21 23:01 vishen

Thanks! How can I download this release?

juliodiz avatar Feb 02 '21 00:02 juliodiz

It’s possible to release new version?

juliodiz avatar Feb 09 '21 10:02 juliodiz

Apologies, I'll release a new version today.

vishen avatar Feb 09 '21 15:02 vishen

Released a new version https://github.com/vishen/go-chromecast/releases/tag/v0.2.9, I haven't been able to test it out though so let me know if it doesn't work!

vishen avatar Feb 09 '21 16:02 vishen

Hey! Its possible to load the app but not the video link: https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=&appName=&appVersion=unknown&architecture=&buildVersion=&clientTime=&deviceDNT=web&deviceId=unknown&deviceLat=-22.9201&deviceLon=-43.3307&deviceMake=chromecast&deviceModel=chromecast&deviceType=chromecast&deviceVersion=unknown&includeExtendedEvents=false&marketingRegion=BR&sid=chromecast&userId=chromecast

DEBU[0000] (1)sender-0 -> receiver-0 [urn:x-cast:com.google.cast.tp.connection]: {"type":"CONNECT","requestId":1} package=cast DEBU[0000] (2)sender-0 -> receiver-0 [urn:x-cast:com.google.cast.receiver]: {"type":"GET_STATUS","requestId":2} package=cast DEBU[0000] (2)sender-0 <- receiver-0 [urn:x-cast:com.google.cast.receiver]: {"requestId":2,"status":{"applications":[{"appId":"E6F74C01","appType":"WEB","displayName":"Pluto TV","iconUrl":"https://lh3.googleusercontent.com/39uezv_El6yXTR-2H9B31VTWOVv4Ys7bK9uxsJEBf7AlAoG1t3TrVVRs8OCAMjPJsOarX0q3ROVtzP-4","isIdleScreen":false,"launchedFromCloud":false,"namespaces":[{"name":"urn:x-cast:com.google.cast.cac"},{"name":"urn:x-cast:com.google.cast.debugoverlay"},{"name":"urn:x-cast:tv.pluto"},{"name":"urn:x-cast:com.google.cast.broadcast"},{"name":"urn:x-cast:com.google.cast.media"}],"sessionId":"fda2a0fe-38ae-4ec3-84d3-9cda7a2be7d7","statusText":"Playing Pluto TV","transportId":"fda2a0fe-38ae-4ec3-84d3-9cda7a2be7d7","universalAppId":"E6F74C01"}],"userEq":{},"volume":{"controlType":"master","level":0.0,"muted":false,"stepInterval":0.009999999776482582}},"type":"RECEIVER_STATUS"} package=cast DEBU[0000] (3)sender-0 -> fda2a0fe-38ae-4ec3-84d3-9cda7a2be7d7 [urn:x-cast:com.google.cast.tp.connection]: {"type":"CONNECT","requestId":3} package=cast DEBU[0000] (4)sender-0 -> fda2a0fe-38ae-4ec3-84d3-9cda7a2be7d7 [urn:x-cast:com.google.cast.media]: {"type":"GET_STATUS","requestId":4} package=cast DEBU[0000] (-1)* <- fda2a0fe-38ae-4ec3-84d3-9cda7a2be7d7 [urn:x-cast:tv.pluto]: "{"command":"status","data":{"deckProgress":11236.181999999999,"deckProgressWithoutAds":11236.181999999999,"start":"2021-02-15T22:44:59.949Z","playerState":"playing"}}" package=cast DEBU[0000] failed to unmarshal proto message header: json: cannot unmarshal string into Go value of type cast.PayloadHeader package=cast DEBU[0000] (4)sender-0 <- fda2a0fe-38ae-4ec3-84d3-9cda7a2be7d7 [urn:x-cast:com.google.cast.media]: {"type":"MEDIA_STATUS","status":[{"mediaSessionId":1,"playbackRate":1,"playerState":"PLAYING","currentTime":11.300913,"supportedMediaCommands":274447,"volume":{"level":1,"muted":false},"videoInfo":{"width":1280,"height":720,"hdrType":"sdr"},"activeTrackIds":[1],"media":{"contentId":"https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=&appName=&appVersion=unknown&architecture=&buildVersion=&clientTime=&deviceDNT=web&deviceId=unknown&deviceLat=-22.9201&deviceLon=-43.3307&deviceMake=chromecast&deviceModel=chromecast&deviceType=chromecast&deviceVersion=unknown&includeExtendedEvents=false&marketingRegion=BR&sid=chromecast&userId=chromecast","contentType":"application/x-mpegurl","streamType":"BUFFERED","duration":-1,"metadata":{"MetadataType":0,"artist":"","title":"","subtitle":"","releaseDate":""},"tracks":[{"trackId":1,"trackContentType":"video/mp2t","type":"VIDEO"},{"trackId":2,"trackContentType":"text/vtt","type":"TEXT","name":"Portuguese","language":"pt","forced":false}],"breakClips":[],"breaks":[]},"queueData":{"startIndex":0},"currentItemId":1,"items":[{"itemId":1,"media":{"contentId":"https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5f120e94a5714d00074576a1/master.m3u8?advertisingId=&appName=&appVersion=unknown&architecture=&buildVersion=&clientTime=&deviceDNT=web&deviceId=unknown&deviceLat=-22.9201&deviceLon=-43.3307&deviceMake=chromecast&deviceModel=chromecast&deviceType=chromecast&deviceVersion=unknown&includeExtendedEvents=false&marketingRegion=BR&sid=chromecast&userId=chromecast","contentType":"","streamType":"BUFFERED","duration":-1,"metadata":{"MetadataType":0,"artist":"","title":"","subtitle":"","releaseDate":""}},"autoplay":true,"orderId":0}],"repeatMode":"REPEAT_OFF","liveSeekableRange":{"start":15,"end":20,"isMovingWindow":true,"isLiveDone":false}}],"requestId":4} package=cast Pluto TV (PLAYING), unknown, time remaining=11s/-1s, volume=0.00, muted=false

juliodiz avatar Feb 15 '21 22:02 juliodiz

unable to load media: unable to change chromecast app: unable to change to appID "E6F74C01": context deadline exceeded

juliodiz avatar Feb 15 '21 22:02 juliodiz

Debug running the pluto.tv

go-chromecast status --debug -a 10.125.122.47 DEBU[0000] (1)sender-0 -> receiver-0 [urn:x-cast:com.google.cast.tp.connection]: {"type":"CONNECT","requestId":1} package=cast DEBU[0000] (2)sender-0 -> receiver-0 [urn:x-cast:com.google.cast.receiver]: {"type":"GET_STATUS","requestId":2} package=cast DEBU[0000] (2)sender-0 <- receiver-0 [urn:x-cast:com.google.cast.receiver]: {"requestId":2,"status":{"applications":[{"appId":"E6F74C01","appType":"WEB","displayName":"Pluto TV","iconUrl":"https://lh3.googleusercontent.com/39uezv_El6yXTR-2H9B31VTWOVv4Ys7bK9uxsJEBf7AlAoG1t3TrVVRs8OCAMjPJsOarX0q3ROVtzP-4","isIdleScreen":false,"launchedFromCloud":false,"namespaces":[{"name":"urn:x-cast:com.google.cast.cac"},{"name":"urn:x-cast:com.google.cast.debugoverlay"},{"name":"urn:x-cast:tv.pluto"},{"name":"urn:x-cast:com.google.cast.broadcast"},{"name":"urn:x-cast:com.google.cast.media"}],"sessionId":"67365101-13ed-445e-94dc-df764849bde7","statusText":"Playing Pluto TV","transportId":"67365101-13ed-445e-94dc-df764849bde7","universalAppId":"E6F74C01"}],"userEq":{},"volume":{"controlType":"master","level":0.0,"muted":false,"stepInterval":0.009999999776482582}},"type":"RECEIVER_STATUS"} package=cast DEBU[0000] (3)sender-0 -> 67365101-13ed-445e-94dc-df764849bde7 [urn:x-cast:com.google.cast.tp.connection]: {"type":"CONNECT","requestId":3} package=cast DEBU[0000] (4)sender-0 -> 67365101-13ed-445e-94dc-df764849bde7 [urn:x-cast:com.google.cast.media]: {"type":"GET_STATUS","requestId":4} package=cast DEBU[0000] (-1)* <- 67365101-13ed-445e-94dc-df764849bde7 [urn:x-cast:tv.pluto]: "{"command":"status","data":{"deckProgress":3486.793,"deckProgressWithoutAds":3486.793,"start":"2021-02-15T22:47:00.000Z","channel":"5f171d3442a0500007362f22","categoryId":"tv.pluto.library.guidecore.featured","timeline":"601c72a989a57f0007cf06a3","episode":"5fff4d7e6d0bea001b05b800","clip":"5fff4d7d6d0bea001b05b7fc","playerState":"playing","isVod":false}}" package=cast DEBU[0000] failed to unmarshal proto message header: json: cannot unmarshal string into Go value of type cast.PayloadHeader package=cast DEBU[0000] (4)sender-0 <- 67365101-13ed-445e-94dc-df764849bde7 [urn:x-cast:com.google.cast.media]: {"type":"MEDIA_STATUS","status":[],"requestId":4} package=cast

juliodiz avatar Feb 15 '21 22:02 juliodiz

Its possible to debug to find how I can send to chromecast?

juliodiz avatar Feb 18 '21 19:02 juliodiz

Its possible to load the app but not the video link

Not officially, but you should be able to do $ go-chromecast load-app E6F74C01 localhost and that should force the chromecast app to change.

Thanks for the debug output :) It looks like PlutoTV is sending back an unexpected payload. There seems to be a standard format most chromecast applications respond in, but PlutoTV is using a different format for whatever reason. I am not too familiar with how the exchange of request/response definitions happen. This is the response PlutoTV is responding with:

 {"command":"status","data":{"deckProgress":3486.793,"deckProgressWithoutAds":3486.793,"start":"2021-02-15T22:47:00.000Z","channel":"5f171d3442a0500007362f22","categoryId":"tv.pluto.library.guidecore.featured","timeline":"601c72a989a57f0007cf06a3","episode":"5fff4d7e6d0bea001b05b800","clip":"5fff4d7d6d0bea001b05b7fc","playerState":"playing","isVod":false}}

but go-chromecast can't parse the response and errors out:

DEBU[0000] failed to unmarshal proto message header: json: cannot unmarshal string into Go value of type cast.PayloadHeader package=cast

It is failing because of https://github.com/vishen/go-chromecast/blob/master/cast/connection.go#L182 which expects the response format to be https://github.com/vishen/go-chromecast/blob/master/cast/payload.go#L24-L27

We would need to change how we handle and parse messages from the chromecast, and do something in the case where the message isn't one we expect. This may also cause other issues since we require "requestId" to tie requests and responses together.

vishen avatar Feb 19 '21 16:02 vishen

So its not possible? =(

I saw KODI has Add-on for Pluto

https://github.com/Lunatixz/KODI_Addons/blob/master/plugin.video.plutotv/resources/lib/plutotv.py

juliodiz avatar Feb 21 '21 13:02 juliodiz

So its not possible?

Not at the moment until we go and fix the code, it looks like we may need to write a custom message format just for Pluto. Feel free to send a PR if you want to take a look at this :)

vishen avatar Feb 21 '21 13:02 vishen