hemant
hemant

Reputation: 1843

Play Videos in MPMoviePlayerController from a URL?

i am trying to play a video from a Url with help of MPMovieplayer which loads it in the Quicktime player while i want the video to play in my application only(no background mode)?? how can i achieve that?? will playing the video in a UIWebview instead of MPMoviePlayer work?? Also when QuickTime Player loads only Audio plays and no video is displayed?? i am using the following code

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";

NSURL *videoURL = [NSURL URLWithString:videoFilepath ];

MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(playbackFinishedCallback:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:movie];

[self presentMoviePlayerViewControllerAnimated:movie];

Upvotes: 4

Views: 3909

Answers (2)

GhostRider
GhostRider

Reputation: 1207

web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];

NSString *urlAddress = @"HTTP://";


NSURL *url = [NSURL URLWithString:urlAddress];


NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[web loadRequest:requestObj];

Upvotes: -2

RolandasR
RolandasR

Reputation: 3047

you have to add movie.view to your view

Upvotes: 5

Related Questions