iOS DRM’d video playback failure
Category: Blog

I’ve long been looking for a solution for playing back iTunes movies on my iPad/iPhone without having to sync the content to the device over USB. By luck, a friend tipped me off to the fact that MobileSafari would allow you to playback DRM’d content served over HTTP. From that news, I quickly SSH’d into my home machine and setup an HTTP server pointing at my iTunes Media folder. Much to my amazement, not only did the content play, but my AT&T U-verse account had more than enough bandwidth to stream even HD content!

This of course set my wheels spinning and made me wonder why apps like AirVideo couldn’t do the same. Being friends with several well respected iOS devs, I asked them what they thought. One (who will remain nameless) emphatically stated that AirVideo didn’t work because they “were doing it wrong” in his own typical cocky style response. I asked how he would suggest doing it, to which I got a rundown of different video frameworks on the platform with no specific details (again, typical). Being suspicious it couldn’t be that easy, I set off to ask a few more developers. Everyone I spoke to seemed to think it would be possible somehow. Sadly, they were all mistaken.

My first course of action was to try the MediaPlayer framework, as it’s the older API and thus had better sample code. After going through the motions to get an MPMoviePlayerController instance, I found that on my iPad the same thing happened as does in AirVideo, complete blackness. Wondering if it might be an iOS version thing, I then tested on three other devices ranging from an iPhone 4 down to a 3G still on 3.0 and still no dice.

My next thought was to use AVFoundation. Unfortunately this is limited to iOS 4, so it ruled out playback on my iPad which is where I wanted it most. Despite that, I set out to learn how to use it. Freaking A did I not expect how hard that would be! Not only are the docs extremely lacking on how to use AVPlayer, there isn’t any sample code available either from Apple. Searching the web, apparently nobody had ever thought to write a blog post on it either. Apple’s developer forums were a bit of help, but just barely. After a bit of trial and error getting a CALayer to render properly in my rudimentary test app, I was up and running with a basic video clip. Then upon switching to an iTunes DRM video, I was back at a black screen again. All that effort, still no dice! :(

Feeling mighty dejected at this point, I decided to see if it working was a browser only thing somehow. My first test was to fire up iCabMobile (a custom Safari implementation). Not to my surprise at this point, it shot up an error immediately about unsupported content type. On a long shot, I decided to test out a UIWebView. Again, still no luck as it errored out too.

At this point, it seems the only way to play DRM’d iTunes content is either via syncing it in iTunes or via MobileSafari over HTTP. With the later being supported, that’s still a big win, but I’m very disappointed there doesn’t seem to be anyway to do it in a custom app. I’m going to keep digging to see if there is a way to do it in a jail broke app, but I doubt it.

If anyone has any tips here, I’m definitely all ears!

-Jeremy

P.S. – after I get a little sleep, I’ll write up a blog post on using AVPlayer & AVPlayerLayer so others don’t endure the same pain I did.

Tags: , , ,

4 Responses to “iOS DRM’d video playback failure”

  1. Sam says:

    I’m dying to see a post, or code snippet about the use of AVPlayer and AVPlayerLayer…

    Like you, I am completely amazed at the lack of documention on their use.

    Thanks,

    -Sam

  2. I’ve recently added playback of DRM content to my streaming movie player StreamToMe.

    In StreamToMe though (unlike non-DRM content which is transcoded into Apple’s HTTP streaming format and played in the app), a dialog appears for DRM content and asks if you want to open the file in Safari without transcoding, and the URL to the DRM file on the server is opened in Safari using -[NSApplication openURL:].

    This is for exactly the reason you’ve discovered — even though Safari can play DRM video, no user apps are allowed using any available API. I suspect this is to avoid a situation where the non-DRM video is available to your application’s memory space.

  3. Piero says:

    Hello, have you found a solution to play itunes drm preview?

Leave a Comment

Spam Protection by WP-SpamFree