Chromecast streams Music, videos, and Chrome Tabs from Linux, Windows, Mac OSX, iOS, Android. But there is a catch. All of the content streams from the cloud directly to the Chromecast device. Your seconds screen (android, PC, etc) only acts as a Media controller.
Koushik Dutta, the founder of ClockworkMod demonstrated how he managed to be able to stream Video over local LAN directly to chromecast from his Android phone.
Cast API (Developer API for chromecast) uses RAMP protocol to control media playback. However, it has no way to stream music, videos. So how did he do it? We are skeptical but we think we know. Koushik Dutta had developed a low level Android client-server library called AndroidAsync. He further created high-level library called Ion for normal Java based developments. This library is capable of creating Async operations for web sockets, http server/client, Raw TCP/IP sockets and more network operations.
Cast API lets you probe Chromecast devices available on the WLAN. When discovered, you define the URL from which Media is streamed to device and there onwards media is controllable from the Initiator. If this URL is nothing but the initiator smartphone’s IP address with right port that serves Media Webserver content, using Ion library. The whole media file is served from the locally available android device.
So to summarize:
Open Gallery > share video to your app > discover chromecast devices on network > Start media server using Ion library > Set content source (IP) > start streaming content when chromecast requests it.
Koush isn’t the only one who has done it. The popular BubbleUPnp Android app has also showcased this feature:
At the time of writing, its an upcoming feature for BubbleUPnp app.