pranav-prakash / RokuCast

Cast videos from chrome to roku
180 stars 39 forks source link

Unable to cast to Roku #29

Closed crystal90 closed 6 years ago

crystal90 commented 6 years ago

Hi, recently I've been unable to cast videos to my roku device. The videos are titled html5 and are mp4. Do you have any ideas? I haven't had problems until a few months ago.

chrome version: Version 61.0.3163.100 (Official Build) (64-bit) roku: V 8.0.1 build 4018.29

Thanks for your help

pranav-prakash commented 6 years ago

Hm I'll take a look into it next week after finals are done.

Can you provide a link of one such video that failed to cast?

crystal90 commented 6 years ago

Here's the movie I'm trying to cast. I've tried several times and nothing happens. https://bmovies.se/film/the-void.02k9r

Thanks

pranav-prakash commented 6 years ago

I couldn't test on the MyCloud server since it failed to load at all, but using the OpenLoad server seemed to work fine for me.

Could you try switching to the OpenLoad server then casting and see if it works?

Also what specific error are you getting?

pranav-prakash commented 6 years ago

Found what might be the potential issue when I was trying to cast some of my own stuff. It appears the Roku doesn't support ipv6. Any server that's ipv6 only is hence unreachable from the roku.

nskmda commented 6 years ago

i have the same streaming issue. the channel starts (from Chrome's cast button), shows splash screen and then exits to Roku home screen.

looks like something changed in the Roku channel itself. because now the splash screen is different from what it was before.

can i get original Roku channel from somewhere to sideload to Roku and verify?

pranav-prakash commented 6 years ago

looks like something changed in the Roku channel itself.

Possibly, although it's more likely the server you're trying to stream content changed something (to either require a spoofed useragent/referrer, which I can implement in the master branch version of the code which has its own custom receiver app) or the server is ipv6 only (in which case nothing can be done since apparently Roku's network stack doesn't support ipv6 at all).

crystal90 commented 6 years ago

I can't use the Openload server at all. I don't receive a message, just nothing happens. The video plays on my netbook and the roku screen just doesn't react.

pranav-prakash commented 6 years ago

roku screen just doesn't react.

Hm well that's odd. Only thing I could think of is maybe try using the version in the master branch with the separate receiver app:

https://github.com/pranav-prakash/RokuCast/tree/master

[note that the chrome extension is also slightly different so you'll have to uninstall the one you have now and install the one from that branch]

If that doesn't work at least it provides the opportunity for better debugging [telnet into the roku in port 8085 to see the debugging output]

nskmda commented 6 years ago

it's more likely the server you're trying to stream content changed something

well, maybe. but i used to use a lot of different servers. for some casting worked, for others it didn't. i will double check tonight for the one I did use recently if it still works or not.

to either require a spoofed useragent/referrer, which I can implement in the master branch version of the code which has its own custom receiver app

u know what, I guess I will try to download/build/install from master to see what I get.

Just to confirm, does master have 2 compatible (with each other) applications (Chrome extension and Roku channel)?

pranav-prakash commented 6 years ago

Have 2 compatible (with each other) applications (Chrome extension and Roku channel)?

yes.

crystal90 commented 6 years ago

I'm confused. Do I need to install the Roku app? I didn't do that before.

nskmda commented 6 years ago

@crystal90 I believe you do need to have the RokuCast channel.

pranav-prakash commented 6 years ago

Yes, if you are using the one in the master branch

crystal90 commented 6 years ago

So, I followed instructions to enable developer mode on the roku, uploaded & installed the roku app. received the message; 'Application Received: Identical to previous version -- not replacing.'

I removed & installed the new chrome extension and still had the same problem. Rokucast just doesn't respond at all. I tried a different show & also the open server & still nothing.

pranav-prakash commented 6 years ago

Application Received: Identical to previous version -- not replacing

Can you see that the rokucast app was indeed installed on the Roku? You should be able to launch it manually.

Rokucast just doesn't respond at all.

If you installed both the roku application and the corresponding chrome extension properly, casting will at the very least show the rokucast receiver app being opened on the roku.

Are you sure you set the IP address right?

nskmda commented 6 years ago

Removed the private channel installed from Roku.com.

Installed chrome extension + receiver from master. When trying to cast from Chrome get an on-screen message 'playing on roku' and go to the home screen.

Removed both (chrome extension and Roku channel). Installed both from production. Now when trying to cast from Chrome (same web site, same video link) don't get any reaction from Roku channel at all.

Debug logs attached for both sessions. master-debug.txt

prod-debug.txt

P.S. Never mind the error from the loop in history screen in the prod. Looks like you a known(?) issue with empty cast history list.

pranav-prakash commented 6 years ago

@nskmda For the one installed from the master branch, when you cast you should get output like:

------ Running dev 'RokuCast' main ------
launch params: splashTime: 1600
source: external-control
version: 1
image: undefined
instant_on_run_mode: foreground

^ note the key being the "source: external-control" since we are launching the app via a POST request to the roku through the ECP protocol, passing in the url to play as a parameter. I don't see this in your output which is odd.

Also there shouldn't be any "playing on roku" message. Are you sure the chrome extension installed was the one from the master branch? If you look at the chrome extension source in background.js:26 you should see

var url = "http://" + ip + ":8060/launch/dev?version=1" + "&url="

Which launches the channel you uploaded to the roku.

And yes the error loop in the history screen is due to an empty history list which I'm too lazy to fix ¬_¬. That shouldn't affect anything.

crystal90 commented 6 years ago

'casting will at the very least show the rokucast receiver app being opened on the roku.' I assume you mean the screen that says 'view recent history'? Yes, it always opens.

"Are you sure you set the IP address right?" yes, I know which IP address to use.

pranav-prakash commented 6 years ago

@crystal90 Can you post the debug output like nskmda did? Telnet into your roku on port 8085 before casting and then paste the output here.

nskmda commented 6 years ago

@pranav-prakash looks like Git repo is messed up or something. when i clone from the repo link, i get different content than what I see in the browser here.

in the chrome ext code in the background.js I see

var url = "http://" + ip + ":8060/input/15985?t=v" + "&u=" + encodeURIComponent(xhr.responseURL) + "&videoName=" + encodeURIComponent(title) + "&k=(null)" + "&videoFormat=" + (isHLS ? "hls" : "mp4");

instead of what you say (and i see in the Github). and the line number for the above is 44, not 26.

may be the Roku channel code I get from the zipped master is also messed up.

i guess, i may need to try to cut-paste code from Github manually instead of downloading the zip/cloning the repo.

otherwise looks like i get the 'playonroku' branch'es code no matter what

nskmda commented 6 years ago

@pranav-prakash never mind, i figured how to clone master. trying shortly. will upload debugger log.

pranav-prakash commented 6 years ago

Note when using git clone you have to explicitly switch branch after cloning the repo. If you download as zip file then only the appropriate branch is downloaded.

nskmda commented 6 years ago

@pranav-prakash okay, looks like installing from master (after correct cloning and zipping the channel code) works.

pranav-prakash commented 6 years ago

@nskmda Aight glad to hear it.

crystal90 commented 6 years ago

"Can you post the debug output like nskmda did? Telnet into your roku on port 8085 before casting and then paste the output here."

Not sure how to do this. Please list the steps that I need to do.

pranav-prakash commented 6 years ago

After installing the development channel on the roku and the corresponding chrome extension, do the following:

  1. Open up terminal on your laptop (if you're on windows then apparently you have to enable telnet first. I guess follow this. And then open up command prompt)

  2. Type telnet [ROKU IP]:8085 where [ROKU IP] is replaced by the ip address of your roku.

  3. You'll see some output like

Trying 10.0.1.96...
Connected to 10.0.1.96.
Escape character is '^]'.

Then go ahead and cast your video. You should see more output like:

------ Running dev 'RokuCast' main ------
launch params: splashTime: 1600
source: external-control
version: 1
image: undefined
instant_on_run_mode: foreground

Paste all that output here.

crystal90 commented 6 years ago

The 'development channel'? Is that the same as the rokucast channel? Do I need to re-install the chrome extension also? Sorry, for all the questions, this is new to me.

pranav-prakash commented 6 years ago

Development channel is the RokuCast Receiver channel you downloaded from the master branch and sideloaded to the roku in developer mode.

The chrome-extension must also be the matching one from the master branch, so you must uninstall any current version you have and install the one from the master branch.

crystal90 commented 6 years ago

I'm having problems opening the port. I've opened port 8085 through my router and windows firewall but I 'm getting this message: (I am running as administrator)

C:\Users\acer owner>telnet 192.168.0.6:8085 Connecting To 192.168.0.6:8085...Could not open connection to the host, on port 23: Connect failed

Do I have to open port 23 too?

pranav-prakash commented 6 years ago

No you don't need to open the port on the router. In fact you should close it back again.

Try it like

telnet 192.168.0.6 8085

(note that i changed the colon with a space). My mistake -- I gave the wrong syntax.

sonofagl1tch commented 6 years ago

I am also seeing issues with streaming from the chrome extension. I read this thread and attempted sideloading the app the master branch to my roku as well as installed the chrome extension in dev mode. Below is the output I am getting. Please feel free to reach out with any questions or logs you would like me to pull for you. Great work man! i used to use this extension all the time until my roku died. Finally got a new one and im ready to stream.

Escape character is '^]'.
12-29 02:48:26.035 [scrpt.cmpl] Compiling 'RokuCast', id 'dev'

------ Compiling dev 'RokuCast' ------
12-29 02:48:26.056 [scrpt.cmpl.time] Compiled 'RokuCast', id 'dev' in 17 milliseconds
12-29 02:48:27.456 [ui.frm.plugin.running.enter] Entering PLUGIN_RUNNING for dev
12-29 02:48:27.598 [scrpt.run.enter] UI: Entering 'RokuCast', id 'dev'

------ Running dev 'RokuCast' main ------
BRIGHTSCRIPT: WARNING: roListScreen: This component is deprecated: pkg:/source/main.brs(7)
launch params: <Component: roAssociativeArray> =
{
    instant_on_run_mode: "foreground"
    lastExitOrTerminationReason: "EXIT_UNKNOWN"
    source: "auto-run-dev"
    splashTime: "1600"
}
show main screen

Based on what I am seeing, I believe the issue is related to my chrome extension. I am running tcpdump on my system and am seeing no traffic to my roku IP even though it is saved in the settings in the extension. I have never troubleshot a chrome extension before so im going to read up on that. Let me know if you want any specific logs.

pranav-prakash commented 6 years ago

@sonofagl1tch Yea from the looks of it the issue seems to be on the chrome extension side since the log doesn't show the roku app being launched via ecp and as you apparently noted there's no visible POST to the roku.

Can you try going to chrome://extensions/, clicking on the inspect background.html link for the rokucast extension, then going to console and seeing if there's any error message or something?

If that doesn't yield anything fruitful then I guess you could try manually firing off a POST request (either using curl/wget or through a javscript xhr).

crystal90 commented 6 years ago

Finally got connected. Here is the output after I telnet. When I start a video and try to cast it nothing happens, it just sits at 'show main screen'.

T_UNKNOWN" source: "homescreen" splashTime: "1600" } show main screen msg= , index= 20 data= 8801162 list item focused row= 20 selection= 8801162

BrightScript Micro Debugger. Enter any BrightScript statement, debug commands, or HELP.

Current Function: 054: while (true) 055: event = wait(0, m.screen.getMessagePort()) 056: if type(event) = "roGridScreenEvent" then 057: print "msg= "; event.getMessage() " , index= "; event.getIndex (); " data= "; event.getData() 058: if event.isListItemFocused() then 059: row = event.getIndex() 060: selection = event.getData() 061: print "list item focused row= "; row; " selection= "; sele ction 062:* m.selectedItem = m.history[row][selection] 063: else if event.isListItemSelected() then 064: row = event.getIndex() 065: selection = event.getData() 066: print "list item selected row= "; row; " selection= "; sel ection Array operation attempted on variable not DIM'd. (runtime error &he7) in pkg:/so urce/recentHistory.brs(62) 062: m.selectedItem = m.history[row][selection] Backtrace:

3 Function history_eventloop() As Dynamic

file/line: pkg:/source/recentHistory.brs(62)

2 Function createrecenthistory() As Dynamic

file/line: pkg:/source/recentHistory.brs(39)

1 Function main_eventloop() As Dynamic

file/line: pkg:/source/main.brs(89)

0 Function main(params As Dynamic) As Void

file/line: pkg:/source/main.brs(77) Local Variables: global Interface:ifGlobal m roAssociativeArray refcnt=3 count:8 event bsc:roGridScreenEvent refcnt=1 row Integer val:20 (&h14) selection Integer val:8801162 (&h864B8A) url ishls isplexstream videoparams actiontext actionmap result

Brightscript Debugger> 12-27 01:23:37.286 [ui.frm.plugin.running.exit] Exiting P LUGIN_RUNNING for dev 12-27 01:23:41.060 [ui.frm.plugin.running.enter] Entering PLUGIN_RUNNING for dev 12-27 01:23:41.173 [scrpt.run.enter] UI: Entering 'RokuCast', id 'dev'

------ Running dev 'RokuCast' main ------ launch params: = { instant_on_run_mode: "foreground" lastExitOrTerminationReason: "EXIT_UNKNOWN" source: "homescreen" splashTime: "1600" } show main screen 12-27 01:26:21.151 [ui.frm.plugin.running.exit] Exiting PLUGIN_RUNNING for dev 12-27 01:57:48.318 [ui.frm.plugin.running.enter] Entering PLUGIN_RUNNING for dev 12-27 01:57:48.453 [scrpt.run.enter] UI: Entering 'RokuCast', id 'dev'

------ Running dev 'RokuCast' main ------ launch params: = { instant_on_run_mode: "foreground" lastExitOrTerminationReason: "EXIT_UNKNOWN" source: "homescreen" splashTime: "1600" } show main screen 12-27 02:01:43.071 [ui.frm.plugin.running.exit] Exiting PLUGIN_RUNNING for dev 12-29 05:44:47.315 [ui.frm.plugin.running.enter] Entering PLUGIN_RUNNING for dev 12-29 05:44:47.433 [scrpt.run.enter] UI: Entering 'RokuCast', id 'dev'

------ Running dev 'RokuCast' main ------ launch params: = { instant_on_run_mode: "foreground" lastExitOrTerminationReason: "EXIT_UNKNOWN" source: "homescreen" splashTime: "1600" } show main screen 12-29 05:54:11.497 [ui.frm.plugin.running.exit] Exiting PLUGIN_RUNNING for dev 12-29 05:54:53.408 [ui.frm.plugin.running.enter] Entering PLUGIN_RUNNING for dev 12-29 05:54:53.538 [scrpt.run.enter] UI: Entering 'RokuCast', id 'dev'

------ Running dev 'RokuCast' main ------ launch params: = { instant_on_run_mode: "foreground" lastExitOrTerminationReason: "EXIT_UNKNOWN" source: "homescreen" splashTime: "1600" } show main screen

pranav-prakash commented 6 years ago

That's odd. Just as with @sonofagl1tch for some reason the POST request doesn't seem to be going through to the roku and starting up the receiver app. I'm going to hazard that the two of you are experiencing the same problem for some reason, which I can't seem to reproduce on my end.

Can you check the chrome extension console too and see if there are any errors there (go to chrome://extensions/, click on the inspect background.html link for the rokucast extension, then go to console)

crystal90 commented 6 years ago

This is all it shows in console: (the background.js:20 should be on the right, it didn't copy very well) Array(1) background.js:20 Watch The Void (2016) Full Movie on FMovies.to - BMovies.is background.js:21 https://bmovies.is/assets/favicons/favicon.ico background.js:19 Array(1) background.js:20 Watch The Void (2016) Full Movie on FMovies.to - BMovies.is background.js:21 https://bmovies.is/assets/favicons/favicon.ico background.js:19 Array(1) background.js:20 Watch The Void (2016) Full Movie on FMovies.to - BMovies.is background.js:21 https://bmovies.is/assets/favicons/favicon.ico background.js:19 Array(1) background.js:20 Watch The Void (2016) Full Movie on FMovies.to - BMovies.is background.js:21 https://bmovies.is/assets/favicons/favicon.ico

pranav-prakash commented 6 years ago

Yeah that seems normal -- no errors there.

Hm I honestly have no idea what's going on. Can you trying pasting the following in the console you opened:

var xhr = new XMLHttpRequest();
xhr.open('HEAD', "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4", true);
xhr.onload = function () {
    var url = "http://" + "10.0.1.1" + ":8060/input/15985?t=v" + "&u=" + encodeURIComponent(xhr.responseURL) + "&videoName=" + encodeURIComponent("asdf") + "&k=(null)" + "&videoFormat=" + "mp4";
    var method = "POST";
    var postData = "";
    var async = true;

    var request = new XMLHttpRequest();
    request.open(method, url, async);
    request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
    request.send(postData);
};
xhr.send(null);

where you replace 10.0.1.1 by the IP address of your roku.

sonofagl1tch commented 6 years ago

I had no errors either in the console. I tossed that code into my console and I am getting "14:35:09.781 undefined" returned as the only output. I dont think that is the output we were hoping for. Below is the code I pasted with my internal roku IP in it.

var xhr = new XMLHttpRequest();
xhr.open('HEAD', "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4", true);
xhr.onload = function () {
    var url = "http://" + "192.168.1.100" + ":8060/input/15985?t=v" + "&u=" + encodeURIComponent(xhr.responseURL) + "&videoName=" + encodeURIComponent("asdf") + "&k=(null)" + "&videoFormat=" + "mp4";
    var method = "POST";
    var postData = "";
    var async = true;

    var request = new XMLHttpRequest();
    request.open(method, url, async);
    request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
    request.send(postData);
};
xhr.send(null);
14:35:09.781 undefined
pranav-prakash commented 6 years ago

@sonofagl1tch Hm I get the undefined thing too when running it, so that's probably just a quirk of XMLHttpRequest. If it worked successfully though (for some reason I can't reproduce the behavior you guys are getting), the video should start playing on the Roku.

The only thing different is that I don't have the "14:35:09.781" before the "undefined." Is that clickable -- does it go to anything?

If you load up wireshark do you see any traffic to the Roku?

Can you try manually firing off the POST request using curl?

curl -X POST "http://10.0.1.111:8060/input/15985?t=v&u=http%3A%2F%2Fdownload.blender.org%2Fpeach%2Fbigbuckbunny_movies%2FBigBuckBunny_320x180.mp4&videoName=asdf&k=(null)&videoFormat=mp4"

(again replacing the IP as needed)

sonofagl1tch commented 6 years ago

the "14:35:09.781" before the undefined is because I enabled timestamps on my logs. I am going to load the roku receiver on another roku I have then try the test you suggest. will report back shortly

sonofagl1tch commented 6 years ago

great news. running curl -X POST "http://192.168.1.9:8060/input/15985?t=v&u=http%3A%2F%2Fdownload.blender.org%2Fpeach%2Fbigbuckbunny_movies%2FBigBuckBunny_320x180.mp4&videoName=asdf&k=(null)&videoFormat=mp4" worked like a charm. bad news is the chrome extension still will not send any network traffic regardless of what destination IP I give it.

pranav-prakash commented 6 years ago

Ok so it's definitely on the chrome extension side then.

Chrome devtools also has a built in network requests logger. When you run the JS code above and then go to the network tab in devtools do you see anything? There should be two requests -- one HEAD to the video URL to resolve any redirects that might happen (corresponding to xhr.send) and a POST to the roku (corresponding to request.send).

If that doesn't show anything, then a good place to start might be to just start from the smallest possible example and check if any traffic is registered whatsoever, for instance doing a simple GET to google.com or something.

The fact that both of you are experiencing this problem around the same time makes me think Google might have changed something, although for some reason I'm unaffected. What's your guys' chrome version/platform? Although I find it hard to believe they'd break xhr in such a glaring way as others would have obviously noticed.

sonofagl1tch commented 6 years ago

that last test worked. running the below code produced a video sent to my roku. Looks to be limited though. i cant cast anything from youtube or nesn. I am going to try a few more sites and report back later.

16:40:45.402 var xhr = new XMLHttpRequest();
xhr.open('HEAD', "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4", true);
xhr.onload = function () {
    var url = "http://" + "192.168.1.9" + ":8060/input/15985?t=v" + "&u=" + encodeURIComponent(xhr.responseURL) + "&videoName=" + encodeURIComponent("asdf") + "&k=(null)" + "&videoFormat=" + "mp4";
    var method = "POST";
    var postData = "";
    var async = true;

    var request = new XMLHttpRequest();
    request.open(method, url, async);
    request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
    request.send(postData);
};
xhr.send(null);
16:40:45.433 undefined
16:41:18.485 background.js:28 [{…}]
16:41:18.486 background.js:29 download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
16:41:18.487 background.js:30 undefined

OSX 10.13.2 Google Chrome Version 63.0.3239.84 (Official Build) (64-bit)

pranav-prakash commented 6 years ago

@sonofagl1tch Wait what's the difference between the code above and the one you tried previously? They look to me to be exactly the same.

i cant cast anything from youtube or nesn

Not sure if you're trying to insert the URL into the xhr.open parameter -- note that the xhr.open directly takes in an mp4/m3u8 file. There's another part of the extension that parses the page in order to extract this, and both these parts work together when you click on the cast button from the toolbar.

Also it's a known issue that YouTube casting doesn't work, see https://github.com/pranav-prakash/RokuCast/issues/8 for explanation and workarounds

sonofagl1tch commented 6 years ago

The only difference was me manually running the curl command before I attempted to use the extension. outside of that, all variables were the same afaik.

pranav-prakash commented 6 years ago

@sonofagl1tch Hm I have no idea how that could make any difference, but if it works now then great I guess.

sonofagl1tch commented 6 years ago

I concur. No idea why it works now versus before. but it is working now without any changes outside of what you had pushed to the master branch as of Thursday night. thank you for looking into this and thank you for all the work you put into rokucast!

crystal90 commented 6 years ago

Since this is all new to me, would you explain to me what I need to do? I'm a little lost. If it matters my chrome version is: Version 63.0.3239.84 (Official Build) (64-bit)

pranav-prakash commented 6 years ago

@crystal90

would you explain to me what I need to do

I'm assuming you're referring to using curl as sonofagl1tch did? Note that I have no idea why that helped in the first place, so there's a good chance doing it won't necessarily help you.

Are you on windows? If so you need to download the curl binaries first, follow the second answer here.

Then just type

curl -X POST "http://10.0.1.111:8060/input/15985?t=v&u=http%3A%2F%2Fdownload.blender.org%2Fpeach%2Fbigbuckbunny_movies%2FBigBuckBunny_320x180.mp4&videoName=asdf&k=(null)&videoFormat=mp4"

in the command prompt, replacing 10.0.1.111 with your own ip address.

crystal90 commented 6 years ago

This still doesn't make sense to me. Which directory should I place the curl binaries? there isn't any clear information on this. Also, the 'curl' statement references download.blender.org. Shouldn't I replace that with the link I am trying to cast?

pranav-prakash commented 6 years ago

@crystal90

You can place it anywhere, just change the environment variables to point to that location, as noted in the second answer in the link I gave last time.

And keep the curl statement as is -- I'm just testing whether the Roku is accepting POST requests from your computer and responds appropriately by playing that video.

Again I have no idea where I'm going with this, just trying it out since apparently manually using curl once seemed to magically make everything start working for \@sonofagl1tch, which doesn't seem to make any logical sense at all but it's worth a shot I guess.