FORUMS
Remove All Ads from XDA
Honor 7x
Win an Honor 7X!

DeskCast + VB.NET Source

8 posts
Thanks Meter: 5
 
By stooged, Junior Member on 23rd September 2014, 10:10 AM
Post Reply Email Thread
this is a little project I have been working on to cast videos from my desktop pc with hard drives mapped from my server
it works much like fling did but built with vb.net not java

you will need .Net Framework 4.6.1 installed to run or compile this application
the VB source was built Visual Studio 2013
the C# source was built Visual Studio 2017

if you have multiple network adapters this might not work for you as it might not resolve your local ip address correctly

ffmpeg is used to transcode videos that are not mp4, when transcoding you cannot seek/select play position

when streaming from harddrive mp4 files should have the ability to seek/select play position

you can drag and drop video files onto application to play them(like Fling)

it also has the option to play files from urls

it should be pretty simple to use for you
just open the program and it should find chromecasts on the network then select the chromecast you want to cast to then click "Connect CC" then drag and drop video onto it and it should start playing


it should work for rooted and non rooted chromecasts
when using a rooted chromecast the receiver is hosted by DeskCast its self
when using a non rooted chromecast the receiver is one of the apps in the google whitelist


the receiver files deskcast sends to the rooted chromecast are in the "data" folder of the application, so you can edit these too
I did play with the idea of the chromecast its self hosting the receiver files but the www folder in the chromecast is locked/read only so that might be something for team eureka to add to the webpanel they have

this works for me very well, but I cant say that it will work for you at all
im really only posting the source so other people can use it for information or ideas to make something better than I ever could

I hope this is useful to someone

VB .NET Source
https://github.com/stooged/DeskCast

C# Source
https://github.com/stooged/DeskCastC
Attached Files
File Type: zip DeskCast.zip - [Click for QR Code] (11.73 MB, 668 views)
File Type: zip DeskCast_Src.zip - [Click for QR Code] (11.92 MB, 655 views)
The Following 5 Users Say Thank You to stooged For This Useful Post: [ View ] Gift stooged Ad-Free
 
 
23rd September 2014, 03:18 PM |#2  
Junior Member
Flag Gothenburg
Thanks Meter: 13
 
More
Quote:
Originally Posted by stooged

this is a little project I have been working on to cast videos from my desktop pc with hard drives mapped from my server
it works much like fling did but built with vb.net not java

you will need .Net Framework 4.5 installed to run or compile this application
it was built Visual Studio 2012 so you will need that to compile it

if you have multiple network adapters this wont work for you as it wont resolve your local ip address

ffmpeg is used to transcode videos that are not mp4, when transcoding you cannot seek/select play position

when streaming from harddrive mp4 files should have the ability to seek/select play position

you can drag and drop video files onto application to play them(like Fling)

it also has the option to play files from urls

it should be pretty simple to use for you
just open the program and it should find chromecasts on the network then select the chromecast you want to cast to then click "Connect CC" then drag and drop video onto it and it should start playing


it should work for rooted and non rooted chromecasts
when using a rooted chromecast the receiver is hosted by DeskCast its self
when using a non rooted chromecast the receiver is one of the apps in the google whitelist


the receiver files deskcast sends to the rooted chromecast are in the "data" folder of the application, so you can edit these too
I did play with the idea of the chromecast its self hosting the receiver files but the www folder in the chromecast is locked/read only so that might be something for team eureka to add to the webpanel they have

this works for me very well, but I cant say that it will work for you at all
im really only posting the source so other people can use it for information or ideas to make something better than I ever could

I hope this is useful to someone

You can start your own webserver if you like. You got one built into /bin/busybox

in shell you can start it with:

/bin/busybox httpd -p 8000 -h /data/www -c /data/httpd.conf

httpd.conf contains:
A:*
/cgi-bin:a:a

echo "It's working!" > /data/www/index.html

open <chromecastip>:8000 and you got your self a webserver =)

if it not working, try a newer busybox binary, the one in /bin is a bit old.

I've been looking a way to use CC as a host for casting so this was fun to see =)
24th September 2014, 06:03 AM |#3  
OP Junior Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by Mape0661

You can start your own webserver if you like. You got one built into /bin/busybox

in shell you can start it with:

/bin/busybox httpd -p 8000 -h /data/www -c /data/httpd.conf

httpd.conf contains:
A:*
/cgi-bin:a:a

echo "It's working!" > /data/www/index.html

open <chromecastip>:8000 and you got your self a webserver =)

if it not working, try a newer busybox binary, the one in /bin is a bit old.

I've been looking a way to use CC as a host for casting so this was fun to see =)

yeah I did try that with a new busybox binary installed to the chromecast
the webserver worked and the receiver files were hosted by the chromecast in the /data/www folder but the receiver wouldn't allow a connection to the websocket
I think it had issues with the domain/ip being the same as the chromecast

it might be something that can be changed in the rom by team eureka.

the idea of a whitelist and a receiver being on the chromecast its self might make it possible to use offline when streaming media from your pc or tablet, Netflix and hulu and apps like that we know wont work offline

I guess I will just keep playing around with it to see if I can get it to work
24th September 2014, 08:48 AM |#4  
Junior Member
Flag Gothenburg
Thanks Meter: 13
 
More
Quote:
Originally Posted by stooged

yeah I did try that with a new busybox binary installed to the chromecast
the webserver worked and the receiver files were hosted by the chromecast in the /data/www folder but the receiver wouldn't allow a connection to the websocket
I think it had issues with the domain/ip being the same as the chromecast

it might be something that can be changed in the rom by team eureka.

the idea of a whitelist and a receiver being on the chromecast its self might make it possible to use offline when streaming media from your pc or tablet, Netflix and hulu and apps like that we know wont work offline

I guess I will just keep playing around with it to see if I can get it to work

I was experimenting with this few weeks ago, I installed Google CastVideo from github
https://github.com/googlecast/CastVideos-chrome

Got a page working, hosted by chromecast, but I was never able to remove the DEMO text all over the videos. But it worked nicely to stream mp4 files from a samba share.

I travel a lot and my plan was/is to use a travel router and mount a samba share to my linux server with ssh

something like this on chromecast
ssh -C -f -N -p 22 -L 440:127.0.0.1:445 <username>@<serveradress>
sudo mount -t cifs //127.0.0.1/<share> <mountpoint> -o port=440,user="<user>",password="<password>"

you need a new dropbearmulti, got a working one (armv61) from
http://landley.net/aboriginal/downlo...naries/extras/


Did you try with lighttpd?
-----------------------------------

cp /system/etc/httpd.conf /data (change port and webroot in httpd.conf, 3000 and /data/www worked for me)
mkdir /data/www
lighttpd -m /system/usr/lib -f /data/httpd.conf
25th September 2014, 06:04 AM |#5  
OP Junior Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by Mape0661

Did you try with lighttpd?
-----------------------------------

cp /system/etc/httpd.conf /data (change port and webroot in httpd.conf, 3000 and /data/www worked for me)
mkdir /data/www
lighttpd -m /system/usr/lib -f /data/httpd.conf


no I just tried busybox httpd
but I will give lighttpd a go
26th September 2014, 08:14 PM |#6  
OP Junior Member
Thanks Meter: 5
 
More
I did find one way to make the chromecast host the receiver or any html content

in the post to the chromecast to loadup the receiver if you use the data uri scheme for the post data you can make the chromecast launch html
so as the url for the receiver you can use something like data:text/html;base64,html_encoded_in_base64

I did a test with the receiver.html file from the Fling source and it worked fine


here is a php script that should allow you to play a mp4 file on the chromecast using this method with a single post

Code:
<?php

$ChromeCastIP = "192.168.1.102";
$ChromeCastApp = "Fling";
$VideoURL = "://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4";

$htmldata = base64_encode("
<html>
<head>
<title></title>
</head>
<body bgcolor=#000000 topmargin=0 leftmargin=0 bottommargin=0 rightmargin=0 marginwidth=0 marginheight=0>
<video width='100%' height='100%' autoplay>
<source src='http$VideoURL' type='video/mp4'>
</video> 
</body>
</html>
");

$postdata = "data:text/html;base64,$htmldata"; 

$fp = fsockopen($ChromeCastIP, 8008, $errno, $errstr, 30);
$out = "POST /apps/$ChromeCastApp/ HTTP/1.1\r\n";
$out .= "Accept-Language: en-us\r\n";
$out .= "Accept: */*\r\n";
$out .= "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36\r\n";
$out .= "Host: $ChromeCastIP:8008\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Origin: chrome-extension://boadgeojelhgndaghljhdicfkmllpafd\r\n";
$out .= "Content-Length: ".strlen($postdata)."\r\n";
$out .= "Connection: Close\r\n\r\n$postdata";
fwrite($fp, $out);
sleep(2);
fclose($fp);


?>
30th September 2014, 03:56 PM |#7  
Junior Member
Flag Gothenburg
Thanks Meter: 13
 
More
Prompt
Quote:
Originally Posted by stooged

I did find one way to make the chromecast host the receiver or any html content

in the post to the chromecast to loadup the receiver if you use the data uri scheme for the post data you can make the chromecast launch html
so as the url for the receiver you can use something like data:text/html;base64,html_encoded_in_base64

I did a test with the receiver.html file from the Fling source and it worked fine


here is a php script that should allow you to play a mp4 file on the chromecast using this method with a single post

Code:
<?php

$ChromeCastIP = "192.168.1.102";
$ChromeCastApp = "Fling";
$VideoURL = "://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4";

$htmldata = base64_encode("
<html>
<head>
<title></title>
</head>
<body bgcolor=#000000 topmargin=0 leftmargin=0 bottommargin=0 rightmargin=0 marginwidth=0 marginheight=0>
<video width='100%' height='100%' autoplay>
<source src='http$VideoURL' type='video/mp4'>
</video> 
</body>
</html>
");

$postdata = "data:text/html;base64,$htmldata"; 

$fp = fsockopen($ChromeCastIP, 8008, $errno, $errstr, 30);
$out = "POST /apps/$ChromeCastApp/ HTTP/1.1\r\n";
$out .= "Accept-Language: en-us\r\n";
$out .= "Accept: */*\r\n";
$out .= "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36\r\n";
$out .= "Host: $ChromeCastIP:8008\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Origin: chrome-extension://boadgeojelhgndaghljhdicfkmllpafd\r\n";
$out .= "Content-Length: ".strlen($postdata)."\r\n";
$out .= "Connection: Close\r\n\r\n$postdata";
fwrite($fp, $out);
sleep(2);
fclose($fp);


?>

Got it working =), Very cool.

I tryed to make php work on Chromecast. At the moment I only got a test page working with some old php binaries. But the php-cli are working fine!
1st October 2014, 11:34 AM |#8  
Junior Member
Thanks Meter: 0
 
More
Can you host this in github? I'd like to contribute to this project
3rd October 2014, 05:42 AM |#9  
OP Junior Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by Giswald

Can you host this in github? I'd like to contribute to this project

I have never used github before but I think this worked

https://github.com/stooged/DeskCast
6th October 2014, 03:54 PM |#10  
Junior Member
Thanks Meter: 4
 
More
What's the main difference between the chrome extension "VideoStream for Google Chromecast" ?
Seems it can do the same job.
7th October 2014, 07:12 AM |#11  
OP Junior Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by lancillotto

What's the main difference between the chrome extension "VideoStream for Google Chromecast" ?
Seems it can do the same job.

you don't need the chrome browser which I don't use, its junk imo.
no ads.
its free.
open source.

the main point of this is to just encourage more people to develop more things for rooted chromecasts, not everyone codes in languages that make chrome browser extensions or android apps etc.

if you look at fling its open source and is a good source of information for anyone that wants to develop standalone applications for the chromecast.
I think things like videostream are great for people who just want something that will play a file, but charging money for things and closed source projects don't really help other developers.

videostream is a good extension it has playlist support, a custom tv part, can be controlled from your phone etc.
but its transcoding is done using ffmpeg and x264 projects which are opensource and free, without those people doing amazing work on those open source projects we wouldn't be able to transcode videos.

without team eureka we wouldn't have rooted chromecasts and thats open source and free.

I made this project for my own personal use to cast media to my projector and TV's around my house, I started using fling but that stopped working so I used the source as a guide to create deskcast in a language I could understand so I could maintain it and keep it working.
I decided to share it here because this is where I found fling and the team eureka rom, its not intended to compete with other projects or extensions its more of a source code dump for anyone out there that uses vb.net.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes