问题
How can I, using the Cast SDK or otherwise, have my app trigger a Chromecast reboot, in the manner of the official Chromecast app?
In the case of 'otherwise', is Google Play likely to look unkindly on this approach?
回答1:
There is no API in the SDK to reboot a Cast device and frankly, it is scary to me that you would want to do that programmatically. What is the reason you would want to do that?
回答2:
You definitely should be able to. It's just a HTTP post after all. This from pychromecast
CC_SESSION.post(FORMAT_BASE_URL.format(host) + "/setup/reboot", data='{"params":"now"}', timeout=10)
That might point you in the right direction.
回答3:
Following on the answer from davewasthere (thanks!), I found that I can reboot a Chromecast by performing the following command from Linux prompt:
curl -Lv -H Content-Type:application/json \
--data-raw '{"params":"now"}' \
http://10.10.2.49:8008/setup/reboot
Some other useful DIAL commands
回答4:
A recent firmware update seems to have disabled the HTTP endpoint on port 8008
(HTTP/1.1 403 Forbidden
) so the solution posted by norganna does not work any longer.
Working alternative is the HTTPS endpoint on port 8443
:
curl -Lv --insecure -H Content-Type:application/json --data-raw '{"params":"now"}' https://10.10.2.49:8443/setup/reboot
来源:https://stackoverflow.com/questions/31385469/reboot-a-chromecast