Reputation: 4728
I want to play a movie in my app and the video is stored in my ipad library.
Can anyone provide me the necessary guidance for it?
Upvotes: 0
Views: 339
Reputation: 63667
See a sample of a custom view/viewController combo in Pragmatic iPad Programming. Check the source code for chapter 8 (free download from that page). They use a video provided as a file inside the project. Btw, if the file in the video appears red in XCode, you'll have to remove it and re add it, I think the project definition is a bit screwed.
Upvotes: 0
Reputation: 10182
MPMediaItem
of the video you want using MPMediaQuery
Get the Asset URL like this:
NSURL *videoURL = [mediaItem valueForProperty:MPMediaItemPropertyAssetURL];
Instantiate an MPMoviePlayerViewController using videoURL
as the content URL.
If the video is stored in your App's bundle then do this to get the URL:
NSURL *videoURL = [[NSBundle mainBundle] URLForResource:@"nameoffile" withExtension:@"mp4"];
Upvotes: 1