Iphone MPMoviePlayerViewController和PINK out可全屏显示
我已经在网站上搜索过了,但还没有找到和我一样的问题 当我在视频上进行剪辑时,会调用通知MPMoviePlayerPlaybackDidFinishNotification 之后,“完成”按钮使视频暂停,播放器工作不正常 我不明白为什么这个通知被称为 这是我的密码Iphone MPMoviePlayerViewController和PINK out可全屏显示,iphone,objective-c,ipad,mpmovieplayercontroller,Iphone,Objective C,Ipad,Mpmovieplayercontroller,我已经在网站上搜索过了,但还没有找到和我一样的问题 当我在视频上进行剪辑时,会调用通知MPMoviePlayerPlaybackDidFinishNotification 之后,“完成”按钮使视频暂停,播放器工作不正常 我不明白为什么这个通知被称为 这是我的密码 - (id) init { self = [super init]; movie=[[MPMoviePlayerViewController alloc] init]; //we init the f
- (id) init
{
self = [super init];
movie=[[MPMoviePlayerViewController alloc] init];
//we init the frame here and after the view rotate the video
[movie.view setFrame: CGRectMake(0, 0, 1024,768)];
return self;
}
+ (MoviePlayerManager*) getInstance
{
static MoviePlayerManager *movieSingleton;
if (movieSingleton==nil)
{
movieSingleton = [[MoviePlayerManager alloc]init];
}
return movieSingleton;
}
- (void) load:(NSURL*) a_videoFile withType:(VideoType)a_type
{
type = a_type;
[movie.moviePlayer setContentURL:a_videoFile];
switch (type) {
case VT_INTRO:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallbackIntro:) name:MPMoviePlayerPlaybackDidFinishNotification object:movie.moviePlayer];
break;
case VT_RESPONSE:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallbackResponse:) name:MPMoviePlayerPlaybackDidFinishNotification object:movie.moviePlayer];
break;
default:
NSLog(@"video Type not initialised");
break;
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieIsReadyToPlay:) name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification object:movie.moviePlayer];
[movie.moviePlayer prepareToPlay];
}
-(void)myMovieIsReadyToPlay:(NSNotification*)aNotification
{
[gsDelegate.view addSubview:movie.view];
[movie.moviePlayer play];
movie.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
}
- (void) myMovieFinishedCallbackIntro:(NSNotification*)aNotification
{
NSNumber* reason = [[aNotification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
NSLog(@"%d",reason);
if(aNotification != nil)
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:movie.moviePlayer];
[gsDelegate movieIntroDidStop];
}
}
NSNumber*reason=[[aNotification userInfo]objectForKey:MPMoviePlayerPlaybackDidFinishRasonUserInfo]
当我按“完成”或“掐出”时也是一样的
谢谢你的帮助,很抱歉我的英语不好;op
NSNumber* reason = [[aNotification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
NSLog(@"%d",reason);
NSNumber是一个Objective-C对象,而不是原始C类型。显示的是指向对象的指针,而不是值
更正为:
NSLog(@"%@", reason);
或将原因更改为整数:
int reason = [[userInfo objectForKey:@"MPMoviePlayerPlaybackDidFinishReasonUserInfoKey"] intValue];
NSLog(@"%d", reason);