English 中文(简体)
IPad与MPMoviePlayerViewController和OS5没有任何录音记录,在模拟器中进行。
原标题:No audio on iPad with MPMoviePlayerViewController and iOS5, works in the simulator
  • 时间:2012-01-13 00:17:19
  •  标签:
  • audio
  • ios5

自我向5月通报以来,我可以让议员MoviePlayerViewController在iPad上演音。 录像是完美的,但没有听音。 它对我使用什么形式持怀疑态度。 它不可行。 它使用模拟器,但不在iPad。

- (IBAction)playVideo {

    NSString *filepath   =   [[NSBundle mainBundle] pathForResource:@"test" ofType:@"m4v"];
    NSURL    *fileURL    =   [NSURL fileURLWithPath:filepath];
    moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];

    [[NSNotificationCenter defaultCenter]
     addObserver:self selector:@selector(movieFinishedPlaying:)
     name:MPMoviePlayerPlaybackDidFinishNotification 
     object:[moviePlayer moviePlayer]];

    [self presentMoviePlayerViewControllerAnimated:moviePlayer];

}

Anyone else have this problem? Or found a fix?

问题回答

It sounds silly, but we came across an issue on my team where the volume control for general iPad sounds was muted and this meant that there was no sound for video played in our app, even though music played through the music player or video on websites worked fine.

为了检查这一数量控制,你可以把任务主管机构(双管家子)召集起来,然后把pe带到左边,并有一些音乐控制;检查该屏幕上的 mu子没有上。

尝试:

...
moviePlayer.useApplicationAudioSession = NO;
[self presentMoviePlayerViewControllerAnimated:moviePlayer];

在分配之前举行录音会 MPMoviePlayerConller将与录像一起开脱

AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];

Ensure the audio format in the video file is something that the iPad can play. I believe the simulator has access to the host machine s codecs, which might explain why the iPad can play the video but not the audio. As noted on this page in the MPMoviePlayerController documentation:

If you use this class to play audio files, it displays a white screen with a QuickTime logo while the audio plays. For audio files, this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.

I just made the slide button on the side into lock screen. Then the sound suddely worked.





相关问题
Playing a Sound With Monotouch

No matter what I try (build -> content, NSUrl, filename) I get a null exception : file not found when I try to play a .caf sound file in monotouch. //var path = NSBundle.MainBundle.PathForResource("...

将音频Clips从Peter改为服务器

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

Play sound in iPhone web app with Javascript?

I m currently creating an iPhone web application for piano chords, and I wanted to add an option that would let the user press a Play button and play the selected chord. However, I m not sure how to ...

热门标签