Chromecast sender application error when requesting new session - chromecast

I have an unpublished custom receiver app, and I am unable to cast to it from my web player sender app in chrome. I do get the receiver "available" message upon initialization of cast api, but when I click on the cast button in player and select the chromecast device from drop down menu in extension, the TV screen goes black and few seconds later I get onError method called with following error:
{code: "channel_error", description: "Error: Timeout", details: null}
The casting works fine when using default media receiver. Also, I do not see any network traffic coming from chromecast device in my server console log, which means that chromecast is not fetching the receiver application.
I made sure of the following:
The Chromecast dongle is registered as Cast Receiver device in Cast
Developer console.
My macbook has NodeJS server running to serve the
receiver application and the "Receiver Application URL" in cast
developer console is correctly pointing to server running on my
macbook.
The chromecast and my macbook both are on same network, with
valid 192.168.x.x IP addresses.
I found another thread discussing this error Chromecast sample sender application CastHelloText-chrome ends with error when trying to get session, but the suggestions provided there dont seem to apply to my situation.

I was able to resolve this particular error by restarting the chromecast device. I tried it on two separate occasions and both times the issue went away once the device was restarted. I can't explain how it worked, but it did the job. If someone can explain what is the cause of this particular error and why restarting fixes it, I will accept that answer.

Related

Tizen WebSockets: can access Internet WebSocket server but cannot acces LAN WebSocket server

last week I started to develop apps for a Samsung Smartwatch with the Tizen SDK 2.4.0. My sample web application connects to a remote Websocket server (a simple echo server) and sends some random requests and prints the received messages (Server is http://www.websocket.org/echo.html). This works fine on an emulated devices as well as on the real Gear S2 Smartwatch (Example was taken from https://developer.tizen.org/zh-hans/development/tutorials/web-application/w3chtml5supplementary-features/communication/websocket?langredirect=1)
But as soon as I start a Websocket server in my home LAN I run into problems. The server is launched via a simple Python example I found on Github (https://github.com/dpallot/simple-websocket-server). The emulator device from the SDK connects to this server without any problems using the local IPv4. But the real device, which is logged in to the same WiFi access point, doesn't.
Note that the connection between my PC and my watch device works fine, since the SDK flashes the developed apps via WiFi to the device.
In my config.xml all connections are allowed
<access origin="*" subdomains="true"></access>
and the privilege for "Internet" is available.
The logs show that the watch tries to open a connection, but is then stuck. No error message is printed - the watch just does not go beyond the initial creation of the websocket.
Do you have any hints or thoughts about how I could debug this issue?
Thanks in advance!
I found the solution - my virus scanner has an integrated software firewall that blocked incoming connections...
Try with higher ports maybe ? I got WS working fine on SamsungZ1 on Tizen:2.3:Mobile
https://twitter.com/RzrFreeFr/status/70135763074535014#tizen-gear2-websockets
Maybe I could try your code on Tizen:2.4:Mobile too ?

Why is whitelisted Chromecast IP for development blocked with err_connection_refused?

I already read this (Can not access Chromecast receiver debug page by http://chromecastIP:9222?) and similar threads. I am not sure if they are outdated from the pre-release SDK but at any rate here is my tale of woe...
Chrome is giving me these details when attempting to browse my Chromecast IP:
Google Chrome's connection attempt to 192.168.2.78 was rejected. The website may be down, or your network may not be properly configured.
NOTE - I did remember to add the :9222 suffix
My Chromecast device appears to be whitelisted.
From the cast.google.com/publish/#/overview console page it lists both my Application ID and my Serial #.
The App ID is fine if that even matters as I have successfully run many github sample apps using it.
The serial # I entered is correct as I was meticulous reading it with a magnifying glass off the device (felt like Sherlock Holmes).
The status for my Serial # lists, "Ready for testing"
I did this all after a factory reset today.
I then unplugged the USB cable from the Chromecast dongle and counted to 30 and reseated it.
This is exactly what the instructions on the cast developer site instructed.
I have seen some posts where people say it could take hours but that seems to be pre-release posts where there were alot of issues.
So basically I ready every stackoverflow post on this, followed all instructions, everything looks good and works right (I can cast no problem) even with my own code for both Android & Web but I just cannot browse, http://:9222
I just get err_connection_refused
I can ping it without the :9222 suffix as well.
Since it says, "Ready for testing" I assume I do not have to wait for Google to process this.
Finally I was triple sure to check, "Send Serial # to Google for updates" in installation app.
Can anyone provide guidance please?
Thanks!!
These are the instructions I followed (meticulously I might add)
https://developers.google.com/cast/docs/registration
To register your Google Cast device:
Sign in to the Google Cast SDK Developer Console.
From either the Overview page or Devices page, click Add New Device.
Enter the serial number of your device. ( I TRIPLE CHECKED THIS)
The serial number on a Chromecast is a 12-digit alphanumeric string, laser-etched (not printed) on the back of the device and begins with a 3, 4 or 5. It may be easier to read if you take a picture of the serial number then enlarge it. The serial number is also printed on the package.
Enter a description, and click OK.
This is just a friendly name for your device (it does not need to match the name you gave to the device during user setup).
Wait fifteen minutes before continuing. (I waited till it says, "Ready for testing")
Once registration is complete, the Status for the device will read "Ready for Testing."
In the Chromecast setup app, select your Chromecast and check the box, Send this Chromecast's serial number when checking for updates.
Restart your Chromecast by disconnecting the USB cable from the device, then reconnecting it.
After restarting the device, check whether you can access http://:9222 from a chrome browser on the same WiFi network.
** AFTER ALL THIS STILL GET ERR CONNECTION REFUSED **
Once you can access the URL, your device is ready for development. If you can't access the URL, check the serial number you entered in step 3, above.
Please read the documentation here (search for Debugging). The Registration page will be updated later today or tomorrow to remove item number 8 at the bottom of the page. In short, you need to have your own application running on the Chromecast device to be able to attach your chrome debugger to it. Also see this post.

Getting disconnected from Chromecast after switching to custom receiver

I recently switched my Chromecast app to a custom receiver. I'm still using the Cast Companion Library. The custom receiver is basically based on this https://github.com/googlecast/cast-custom-receiver/blob/master/sample_media_receiver.html the only changes are the adding of a logo and loading screen and commenting out this line appConfig.maxInactivity = 6000; although at first I didn't have it commented out and still had the same issue.
Anyways the issue is pretty simple and only happens to a few people. It happens to me with one of my test devices, not all and not always. Basically I start streaming a video and it is all fine, then the device screen goes off, when I turn it off again the app has disconnected from the Chromecast. I do not have wifi set to turn off when sleeping, and all of the users who have complained about this claim their devices also don't have that setting turned on.
It could be a coincidence that this happened when I switched to the custom receiver but I just wanted to make sure there wasn't something I needed to add to my custom receiver to tell the CCL code to stay connected?
Thanks.
I faced similar issue today. Main cause for this behaviour is that as soon as the sender (in your case phone) is locked (sleep mode) then senderDisconnected event is fired on the receiver side. And if you check the event.reason, it will be unknow, so you could probably check for the reason, if it unknown then dont stop the playback on receiver (window.close).
When the sender itself disconnects, event.reason is "disconnected_from_sender".
I hope this helps.
It has nothing to do with maxInactivity.
The policy for disconnecting wifi when your phone goes to sleep does depend on the brand and vendor . Currently, the Cast SDK holds a lock to keep the wifi connected as long as there is a cast connection but even that is not a 100% guarantee to work for all phones/models/vendors/.... This has nothing to do with your receiver. The proper solution is not to try to fight against the wifi disconnect when phone goes to sleep, instead you have to consider adding some logic to recover the cast connectivity when phone wakes up and wifi connectivity is re-established (register a broadcast receiver to listen for wifi connectivity changes).

How to debug whitelisted Chromecast

I have completed Google's form to enable my device to be whitelisted and have been provided with an AppID.
I have followed the procedures outlined here to try and debug the device with no success:
https://developers.google.com/cast/developing_your_receiver#debugging
I am able to ping my device by the IP, but connecting to port 9222 results in failure. Telnet to that port is also unsuccessful.
Does anyone know why this might not be working? I must be missing something simple.
The problem was that my Chromecast device was not sending the serial number to Google.
I was able to get it to work by enabling the sending of the devices serial number in the Windows settings utility (changing this setting in the android app didn't seem to work). After changing the setting I rebooted the device, and now I can connect on port 9222. I am not sure why this isn't in the developer walk through... or maybe I missed it?
I only got this option when I opened "Options" in the Google Cast Extension inside Chrome and then clicked on the blue icon about a dozen times very quickly. Suddenly a new option appeared at the bottom where I could enter the hostname of my whitelisted URL:
I also made sure that "send serial number" was enabled in the Chromecast.app (and make sure to reboot!)
Now, I am able to hit port 9222 in a browser and can see my app at http://{my-chromcast-ip}:9222/. I can use dev tools in Chrome to debug, refresh the page, inspect on-screen elements, etc.
Something else that I haven't seen others mention yet. If you're going to the right IP and getting the link to remote debugging, but you don't see your source, elements, etc. It could be blocked by security settings. This stumped me for a while until I noticed a small shield icon in my url bar. Click on this and allow it to load sources. Once I did that everything populated as expected.
I struggled a bit with this one. I think some things might have changed with the last firmware update on the Chromecast. I could connect to port 9222 after I did the following:
Registered the custom receiver and host it on the outside of my network (on Google Drive:
https://support.google.com/drive/answer/2881970?hl=en)
Launch the receiver. I used the Chromecast example https://github.com/googlecast/CastHelloText-chrome
Make sure the app ID in chromehellotext.html is the one registered on your account.
When After this, I could connect to the debugging port.
The port is only open when your custom receiver is running on the Chromecast.
I also might be useful to enable debugging on the chrome extension. This will show what's going on between the Chromecast and sender:
https://developers.google.com/cast/docs/chrome_sender
I realize that this is an ancient question, however my answer might help people searching in the future.
Simply rebooting the Chromecast after having set up my details in the Cast console helped for me.
You must cast to a custom receiver first (at least once) before trying to access the IP with debug port. Otherwise debugging won't be enabled.

Apns test with ad hoc provisioning

I'm developing an App that works with Apple push notifications but I have some problems testing.
I have tested the app in the sandbox and it all works fine: it can send and receive push notifications, but for one single device (I think that is the correct behavior for an sandbox release).
But when I have create an ad hoc version with his production provisioning I have the same behavior: only one device works fine, it sends and receives the push, but the others devices do not receive any push. All devices can send a push but only the the first one can receive.
After installing 'PersistentConnectionLogging.mobileconfig' on devices that can't receive a push, I can read on the console:
Sep 7 13:17:51 unknown apsd[49] <Warning>: <APSCourier: 0x25a0a0>: Received message for enabled topic 'myapp.name' with payload '(null)'
Sep 7 13:17:51 unknown apsd[49] <Warning>: <APSCourier: 0x25a0a0>: Failed to parse JSON message payload for topic 'myapp.name': The operation couldn’-t -b-e -c-o-m-p-l-e-t-e-d-. -(-C-o-c-o-a -e-r-r-o-r -3-8-4-0-.-)
I can't resolve the issue, I have regenerated the provisioning profile many times and all work fine on server sides connections, the Apple feedback is OK.
I have checked my stored devices token and sandbox and production are different, any suggestions?
Amalgamation of comments posted as an answer, on request: (these helped to break the problem down and identify where the error was occuring)
How/where are you storing your device tokens? How are you generating the message to be pushed?
Your code that connects to the push servers and creates the payload... how is it sending to >1 devices?
I don't know the easyApns code, but either your other device tokens are invalid or the code is not looping correctly to push the message to the other devices. Also, have a browse through Google for the cocoa error 3840 and see if anything helps you to better understand the issue. Else pick some different push code, have a look at [link below] as a starting point.
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

Resources