私はムービーへのリンクを持つXMLフィードを含むアプリケーションを構築しています。ユーザーが画像をクリックするたびに再生したいと思います。デバイスのアプリケーションをテストするときのMPMoviePlayerサウンドのドロップ
私はMPMoviePlayerViewControllerを使用しています。シミュレータでアプリをテストすると、これまでのところ予想される結果が得られましたが、iPhoneでアプリをテストすると、プレイヤーは正しく再生されますが、サウンドは再生されません。
私は、いくつかの記事から、アプリケーションのパフォーマンスがシミュレータのパフォーマンスと大きく異なることをインターネットで見てきました。したがって、私はInstrumentsで「リーク」テストを行いました。映画を再生するたびに、いくつかのバイトがドロップされたり、リークされたりしていることがわかりました。突然の音の低下とは関係がありますか?もしそうなら、私はそれをどのように解決するでしょうか?
iPhoneで初めてのアプリをテストしているので、アプリがどれほどひどいことをしているのかとても驚いています。ムービープレイヤーパートのコードは次のとおりです。
#pragma mark Video Controls
-(void)playVideo:(id)sender{
moviePlaying=TRUE;
MPMoviePlayerViewController *playerViewController;
playerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:[data objectForKey:@"[att]url"]]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:[playerViewController moviePlayer]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:[playerViewController moviePlayer]];
MPMoviePlayerController *player = [[[MPMoviePlayerController alloc] init] autorelease];
player = [playerViewController moviePlayer];
[self.view addSubview:playerViewController.view];
player.controlStyle = MPMovieControlStyleDefault;
player.shouldAutoplay = YES;
[player setFullscreen:YES animated:YES];
}
- (void)moviePlayBackDidExitFullscreen:(NSNotification*)notification{
MPMoviePlayerViewController *moviePlayer = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer];
[moviePlayer.view removeFromSuperview];
[moviePlayer release];
}
- (void)moviePlayBackDidFinish:(NSNotification*)notification {
MPMoviePlayerViewController *moviePlayer = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer];
moviePlaying=FALSE;
[moviePlayer.view removeFromSuperview];
[moviePlayer release];
}
#pragma mark VideoControls End
私はあなたが問題を明るくすることを望みます。事前に
おかげで、
/Brinck10
さて、私はそれが音が消えていたデバイスであることを知りました.-とにかく、私はアプリがデータを落とさないようにするために何ができるか知りたいと思います。 –