English 中文(简体)
表演 In MPMoviePlayer Controller
原标题:Play Video In MPMoviePlayerController
  • 时间:2012-05-02 04:55:31
  •  标签:
  • iphone
  • video

我有问题,利用MoviePlayerController议员拍摄一个嵌入式录像文档。 我的法典:

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [paths objectAtIndex:0];

NSString *proud = [[documentsDirectoryPath stringByAppendingPathComponent:@"archives"] stringByAppendingPathComponent:selectedCountry];

NSString *content = [proud stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];    
NSURL *url = [[NSURL fileURLWithPath:content] retain];   

NSLog(@"%@", url);
player =

[[MPMoviePlayerController alloc] initWithContentURL: url];

[player prepareToPlay];

player.allowsAirPlay = YES;
player.scalingMode = MPMovieScalingModeAspectFit;

player.view.frame = self.view.frame;

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

// ...

[[NSNotificationCenter defaultCenter] 
 addObserver:self
 selector:@selector(movieFinishedCallback:)
 name:MPMoviePlayerPlaybackDidFinishNotification
 object:player];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:player];


[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayerWillExitFullscreen:)
                                             name:MPMoviePlayerWillExitFullscreenNotification
                                           object:player];


[player play];

安保记录仪的返回

var/mobile/Applications/EF62B00B-2906-435C-BC84-036FE14D89E9/Documents/archives/Test%2520-%2520Daddy%2520May%25201%252001:26:35%2520PM.mp4

但是,录像从来就没有播放,尽管在MPMoviePlayerController 电影Finished Callback的标志一中确实触发了电影。 任何想法?

最佳回答

i 认为你只播放录像文件,然后审判这部法律:

NSString *urlStr=[[NSBundle mainBundle]pathForResource:@"Video1VoiceOver.mp4" ofType:nil];
NSURL *url = [NSURL fileURLWithPath:urlStr];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[self.view addSubview:moviePlayer.view];
moviePlayer.view.frame = CGRectMake(174,154,720,428);  
[moviePlayer play];




[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(moviePlayBackDidFinish) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification 
                                           object:nil];
问题回答

引言

MPMoviePlayerViewController *playerViewController =[[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL fileURLWithPath:@"FileName"]];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:)name:MPMoviePlayerPlaybackDidFinishNotification object:[playerViewController moviePlayer]];
playerViewController.view.frame=CGRectMake(Set the frame);
[self.view addSubview:playerViewController.view];
//---play movie---

player = [playerViewController moviePlayer];




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签