DrHouse
iPF Noob
Playing around with my iPad/iPhone and Ubuntu, I got an idea that could help Ubuntu Users who have an Apple TV 2...
The goal is to be able to stream any movie (mp4 format) from a local drive using the iPad/iPhone as the streamer to the Apple TV 2. First, I looked as a few free apps to see what was possible. In the end, I needed to download the movie on my device and then stream to the Apple TV 2. That's not what I wanted to do. I want the stream directly from the remote disk without having to download the file on my device.
So I figured out that some websites allow AirPlay to be used on their website... After a few searches, I found out how to embed a video in a webpage, so it would be airplayable using the iOS device. Here is the basic HTML 5 code:
Next step was to create a webpage that would scan a folder, and embed all those movies into a HTML page...
So to make it quick, I created a small bash script to do the job. Of course, PHP or other web language can be used to do the same job, but I wanted to do a fast proof of concept...
Here is the script:
You have to install Apache2 to have a webserver, and create a symlink in "/var/www/" that will point to your videos folder
Run the script in the folder of your videos so it will create a file called "index.html". Then, using your iDevice, goto "http://192.168.1.6/videos" (Put your own ip adress, of course!)
The results will give you this (using my iPhone):
Then just play any movie and activate AirPlay towards your Apple TV 2...
This is a pretty basic script, but a lot more can be done. If you use some language like PHP, then you could scan dynamically for sub-folders, any supported media type, have more details about each movie, etc...
So that means for Ubuntu fellows, iTunes is not needed anymore if you want to watch your local movies on your Apple TV 2!
Have fun!
The goal is to be able to stream any movie (mp4 format) from a local drive using the iPad/iPhone as the streamer to the Apple TV 2. First, I looked as a few free apps to see what was possible. In the end, I needed to download the movie on my device and then stream to the Apple TV 2. That's not what I wanted to do. I want the stream directly from the remote disk without having to download the file on my device.
So I figured out that some websites allow AirPlay to be used on their website... After a few searches, I found out how to embed a video in a webpage, so it would be airplayable using the iOS device. Here is the basic HTML 5 code:
Code:
<video controls='true' width='120' height='80' x-webkit-airplay='allow' src='somemovie.mp4'></video>
So to make it quick, I created a small bash script to do the job. Of course, PHP or other web language can be used to do the same job, but I wanted to do a fast proof of concept...
Here is the script:
Code:
#!/bin/bash
echo "<HTML>">index.html
echo "<body>">>index.html
echo "<H3>Movies List</h3>">>index.html
for f in *.m4v; do
echo "$f<br>">>index.html
echo "<video controls='true' width='120' height='80' x-webkit-airplay='allow' src='$f'></video><br>">>index.html
done
echo "</body>">>index.html
echo "</HTML>">>index.html
Code:
sudo ln -s /home/patrick/Videos /var/www/videos
The results will give you this (using my iPhone):
Then just play any movie and activate AirPlay towards your Apple TV 2...
This is a pretty basic script, but a lot more can be done. If you use some language like PHP, then you could scan dynamically for sub-folders, any supported media type, have more details about each movie, etc...
So that means for Ubuntu fellows, iTunes is not needed anymore if you want to watch your local movies on your Apple TV 2!
Have fun!