• Stars
    star
    349
  • Rank 121,528 (Top 3 %)
  • Language
    Java
  • Created over 11 years ago
  • Updated about 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fling media to a ChromeCast device

Fling

The Fling application allows you to beam video files from computers to ChromeCast devices.

To run the application, you need a Java runtime environment (JRE) for your operating system.

Fling no longer works for the public since the public ChromeCast app receiver no longer allows video playback.

There is a dependency on a web app that needs to be registered with Google.

When the application starts, it will search for ChromeCast devices on your local network. Select the device that you want to beam the videos to. Then drag-and-drop a video file onto the application to beam it to the ChromeCast device.

ChromeCast devices only support a very limited number of media formats. Fling has experimental support for converting other media formats into WebM using the vlcj library for VLC. You need to download and install VLC for your computer (the latest 64-bit version is preferred). For Windows, you need to install the 64-bit experimental version. If you have the 64-bit version of Java, you have to install the 64-bit version of VLC. Click on the Fling Settings button to configure which file formats to convert and to configure the VLC transcoding parameters. By default Fling uses the following VLC transcoding parameters:

:sout=#transcode{vcodec=VP80,vb=1000,vfilter=canvas{width=640,height=360}, acodec=vorb,ab=128,channels=2,samplerate=44100,threads=2} :http{mux=webm,dst=:8087/cast.webm} :sout-keep
Note that converting video is very CPU intensive. It might take several seconds for the video to start playing on your ChromeCast device.

There are basic playback controls to play, pause and stop the video (pause and stop behaves the same). The playback slider/scrubber control does not work for transcoded video.

The computer running the Fling application needs to be on the same network as the ChromeCast device. To play the video, a web server is created on port 8080 on your computer and you might have to configure your firewall to allow incoming connections to access the video.

Note for developers: If you want to use your own receiver, you need to put your own app ID in the FlingFrame.java and receiver index.html files. If you don't want to compile your own version, use this copy of fling.jar and pass in the app ID as the command-line parameter:

java -jar fling.jar xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Watch this video to see the application in action.

Other apps developed by Entertailion:

Building & Running (with Maven)

git clone github.com/entertailion/Fling # get the code
cd Fling
mvn package # maven will get dependencies & build everything
java -jar target/Fling-0.0.1-SNAPSHOT-jar-with-dependencies.jar # run it!

RAMP Protocol for ChromeCast Explained (unofficial):

Google is using a proprietary protocol called RAMP (Remote Application Media Protocol) to control media playback on a ChromeCast device.

The RAMP commands are sent over a web socket connection to the ChromeCast device using JSON notation. Look at my DIAL app that I have open sourced for the sequence of HTTP actions to get the URL for creating the web socket: https://github.com/entertailion/DIAL

Associated with your app you need a receiver HTML page that has a video HTML tag and the Cast receiver javascript library included (same as the Cast SDK sample). You have to start the app associated with the receiver HTML.

Once you have the web socket connection open to the ChromeCast device, there are various commands that allow you to load and control media playback.

The first message you have to deal with is a ping from the device:

["cm",{"type":"ping"}]
The client needs to respond with a "pong" on an interval that is specified with the web socket URL payload:
["cm",{"type":"pong"}]

To load a video use the following RAMP command:

["ramp",{"title":"Video title","src":"http://some/url/to/a/video.mp4","type":"LOAD","cmd_id":0,"autoplay":true}]

The "cmd_id" parameter increments with each command sent from the client. The associated response from the ChromeCast device will have the same "cmd_id" value.

You can use the following command to explicitly ask for status:

["ramp",{"type":"INFO","cmd_id":1}]

However, during my testing the device automatically provided regular status responses during media playback to track the playback progress:

["ramp",{"cmd_id":2,"type":"STATUS","status":{"event_sequence":7768, "state":2, "content_id":"http://some/url/to/a/video.mp4", "current_time":9.208321571350098, "duration":596.5013427734375, "volume":0.5, "muted":false, "time_progress":true, "title":"Video title"}}]

To stop the video:

["ramp",{"type":"STOP","cmd_id":3}]

There doesn't appear to be a pause command. The stop commands actually pauses the video and the user will see a frozen video frame.

To play the video again, you can just play from the current position:

["ramp",{"type":"PLAY","cmd_id":4}]

Or you can start from another position like the beginning of the video:

["ramp",{"position":0,"type":"PLAY","cmd_id":5}]

You can set the volume using the following command:

["ramp",{"volume":0.5,"type":"VOLUME","cmd_id":6}]

Or mute the volume:

["ramp",{"type":"VOLUME","cmd_id":7,"muted":true}]

More Repositories

1

DIAL

DIAL client
Java
142
star
2

Caster

Caster - Command-line control for ChromeCast
Java
86
star
3

Open-Launcher-for-GTV

Launcher app for Google TV
Java
56
star
4

Anymote-for-Java

Java implementation of Anymote protocol for Google TV
Java
34
star
5

Magnificent-Escape-Action

Magnificent Escape is a game for the Google Assistant.
JavaScript
21
star
6

ChromeCast-Arduino

ChromeCast Arduino
Arduino
20
star
7

Gesture-TV

Control your Google TV with Kinect gestures
Java
15
star
8

ChromeCast-Arduino-Button

ChromeCast Arduino Button
Arduino
13
star
9

ChromeCast-Kinect

Controlling a ChromeCast device with a Microsoft Kinect sensor
Processing
12
star
10

hicetnunc-minter-project

Hic Et Nunc Minter Project
JavaScript
12
star
11

Video-Wall

Video Wall
Java
10
star
12

GoogleTV-PIP

How to do live TV PIP in a Google TV app
Java
10
star
13

HemeshColorizer

Hemesh Colorizer
10
star
14

Android-Anymote

Android UI for Anymote-for-Java library
Java
10
star
15

GTV-for-Tasker

Google TV Plugin for Tasker
Java
9
star
16

Overlay-for-GTV

Overlay effects for Google TV
Java
7
star
17

ChromeCastPi

ChromeCastPi
Java
5
star
18

Overlay-News-for-GTV

Overlay news for Google TV
Java
3
star
19

Slideshow-for-GTV

Slideshow app for Google TV
Java
2
star
20

Anymote-Media-Beamer

Beam media files on remote computers to Google TV devices
Java
2
star
21

Android-Shapeways

Android Library for Shapeways API
Java
2
star
22

building-maker

Make 3D buildings
JavaScript
1
star
23

GTV-Tasker-Apps

Utility to get the package and activity names of apps installed on a Google TV device.
Java
1
star
24

Anymote-on-GTV

Running Anymote on a Google TV device
1
star