Tuesday, January 25, 2011

Stream iTunes Movies from Mac to iPhone Safari

Don't want to sync iTunes movies to your iPhone? You can stream them from your Mac's iTunes movie library to your iPhone and play them right in Safari!

I cribbed the way to do it from here and here. Both of those web pages copied the procedure from an Embraceware blog post that is apparently now gone. I'll modify the procedure to fix typos, make it easier to use, make it clearer, and make it current:

Step 1: Open Sharing in System Preferences on your Mac and enable Web Sharing. This will turn on the built-in web server that comes in Mac OS X. Under Your computer's website in the Sharing Preferences panel you will now see a URL containing an IP address. Mine is as of this writing Later on in this post, I'm going to change that ... but never mind for now. Whatever your computer's URL is, make a note of it now.

This IP address (in my case, is known only on your local home WiFi network. It won't work on your iPhone if you're not at home. (I'll talk about how you can stream your movies from a remote WiFi hotspot later in this post.)

Step 2: On the Mac, open the Terminal application (located in the /Applications/Utilities folder) and type the following:

cd /Library/WebServer/Documents/

and press Enter. (Note the space after cd.)

Step 3: Locate iTunes' Movies folder on your Mac. Mine is /Volumes/Songcatcher 2 2/Users/songster/Music/Main iTunes Library/iTunes Music/Movies. One way to locate yours: select Movies under Library in the main iTunes window, then right-click or control-click on any movie and choose Show in Finder from the pop-up menu. A Finder window will typically open on your entire Movies folder. Leave this window open until you are done with this entire set of steps.

Step 4: In Terminal, type the following:

ln -s [fully specified path to your iTunes Movies folder] Movies

An easy way to do it:
  1. In the Terminal window, type ln followed by a space.
  2. Type -s followed by a space.
  3. Switch to Finder to reveal again the Movies folder window opened in the previous step. Drag the icon at the top of the window (in my case and probably in yours, too, its name is "Movies") and drop it right onto the Terminal window. 
  4. Type a space and then type the word Movies.
  5. In my case, the text I saw in the terminal window at this point was: ln -s /Volumes/Songcatcher\ 2\ 2/Users/songster/Music/Main\ iTunes\ Library/iTunes\ Music/Movies Movies.
  6. Press Enter.
Doing that does not — repeat, does not — produce any output in the Terminal window. What it does, it does behind the scenes.

Notice that there are '\' (backslash) characters in /Volumes/Songcatcher\ 2\ 2/Users/songster/Music/Main\ iTunes\ Library/iTunes\ Music/Movies. They're put there automatically when you drop the "Movies" folder's icon onto the Terminal window, so that Terminal won't be confused by any space characters embedded in the fully specified path to the Movies folder.

The last word in the string

ln -s /Volumes/Songcatcher\ 2\ 2/Users/songster/Music/Main\ iTunes\ Library/iTunes\ Music/Movies Movies

is (that's right, you're not seeing double) Movies. It could just as easily have been something else, like MyMovs. I'll call it an "alias," since what the ln -s command does is create a "symbolic link" between that alias and /Volumes/Songcatcher\ 2\ 2/Users/songster/Music/Main\ iTunes\ Library/iTunes\ Music/Movies. A symbolic link and an alias are roughly the same thing. In this case, the symbolic link or alias will allow a browser such as Safari to substitute in a URL the single word Movies for the humongous string /Volumes/Songcatcher\ 2\ 2/Users/songster/Music/Main\ iTunes\ Library/iTunes\ Music/Movies.

Step 5: In Safari on your iPhone, manually type into the Web address field the URL for your Mac's shared website. Mine is Then type in (without an intervening space) your alias from above. Mine is Movies. Result, in my case: (This is where using an alias really comes in handy.) Now hit "Go" on the iPhone's on-screen keyboard. If all goes well, you'll soon see on the iPhone screen something like:

Notice that there is a folder icon shown in the list just depicted. It happens to contain several "little movies" or clips under the umbrella title "All You Have To Do Is Listen." I can access all those little movies in iPhone Safari simply by tapping on the folder icon shown above. Folders and subfolders (and sub-subfolders, etc.) work just fine in this methodology.

So ...  still in Safari on my iPhone, I now just have to tap a listed movie — I'll choose Milk (2008).m4v — and I'll see something like this on my iPhone's screen:

It's playing in Safari on my iPhone, using the iPhone's copy of QuickTime! (This fact, by the way, tells you that only movies that are in a QuickTime-playable format will work when you are using this method.)

If the QuickTime controls don't vanish in a few seconds, by the way, tap the iPhone's screen to make them vanish (after hitting the Play button if the movie is paused). When you are done watching the movie, tap the screen again to bring up the controls, then tap "Done" at upper left.

This works, as far as I know, for any QuickTime-playable movie that will play successfully in iTunes on the Mac ... including those video files shown as "Protected" in iTunes, meaning that they use DRM (digital rights management) to prevent unauthorized copying.

Cool, no?

What about TV Shows?

If you have TV shows in your iTunes library, as I do, they're not in Movies but in the TV Shows porton of iTunes. Here's how I set up to stream those:

  • My Mac's URL was, of course, still the same:
  • In Terminal, I typed cd /Library/WebServer/Documents/.
  • I used the iTunes "Show in Finder" trick to open a Finder window for one of the items in the TV Shows folder within, in my case, my iTunes Library/iTunes Music folder. (Make sure you are looking at TV Shows and not Movies this time.)
  • In Terminal, I typed in ln -s (note the embedded and trailing spaces).
  • I dragged the TV Shows icon from the top of the Finder window opened two steps ago and dropped it into the Terminal window, and then (this is important!) I typed another space.
  • I typed TVShows (without an embedded space!) into the Terminal window, and pressed Enter.
  • In Safari on the iPhone, I entered the URL to bring up a list of files and folders representing, this time, my iTunes TV Shows collection.

Now I had two different URLs  to remember in Safari on the iPhone, so I bookmarked them both in a Bookmarks folder.

I could have repeated the entire procedure above with any other folders on my Mac that contain QuickTime-playable videos, simply by changing the alias from Movies or TVShows to something unique, such as MoreMovies. Unfortunately, though I have a large collection of movies that I can play (with on-the-fly format conversion) on my iPhone using the Air Video app, few if any of them are QuickTime-compatible. They can't be streamed to my iPhone using the Safari/QuickTime method documented here. (But they can be streamed by the method I talked about in The Marvelous Air Video App: It Streams Videos from Your Mac or PC to iPhone/iPad/iPod Touch.)

This method also works, as far as I know, on an iPod Touch or an iPad.

What about Connecting Remotely?

If you are near a WiFi hotspot away from home, this method will work just as it does when you are near your home WiFi router. It may not, depending on speed limitations imposed by the hotspot in question, work as reliably and smoothly as it does in your house. But it does work.

To get this all to work when I'm out and about, I created a free account at DynDNS.com. Then I created a DynDNS "hostname" via visiting this page.

I chose dalekhound as my hostname, since I'm a Doctor Who fan. (The Daleks are one of the Doctor's most grievous enemies, and the "hound" part refers to an early Doctor's canine helper, the robotic "K-9.")

As I was setting up the dalekhound hostname at DynDNS, I made sure to click on Your current location's IP address is ... in order to make sure DynDNS had fetched and was using the current IP address of my router — not that of my computer. I also visited the DynDNS Support page and clicked on the button allowing me to download the DynDNS Updater software. Once installed and set up on my Mac, DynDNS Updater keeps track of my router's IP address and notifies the DynDNS site if it changes.

After setting things up in DynDNS, I was able to browse in Safari on my iPhone to the URL http://dalekhound.webhop.biz/Movies/ to see my iTunes Movies list, or to the URL http://dalekhound.webhop.biz/TVShows/ to see my iTunes TV Shows list. I could do this from any browser on any platform in any location that has a usable WiFi hotspot ... including Safari on my iPhone at, say, my local Panera.

Once a list was visible in iPhone Safari by means of linking to my Mac via this dynamic DNS name, dalekhound.webhop.biz, I could tap any video to play it or tap any folder to open it.

In Safari on the iPhone I also bookmarked, in addition to the two URLs I set up earlier for use at home, these two URLs to be used remotely: http://dalekhound.webhop.biz/Movies/ and http://dalekhound.webhop.biz/TVShows/.

There's no law against using the same remote URLs while in range of your home WiFi network, by the way.

Connection Problems

After I filed the above, I tried using the remote URLs from Safari on my iPhone once again and found to my surprise that those URLs had stopped working! To get them working again, I found I had to use "port forwarding," a.k.a. "port mapping," on my router.

If you have connection problems, you may need to do the same.

To diagnose my own connection problem, I first went to Why can't I connect? at the DynDNS website. It had me run some tests, which were all successful, then led me to the Loopback Connections page, where I was given a brief rundown on how computers behind a router might have trouble using a DynDNS "webhop" URL. It then urged me to use information given in Routers and Port Forwarding to configure my router to "forward" one of its so-called "ports" to my iMac.

So ... port forwarding is a thing that is done by means of configuring your router. My router is an Apple AirPort Base Station. Every router model has a different way to set up port forwarding, so the way I did it with mine would not necessarily work for yours, and I won't go into any more detail about that. You may need to visit PortForward.com for a detailed guide on how to configure your router's port forwarding features.

Speaking very generally, then, I set my router up to forward the public TCP port whose number is 80 (this is the default port number for the Personal Web Sharing service) to the computer whose private IP address is, using the private TCP port whose number is also 80.

I also had to tell Network Preferences on my iMac itself to configure my iMac's network connection Using DHCP with manual address. The manual IP address I chose was, to match that which I specified in setting up port forwarding on my router.

Once I did all that, my DynDNS URLs began working again in iPhone Safari!

I have no idea why those URLs worked at first and then stopped working. I don't really understand why port forwarding fixed the problem. But it did ..

By the way, I did not have any connection problem when using the local IP address, but after I started doing port forwarding, I had to change the local IP address to in the relevant bookmarks in Safari on my iPhone to get them to work. This was because I had intentionally changed the IP address of my computer from to

Poor Remote Performance

A few days after I filed this post, I got my first chance to try streaming iTunes movies to Safari/QuickTime on my iPhone when I was logged in via remote WiFi hotspots. It was a big bust! Remote performance was terrible!

I tried two hotspots, one in a nearby Panera and one in a local public library. Neither hotspot would stream movies to Safari on my iPhone in any kind of playable fashion.

I have two types of movies in my iTunes library: DRM-protected and non-protected. The non-protected movie I tried was "Harvey," starring James Stewart, a rip of a DVD (which I own) that I made using HandBrake and then converted to iTunes-playable format. It wouldn't start playing over either remote WiFi connection.

Nor would a DRM-protected copy of "Secretariat," purchased from the iTunes store.

Both these movies play just fine in iPhone Safari when I'm connected to my home WiFi setup.

Moral of the story: Some remote WiFi connections appear to be too slow to stream iTunes movies to an iPhone.

More about Remote Performance

It's been a couple of weeks since I wrote the above about "poor remote performance," and I need to amend it. I have changed the way my Mac connects to my home router. Now I'm using just an Ethernet connection from Mac to router, where before I had both that and an 802.11 wireless connection active on my Mac. I changed my connection setup in my Mac's Network Preferences to see whether it would speed up movie streaming to my iPhone, and it did.

Now I can go to (say) Panera or my public library or even my barber shop (where there is no accessible WiFi hotspot) and stream video remotely to my iPhone. I can do it the way I described in this post, or I can do it the way I talked about in The Marvelous Air Video App: It Streams Videos from Your Mac or PC to iPhone/iPad/iPod Touch. I can use a WiFi or 3G connection. I'm not saying the video never freezes, waiting for more data to be buffered from afar. But that's ultra-rare with WiFi, and it happens very seldom with 3G, as long as I have enough "bars" and not too weak a signal.

The lesson here is that remote playback success depends on the end-to-end connection speed and will profit by your eliminating any roadblocks and bottlenecks in your local network at home.

1 comment:

Anonymous said...

Now you can stream from iTunes directly to devices with iOS 7.1 by just turning on the Show All settings in iTunes & App Store, and Video. Then all your movies will show and you can choose to download or stream. This website has a video and prezi that shows how it's done.