5

In my app, I want to reproduce a view which looks exactly like the "Videos" native iPad app (it displays Movies and iTunes U videos located on the iPad).

I don't know how to access those elements on the iPad (Movies and iTunes U).

I've played with everything mentionned in the Apple documentation "IPod Library Access Programming Guide":

  • MPMediaItem
  • MPMediaPickerController
  • MPMediaQuery
  • MPMoviePlayerController …etc…

I thought I was close with MPMediaItem and MPMediaQuery, as two of the Flags seemed promising:

MPMediaTypeMovie = 1 << 8 MPMediaTypeVideoITunesU = 1 << 12

However, all the results I get only include songs.

Am I using the right classes to access those items? Considering the results I get, it seems like those classes can only access media items which are part of the iPod library, which I am not sure is the case for Movies and iTunes U videos.

I know that this is possible, because I've seen another app which accesses it (It's called "VideoPix"). It presents the "Video Library" in a Popover view, so at first I suspected it was using the MPMediaPickerController, because on the iPad, you can only use it in a Popover, but again, when I tried it, all I saw was songs, no Movies or iTunes U items :(

Thank you in advance!

Fred

fredericouimet
  • 151
  • 1
  • 5
  • Found this comment in the documentation: "Note: iPod library access applies only to audio-based media items. You cannot play video podcasts, movies, or television shows from the iPod library." This means I won't find what I'm looking for using the ipod library API... – fredericouimet Apr 14 '12 at 16:01

2 Answers2

1

Check out the AVMovieExporter sample code, it is doing what you are talking about. I'm not sure about playback yet, but it is definitely listing them, although the DRM ones are not cooperating as nicely.

It is supposed to show an icon for each movie and when I ran it the one purchased (DRM) movie I have comes back with no thumbnail and in the console I get:

AVMovieExporter[642:5b17] couldn't generate thumbnail, error:Error Domain=AVFoundationErrorDomain Code=-11836 "Cannot Open" UserInfo=0x1cd9d550 {NSLocalizedDescription=Cannot Open, NSUnderlyingError=0x1e09b5b0 "The operation couldn\342\200\231t be completed. (OSStatus error -12161.)", NSLocalizedFailureReason=This app is not authorized to play this file.}
garafajon
  • 1,278
  • 13
  • 15
0

Check out ALAsset in the AssetsLibrary.framework.

Its a similar concept of what you are trying to do above, you basically query the ALAssetLibrary for assets of types (ALAssetTypePhoto | ALAssetTypeVideo) and presto, you have a collection you can display to the user.

MweyaMutsvene
  • 543
  • 4
  • 15
  • It seems this only gives access to the user's videos (camera roll, etc.). After searching a lot, it looks like: 1) There is no way to access the ITunes U videos, and 2) Although movies (those found in the "Videos" native ios application) can be accessed through MPMediaQuery, they return NULL for their URL when using "valueForProperty:MPMediaItemPropertyAssetURL", possibly because they are DRM protected (not sure if the DRM is the cause, or if DRM even applies to movies, but they sure return NULL). – fredericouimet Jan 30 '13 at 02:56