How can I enable verbose debug on Cast SDK3 and CAF receiver? - chromecast

I'm converting to CAF receiver and Cast SDK 3. I'm having some issues with sending messages from the CAF receiver to the sender. I think the CAF part is working but to make sure I would like to enable verbose logs. How can I do that for both the sender (Android) and receiver?
Thanks.

I know that's late but for others - on receiver side it's done this way:
castContext.setLoggerLevel(cast.framework.LoggerLevel.DEBUG);

Related

How ChromeCast Communicate with reciever app and sender App?

As we know we send and receive message in json form from send app to receiver app. what is the proper channel for sending and receiving message and what role ChromeCast play in whole picture?
Senders and receivers are establishing a socket connection and communicate via IPC. While it's true that this communication is in JSON format, you will likely neither generate that data yourself nor care about the 'how' or 'channels' of it - in fact, you are not even allowed to following the terms of service by Google.
Instead, you have the SDK handle that for you one both the sender and receiver site.
Communication is done in the form of defined Messages that implement a schema and contain objects - most notably for media playback that is MediaInformation.
Most of those objects that are passed between sender and receiver have a customData property that you can use to add self-defined payload in JSON format.
If you want to implement your own features you can implement custom messages.

Customer Receiver: Unable to Cast to Device

I'm having trouble doing a simple "hello-world" with a Custom Receiver.
I have really simple sender and receiver apps.
Sender app: http://chromecasttest.boxofsoap.com/
Receiver app: http://chromecasttest.boxofsoap.com/cast
I've tried casting to my Chromecast device using the Google Cast Beta
extension for Chrome Canary.
Whenever I visit the sender app URL and try casting to my device, I always
get a "Unable to cast to device error":
pasteboard.co/1pn6kEel.png
Looking at the console I usually see vague errors like "channel_error"
or "timeout".
What am I doing wrong??
#AliNaddaf - Thanks again for your help, after some debugging I found out that the issue was related to the server that was serving the receiver app.

Do I need to host my receiver app on my own server?

When I register a Chromecast receiver app, it asks for a URL. Is that where the receiver html file is?
Either you need to use one of our receivers (Styled or Default), in which case you do not need to register any URL or you need to use your own custom receiver which requires you to arrange for its hosting. See tour docs.

Leave receiver running after sender stop

I'm using a simple receiver based on the Google CastHelloText sample app. When the sender disconnects, I'd like to allow the receiver to continue display.
I thought this could be accomplished by modifying the receiver's onSenderDisconnect function to skip the window.close call but when I disconnect my sender by calling session.stop, the receiver is shutdown withou a call to onSenderDisconnect. I see a "Dispatching shutdown event" in the receiver log.
How can I get the receiver to continue without the sender connection?
If you want to allow receiver to continue, do not call stop in your sender; that call sends a message to the receiver that would result in stoping the application on receiver; here is what the documentation for that method says: "Stops the running receiver application associated with the session.". On chrome senders, you can simply close the tab if you want to let the receiver continue . Note that the onSenderDisconnect now has an argument that shows whether disconnect was explicit (intentional) or not, in case you want to handle explicit disconnects differently. Other platforms, e.g. Android SDK, also have similar stopApplication methods that should not be called if you do not want to stop the running application on the receiver. On Android and iOS, you have more APIs to provide a more fine-tuned "disconnect" experience.

Chromecast Chrome API - senderId

The receiver adds a senderId to each message it receives. Is the sender aware of that id? Where can it be found?
That would help greatly during development.
That senderId is not something that a sender knows about.

Resources