So far I've been able to write a webpage that pushes a url to the (what I'm calling) native app in the chromecast device. Through this API I can open a "video_playback" app that sends the URL and some other info, just like in this webpage http://googlecast.github.io/cast-chrome/ to my device and my video plays just fine...
Now I want to do that with the Android API, but it treats that receiver "app" as if it doesn't exist. With some more poking around I found that the actual name of the app is ChromeCast, but all I've been able to do is get a blank screen or a 404 to show up. Is this not supported on the Android app? (ie I'm forced to write my own receiver) or am I doing something wrong?
I perfectly able to open a YouTube app through the Android API and load a video, so most of my code is fine. It seems I just need to figure out what application name and arguments to use in the ApplicationSession.startSession() function.
Any help would be appreciated.-
How are you starting your session (which version of startSession() are you using?)
It sounds like you are starting your session ok but then you need to send the url of the video via the MediaProtocolMessageStream.loadMedia().
https://developers.google.com/cast/reference/android/javadoc/reference/com/google/cast/MediaProtocolMessageStream#loadMedia(java.lang.String, com.google.cast.ContentMetadata, boolean)
Related
I recently put together a Raspberry Pi garage door opener and it seems to be working well at this point. I used this as a reference and used his scripts and webpage with slight fixes/modifications. I can now log into the site I'm hosting from the pi with Apache2 and open and close my door and view my webcam stream. I am using DuckDNS and port forwarding port 80 to my pi currently.
What I would like to do next is set up IFTTT Maker Channel integration with the goal of using a DO Button to control the door from my Android Wear watch. The problem is I don't know how to set up the pi to receive an HTTP request from IFTTT.
Essentially what I need to learn how to do is have the pi listen for this request and run a script (setting GPIO pin 17 to high for a half second). Presumably once I figure this out I would also be able to use Tasker/AutoVoice for Google Now integration.
Thanks in advance for any help.
So I figured it out and want to post my limited knowledge answer for anyone looking to do the same, it was actually easier than I was making it.
I had a couple of problems from the start
My whole html root folder requires a password
I didn't understand what a GET request was doing in this instance
My script files weren't working properly
Here's how I was able to correct these issues and get it working
Send the username/password in the GET request, not extremely secure, but oh well:http://user:password#address.org/file.php
With the basic GET request it appears to just basically "load" the URL given as if you typed it in a browser address bar and hit enter, this means that if my script file is working correctly it should run the script
I corrected my script files
I have created a live streaming server using rtsp protocol on my machine with link of media as
rtsp://192.168.xx.xx/livedata.sdp
When I pass the link on another machine connected in network to VLC player streaming works fine.
But when I pass the same link to Windows Media Player I get following error:-
"Windows Media Player cannot play the file because the specified protocol is not supported. If you typed a URL in the Open URL dialog box, try using a different transport protocol (for example, "http:" or "rtsp:")."
I have searched on net for the said error and tried all kind of stuff like registering wmnetmgr.dll and checking for permissions of WMSDKNS.XML but nothing worked.I have also checked the settings in Tools->Options->Network Tab and ticked all the check boxes i.e.
RTSP/TCP, RTSP/UDP, HTTP.
I am using Windows Media Player 12.0.7600.16385.
I am attaching the screenshot of the error below.
Please provide me with a solution for the same.
Thanks in advance.
I have found no joy in getting any of the sample programs for Chrome to connect to my Chromecasts.
The Chromecasts have been registered and I am able to browse to their IP address port 9222 successfully.
Both the Chrome browser and Beta extension are up to date.
I have tried the CastHelloVideo-Chrome, CastMedia-Chrome and Cast-Tictactoe-Chrome and all fail to connect. The developer console shows a pair of errors:
GET chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/cast_sender.js net::ERR_FAILED
and
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').
When testing our own code we get an error when calling requestSession but the message returned by Chrome.cast.Error is useless since the function and variable names have been obscured.
I also have a difficult time testing the examples for Chrome. I decided to use Chrome to test because debugging JavaScript is so much quicker than going directly to Android. I spent hours trying to figure out why I keep getting the error message GET chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/cast_sender.js net::ERR_FAILED and Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null') if I run it from my PC but not when I run it from an example website at http://www.videws.com/eureka/helloVideos/ provided by one of the Cast developers at Google. I keep reading/trying different combinations from his readme note in the example until it dawned on me what he meant by "Put all files on your own server" instead of "computer".
I created a public weblink on my Google Drive, make the folder public and copied all the files there. When go to Google drive on the web, preview the example (index.html), the example runs beautifully. I tried tic-tac-toe. It also runs.
So the answer is you need to run it off a website -- not from a local file in your computer (ctrl-O in Chrome)
I hope this will help you going with Cast.
Danh
I was finally able to get connected, but from Android. Many steps will be the same though.
I tested this: https://github.com/googlecast/CastHelloText-android It let's you speak into the phone, and what you say appears on the TV/Chromecast. I didn't install the formal sender app, but I was able to load the TicTac Toe from the receiver as well. So i have seen them both on my CC.
I couldn't connect until I properly setup the RECEIVER APPLICATION. You didn't mention it.
What I did from where I think you are at.. I just double checked my receiver app settings.
File copy the receiver.hml file provided in the sample sender app. Place it in a public dropbox folder. copy that public link to my clipboard.
Go back to where you registered your Chromecast device(s). https://cast.google.com/publish -Add An Application. I called mine : ReceiverSimple
Edit the app you just created, and for the URL field: paste in that public link. For you, set the platform to Chrome. It did not seem to matter whether or not i included the package name, so try leaving it blank.
Save It. Now COPY to clipboard the ApplicationID for the receiver you just created.
Open the provided sender app source code, and find where it's using APP_ID (hopefully R.Strings or equivalent in chrome ) Paste that App ID in. That will tell your client to use your receiver app, (and therefore, load that receiver.html file into the chrome cast screen).
also try a chrome cast reboot as another means of sanity checking.
I think you're close.
Is it possible to send video to the chromecast device from a native application? It would be nice to share any window on a system instead of only chrome tabs. Also, is there any documentation of the communication used by chrome to communicate with the chromecast? It is my understanding that the chromecast essentially loads content from an embedded chrome instance, but there appears to be more direct ways of communicating with the device since it is able to stream content from a chrome tab using the extension.
You need to whitelist your receiver device if you are developing a receiver application. That would be a Chome app that runs on the receiver's Chrome instance.
You need to whitelist a sender url if you are developing a Chrome app that will cast it's contents.
Video casting works by sending a url to the receiver device, which the device will load directly.
Tab casting works by encoding the tab contents using WebM/Opus (in the Chrome cast extension) and streaming that to the receiver device. (This is limited to 720p, see this question)
Chrome apps can only use Video casting.
The chrome cast extension is going to be the only way to stream directly to the device.
So the answer to your question is no, you cannot stream video directly to the device. The receiver must load the video from the url you provide.
There is some speculation whether the receiver can be provided with a local url or if it must already be available on the internet. This has yet to be clarified.
From how I understand the Chromecast architecture:
You can display any URL you want on the TV (you have to whitelist your app and register the URL first). It must be a URL. This can include HTML, JS, CSS, etc. Anything that is already on the internet.
To receive data from a device (say, the URL of a video to load), you must implement logic to interpret messages from channels. These messages are encoded as JSON, which makes it difficult to send videos or pictures (binary data). It is obviously easiest to upload things like this to some website, and have the receiver display them.
People have asked, "well, then how does the tab/screen sharing work?" The JSON encoding is just what Google provides in their SDK. In their own source, they don't have this restriction.
Update:
It turns out you can actually stream local videos to your TV by just opening the local file in Chrome, and then casting that to your TV.
I'd like to ask users to rate my app.
I can open an url in browser:
final String url = "http://store.ovi.com/content/168792";
MyMidlet.this.platformRequest(url);
But if the ovi store app is installed on the phone, I'd like to use it like in android I can start activity with Android Market intent as a parameter.
Is there any way to open my application page via ovi store app?
I'm using
CLDC-1.1
MIDP-2.0
If the Nokia Store is installed, then opening the above URL in the browser will cause the Store client to open on the specified app.