0

i'm trying to play a video from URL, the video i want play is a iTunes preview video like this: http://a236.v.phobos.apple.com/us/r1000/051/Video/ec/1d/7f/mzm.hwbfvfdq..640x480.h264lc.d2.p.m4v i have tried on the iPhone, and open the player, i see the buffer is loaded, but if i play it i don't see anything, how i can do?...this is the code:

- (void) moviePlayBackDidFinish:(NSNotification*)notification {

MPMoviePlayerController *moviePlayer = [notification object];

[[NSNotificationCenter defaultCenter] removeObserver:self      
                                                name:MPMoviePlayerPlaybackDidFinishNotification
                                              object:moviePlayer];

if ([moviePlayer 
     respondsToSelector:@selector(setFullscreen:animated:)])
{
    [moviePlayer.view removeFromSuperview];
}
[moviePlayer release];
}

- (IBAction)playVideo:(id)sender {

NSURL *url = [NSURL URLWithString:@"http://a236.v.phobos.apple.com/us/r1000/051/Video/ec/1d/7f/mzm.hwbfvfdq..640x480.h264lc.d2.p.m4v"];

MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayBackDidFinish:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:moviePlayer];

moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;

[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];


}
Piero
  • 9,173
  • 18
  • 90
  • 160

2 Answers2

1

Since you are trying to access a .m4v file from iTunes. The DRM protection is the problem.

EDIT: Your link works in Quicktime, but not in the browser.

Apple does not allow playing DRM protected music or videos from iTunes in the MPMoviePlayerConroller (which includes the previews).

Please also see following link on Stackoverflow

Community
  • 1
  • 1
Max B.
  • 881
  • 10
  • 21
0

when i copy&paste the link (http://a236.v.phobos.apple.com/us/r1000/051/Video/ec/1d/7f/mzm.hwbfvfdq..640x480.h264lc.d2.p.m4v) to a browser , i did not see/hear the video/audio also..

first there seems to be more than 1 point between hwbfvfdq and 640x480 , maybe there is some characters you did not copy or did not see.

and also, since this is a url from itunes, they may be a usage of tokens to avoid users to reach videos like this url link permanently.

hope this helps ..

p.s. : have you tried your code with a direct url of a movie you know?

iremk
  • 677
  • 1
  • 5
  • 16
  • it's apple that give this information: http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html the link it's not wrong... – Piero May 02 '12 at 00:42
  • Where did you get the url you are trying to use? The Apple documentation page you reference only shows you how to use the iTunes store search API which returns JSON metadata for items in the store. It doesn't talk about access to Apple's video content. – jonkroll May 02 '12 at 01:06