English 中文(简体)
开始玩 playing之前的Cancel电影
原标题:Cancel a Movie before it begins playing

我把录像带上Pi,不像MPMoviePlayerController处理事情那样。 我注意到,当你在一行中点击某一部电影时,这部照片就坐在那里,直到装满足够的车载。 因此,我用带有装货图像和冰箱的UIImage电听机向用户通报情况。

我认为,如果他们等待,他们就应该选择取消电影的后 play。 因此,我拿着一个有背景形象的取消纽伦。

UIButton *cancel;
    UIImage *cancelImage = [UIImage imageNamed:@"cancel.png"];
    cancel = [UIButton buttonWithType:UIButtonTypeCustom];
    cancel.frame = CGRectMake(0,0, cancelImage.size.width, cancelImage.size.height);
    cancel.center = CGPointMake(35, 20); 
    [cancel setImage:cancelImage forState:UIControlStateNormal];
    [cancel addTarget:self action:@selector(cancelMovie) forControlEvents:UIControlEventTouchUpInside];
    [moviePreviewView addSubview:cancel];

但是,我不敢确定取消Movie的方法是什么。 我曾尝试复制我在电影电影“PlayBackDidFinish”背书方法中掌握的内容,但坠毁的却是明显的。

我还努力:

-(void)cancelMovie {
[theMovie.view removeFromSuperview];
[theMovie release];
}

但这也没有任何好处。 我认为,我可以直接向电影院打电话,但我认为你可以直接使用通知方法。

你们的想法?

最佳回答

我对回答我自己的问题怀有仇恨,但既然这个问题只有7个观点,那么我可以这样说。 也许,在晚上,我就没有把他们张贴在晚上。

无论如何,我并没有找到解决这一问题的好办法......只是一个黑板。

在取消制方法中,我告诉电影院装上另一部电影,这部电影在电影审查中使用同一照片。 当该电影结束时,该电影开始叫MoviePlayerPlayback议员。 DidFinish NOtification and Cleans, 并将其退回用户。

-(void)cancelMovie
{
cancelURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"cancel" ofType:@"m4v"]];

[theMovie setContentURL:cancelURL];

[theMovie setControlStyle:MPMovieControlStyleFullscreen];
[theMovie setFullscreen:YES];

// for some reason ... this is neccessary
[theMovie prepareToPlay];

// Register that the load state changed (movie is ready)
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(moviePlayerLoadStateChanged:) 
                                             name:MPMoviePlayerLoadStateDidChangeNotification 
                                           object:theMovie];

// Register for the PlayBackDidFinish (movie is finished)
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(moviePlayBackDidFinish:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification 
                                           object:theMovie];    
 }

不是好的,而是行之有效的。

问题回答

@Michael solution works. There could be improvement that there is no need to play cancel video. Instead, you can directly call the MPMoviePlayerPlaybackDidFinishNotification directly.

[self moviePlayBackDidFinish:nil];

第一台安装了@Michael s思想,但最终没有拍摄下台录像。

-(void)cancelMovie
{
    if (_mediaPlayer){
        [_mediaPlayer stop];
        _mediaPlayer.initialPlaybackTime = -1.0;
        _mediaPlayer.contentURL = nil;
        [_mediaPlayer prepareToPlay];
    }
}




相关问题
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风格的解决办法,只是一个简单的袖珍流程......

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

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

热门标签