-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Roku Media player does not stream to "Play On Roku" #83819
Comments
Hey there @ctalkington, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) roku documentation |
Found this issue because the "Play on Roku" app described in the documentation isn't even listed in the app store anymore. Looks like Roku delisted apps that were using an older version of their SDK. There are a ton of other media player and cast apps, including "PlayOn Cloud Cast", but not sure if any are compatible with the current HA integration. |
Having the exact same problem. When starting to play the same URL through the Roku app on Android, the media player in HA recognizes that stream and allows me further control like pause, resume, volume control, etc. But starting a stream from the media player in HA shows the described issue. |
It appears that Roku disabled Play On Roku. Read about if from a Roku employee here |
thanks for the information. I will have to see if we can pivot to using an already established channel for such. |
In that linked thread two comments above there is a comment about Tubio which is a combination of a Roku app and an Android app. I tried that, it works really nice and lets me stream any video or audio to the Roku device. Of course, I don't want to promote that solution, I'd rather hope to get something similar in HA/MA. That would be the ultimate solution to me. |
As mentioned in https://community.roku.com/t5/Solving-playback-issues/OS-11-5-Roku-11-5-broke-Play-on-Roku-video-playback/m-p/827826/highlight/true#M44919, Roku decided to lock down access to the Play on Roku channel / ECP endpoint as of version 11.5 (released Fall 2022). This was used by the HA integration to play Audio, Video, & URL sources (see https://github.com/home-assistant/core/blob/dev/homeassistant/components/roku/media_player.py#L454), specifically through the python-rokuecp wrapper library (see https://github.com/ctalkington/python-rokuecp/blob/0adea4c21a90a8deded3c12264b13460faeb412e/src/rokuecp/rokuecp.py#L266-L285). Some comments on the Roku forum thread mention that casting on various apps (Web Video Caster, Tubio) works when using the newer "Roku Channel protocol", but as far as I can tell there's nothing about the "The Roku Channel" Roku channel, as included on Roku devices, that handles casting and that terminology instead must refer to the relevant third party app's dedicated Roku channels (Web Video Caster & Tubio). From looking at the Roku Developer docs on the available ECP commands I'm not seeing any commands that would allow for casting media to Roku devices, which as far as I can tell leaves the HA integration with the following options:
@ctalkington do you have any thoughts on the above or ideas for alternative integrations that I could utilize that would allow me to accomplish the same desired end result of sending media content from HA to my Roku TV? |
so the issue with HA or community registered app is the process to get such approved by Roku. They are unlikely to allow something that's only purpose is to bypass a security change they made so the app would need to provide some other functionality and implement deep linking of media as a feature. I had started a discussion about such a community venture of getting https://github.com/lvcabral/ha-roku-cast-app as an official app but it would take a large effort so sideloading and supporting custom app id for deep linking in HA integration would likely be easier to achieve. but this was during the holidays and my personal availability has been low since. I'll try to get to the rokuecp and HA updates in the next few weeks. |
DIAL would just launch the roku app with params, doesn't do anything ECP can't in that regard. It's a semi-abandoned protocol with Google cast specs these days. I really have liked rokus and own one in every room and even do this HA development but they are pivoting their model and are less friendly to integrate with compared to a few years back. I really wonder how long ECP will last before it's security concern |
I'm completely new to HA and today I personally wasted many hours trying to pass a video stream to my Roku from HA before I stumbled across the posting in the Roku forums about the "Play On Roku" being depreciated. What needs to happen to fix the HA documentation to note the broken features that occurred back in November of 2022? Is sideloading Roku Home Assistant Cast App https://github.com/lvcabral/ha-roku-cast-app a viable workaround? At first glance it appears to depend on the now broken method for passing media to roku. |
Do we have a solution to casting on Roku's yet? Apparently there is a way via. casting through the Roku Channel app. I wonder if we can integrate that into HA? |
Do you have more specific information than that? |
@LukeTowers I haven't had a chance to look into it further, but am hoping to over the weekend here. P.S. I just realized we're in the same province. 😂 |
@LegendaryFire nice man, shoot me an email if you're ever in Regina and we can go grab a coffee or lunch or something 😄 |
I just spent a few hours trying to stream my camera to Roku with this integration. I thought I was doing something wrong until I read these notes about Roku locking down this feature. Is there a workarounf for this? If not, can you remove that feature from the integration or place a note in the in the integration to let users know that streaming may not work? Thanks |
Any workaround? I would love for this to work. |
I still need to review how Roku blocked this functionality and see if I can workaround their changes. I really want to avoid having to maintain a Channel or rely on some 3rd party Channel which I haven't found documentation openly available for. |
I did a capture of the android app talking to my Roku Ultra. It uses a protocol it says However, upon connecting the roku device sends a challenge with a nonce, and the app responds with a sha1 of the concatenation of the nonce and a hard coded uuid. The hard coded uuid is Example exchange:
Turning on my tv via roku: {"request":"key-press","request-id":"6","param-key":"Power"}
{"response":"key-press","response-id":"6","status":"200","status-msg":"OK"} Streaming a video from my phone: {"request":"input","request-id":"8","param-params":"{\"a\":\"sta\",\"t\":\"v\",\"u\":\"http:\\\/\\\/192.168.1.160:5150\\\/VIDEO%2Fm_0.m3u8\",\"framerate\":\"30\",\"h\":\"192.168.1.160:5150\",\"videoname\":\"20231104_111237\",\"k\":\"http:\\\/\\\/192.168.1.160:5150\\\/%2FVIDEO_THUMB%2F17870\",\"videoformat\":\"hls\",\"videoresolution\":\"1080\"}","param-channel-id":"15985"} Proof of concept nodejs code: index.mjs: import WebSocket from 'ws';
import crypto from 'crypto';
const key = 'F3A278B8-1C6F-44A9-9D89-F1979CA4C6F1';
const host = process.argv[2];
console.log('connecting to ', host);
const ws = new WebSocket(`ws://${host}:8060/ecp-session`, 'ecp-2');
ws.on('error', console.error);
ws.on('open', function open() {
console.log('opened!');
});
ws.on('close', function () {
console.log('closed!');
});
const dummy_video = {"a":"sta","t":"v","u":"http://192.168.1.160:5150/VIDEO%2Fm_0.m3u8","framerate":"30","h":"192.168.1.160:5150","videoname":"20231104_111237","k":"http://192.168.1.160:5150/%2FVIDEO_THUMB%2F17870","videoformat":"hls","videoresolution":"1080"};
let request_counter = 0;
ws.on('message', function message(data) {
console.log('received: %s', data);
const msg = JSON.parse(data);
if (msg.notify === 'authenticate') {
const hasher = crypto.createHash('sha1');
hasher.update(msg['param-challenge'] + key);
const response = {
"param-response": hasher.digest('base64'),
"request": "authenticate",
'request-id': (request_counter++).toString()
};
console.log(JSON.stringify(response));
ws.send(JSON.stringify(response));
}
if (msg.response === 'authenticate') {
if (msg.status !== '200') throw new Error('failed to authenticate!');
ws.send(JSON.stringify({
"request": "input",
"request-id": (request_counter++).toString(),
"param-params": JSON.stringify(dummy_video),
"param-channel-id":"15985"
}));
}
}); The package.json: {
"name": "roku-play-stream",
"version": "1.0.0",
"main": "index.mjs",
"license": "MIT",
"dependencies": {
"ws": "^8.14.2"
}
} Usage: Hope this helps! |
BTW, I was surprised I couldn't find any references to Even stranger, searching for the hard coded uuid, I do find exactly one hit. Looks like someone else implementing the same algorithm, but for Arduino? |
@attain-squiggly-zeppelin nice I'll see about adapting the node code over the upcoming holiday breaks |
@ctalkington any update on this? I don't have time right now, but maybe in a couple of weeks I can give it a try, if you won't be able to get to it any time soon. (And if you'll at least have time to review PRs.) |
would love to get this working too. I want to stream my reolink doorbell to my TV when someone rings it. |
@attain-squiggly-zeppelin |
@attain-squiggly-zeppelin |
So bad news about this. It looks like |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
Issue still exists Mr. Bot, question is if @ctalkington has the bandwidth to take a look 😂 if not then it can probably be closed until someone with bandwidth and interest can get to it. |
Is there any update? |
Hi @ctalkington , https://github.com/MedievalApple/Media-Assistant |
That's amazing @MedievalApple! Really looking forward to seeing the integration updated to support that channel instead! |
@MedievalApple are you able to submit a PR to switch to using your channel instead so that it's easier for @ctalkington to review and merge it? |
@MedievalApple Would definitely like to contribute to your project once I get some more free time. |
I will review this and try to figure out the framework for this in the python library now that an option is published |
Thank You, If you have any questions about the app feel free to reach out |
I'm using the launch with roku store id with deeplink and getting inconsistent behavior on my Roku TV. I'm wondering if it was the media url I used or something with my dev instance. Doing some debugging this weekend. It seems the app doesn't launch at all and the one time it did, it was the landing page with no media playback |
That sounds like a issue with the formatting of the URL parameters in the deeplink if the Roku receives a URL with incorrectly formatted parameters to the /launch/[Channel Id] endpoint it will refuse to launch the app and if it does launch the app but you get the landing page that says Launch media using a deeplink that usually means the formatting is correct but either the parameters are missing from the deeplink request or the contentid/u parameter is missing or has an invalid url. Would it be possible for you to send a example of the request you were trying to sent to it? Ive also noticed that the examples in my documentation aren't currently working because the media source they use is from archive.org which is currently down Here's a python example that should be the minimum request required to launch media on the app if you want to try this to test Media Assistant I confirmed this example works with the store version of the app on my Roku Stick. import requests
rokuIP = 'InsertRokuIP'
channelID = '782875'
urlParams = {'u': 'https://incompetech.com/music/royalty-free/mp3-royaltyfree/Local%20Forecast%20-%20Elevator.mp3', 't': 'a'}
r = requests.post(f'http://{rokuIP}:8060/launch/{channelID}', params=urlParams, data ={}) |
I also tested the pull request: fix playing media via roku #128133 with Media Assistant by trying to play one of the Home Assistant radio browser streams and it seems to play fine. |
I think the issue was we didn't always send the |
The problem
When trying to stream content to Roku through the media player on HA, the Play on Roku app starts but exits immediately. In a packet capture, I see the correct HTTP request being sent to the Play on Roku app, however this request dies on the Roku side. This issue does not appear to be limited to the Home Assistant integration, as I have tried sending the POST directly from my local computer with the same result. I have tried connecting to Roku on port 8080 and 8085 but couldn't get any debugs logs or traces, which I believe is mostly due to my lack of knowledge about the Roku platform.
Also tried the chrome extension RokuKast which has the same problem even for videos from the internet, and reading the comment on the RokuKast repo it looks like the endpoint might have changed: dgreuel/RokuKast#38
Everything works OK when I use the custom component and the side-loaded app as outlined here, but it's missing some key features that I would like to use: https://github.com/lvcabral/ha-roku-media-player
I realise this might not be a true HA issue but I'm posting it here as this appears to be the most active community related to the topic. Would appreciate any help with this. Thank you!
What version of Home Assistant Core has the issue?
2022.11.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
roku
Link to integration documentation on our website
https://www.home-assistant.io/integrations/roku/
Diagnostics information
config_entry-roku-fe39abfab7f8393cc8cbd8d7209d4768.json.txt
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
Roku Software Version: 11.5.0 build 4235-88
This is the current format of the POST request in the packet capture and looks correct to me:
http://10.76.103.17:8060/input/15985?t=v&u=https%3A%2F%2Fhomeassistant.local.s1ngh.ca%2Fmedia%2Flocal%2FBigBuckBunny.mp4%3FauthSig%3DeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI5NWFkZmYzMjM3YWM0YjllODY5ZTJiNDc4NzIxMWZiOCIsInBhdGgiOiIvbWVkaWEvbG9jYWwvQmlnQnVja0J1bm55Lm1wNCIsInBhcmFtcyI6e30sImlhdCI6MTY3MDgzMzA2MiwiZXhwIjoxNjcwOTE5NDYyfQ.s2dDURHQMm3kTwbKCJaTPlnCbrS4IOeBsUm7sva31xg&videoName=media-source%3A%2F%2Fmedia_source%2Flocal%2FBigBuckBunny.mp4&videoFormat=mp4
The text was updated successfully, but these errors were encountered: