在我的应用程序中,我录制了视频并进行播放。大多数时候视频播放效果不错,但有时在播放视频的中间,当我在我的日志中按下“完成”按钮“UIStatusBarStyleBlackTranslucent在此设备上不可用。” msg显示但是它是如何生成的我不知道,当这个msg生成我的应用程序变成“黑色”时,我必须从后台删除它。其余的时间我的视频运作得非常好。 在我的info.plist文件中,我更改了必要的状态栏设置,但对我的结果没有影响。
我想提一下,我正在从iPad调试我的应用程序。
并且每次都不会生成此消息。 我不知道为什么这个消息会显示出来。 按下完成按钮后运行代码。
- (void)moviePlaybackDidFinish:(NSNotification*)notification
{
[self stopMovie];
NSLog(@"Start Timer Again");
// [btnVideo setTitle:@"Start Recording" forState:UIControlStateNormal];
[btnVideo setImage:[UIImage imageNamed:@"Record Button-iPad.png"] forState:UIControlStateNormal];
NSURL *url = [NSURL fileURLWithPath:@"/dev/null"];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
nil];
NSError *error;
if (recorder) {
recorder = nil;
[recorder release];
}
recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error];
if (recorder) {
[recorder prepareToRecord];
recorder.meteringEnabled = YES;
[recorder record];
}
NSString *str = [[NSUserDefaults standardUserDefaults] valueForKey:@"IMAGE_MOVEMENT"];
NSLog(@"image movement %@",str);
if(str == @"EASY")
{
NSLog(@"inside easy image");
[self validateTimer];
levelTimer = [NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(levelTimerCallbackEasy:) userInfo:nil repeats: YES];
}
else if(str == @"MEDIUM")
{
NSLog(@"inside medium image");
[self validateTimer];
levelTimerMedium = [NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(levelTimerCallbackMedium:) userInfo:nil repeats:YES];
}
else if(str == @"HARD")
{
NSLog(@"inside hard image");
[self validateTimer];
levelTimerHard = [NSTimer scheduledTimerWithTimeInterval:0.03 target: self selector: @selector(levelTimerCallbackHard:) userInfo: nil repeats: YES];
}
}
- (void)stopMovie
{
NSLog(@"Stop Movie");
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerWillExitFullscreenNotification
object:moviePlayer];
// This trick is necessary, otherwise the screen remains black or will
// flicker when you try to play the next video.
[moviePlayer pause];
[moviePlayer stop];
moviePlayer.initialPlaybackTime = -1.0;
moviePlayer = nil;
NSString *recorderFilePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
recorderFilePath = [recorderFilePath stringByAppendingPathComponent:@"tempRecording.caf"];
if ([[NSFileManager defaultManager] fileExistsAtPath:recorderFilePath]) {
[[NSFileManager defaultManager] removeItemAtPath:recorderFilePath error:nil];
}
NSString *movieFilePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
movieFilePath = [movieFilePath stringByAppendingPathComponent:@"export.mov"];
if ([[NSFileManager defaultManager] fileExistsAtPath:movieFilePath]) {
[[NSFileManager defaultManager] removeItemAtPath:movieFilePath error:nil];
}
NSString *videoFilePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
videoFilePath = [videoFilePath stringByAppendingPathComponent:@"output.mp4"];
if ([[NSFileManager defaultManager] fileExistsAtPath:videoFilePath]) {
[[NSFileManager defaultManager] removeItemAtPath:videoFilePath error:nil];
}
NSURL *urls = [NSURL fileURLWithPath:recorderFilePath];
NSError *err = nil;
if (voiceRecorder) {
voiceRecorder = nil;
[voiceRecorder release];
}
voiceRecorder = [[ AVAudioRecorder alloc] initWithURL:urls settings:recordSetting error:&err];
//[recorder setMeteringEnabled:YES];
if(!voiceRecorder){
NSLog(@"recorder: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle: @"Warning"
message: [err localizedDescription]
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
return;
}
//prepare to record
[voiceRecorder setDelegate:self];
[voiceRecorder prepareToRecord];
//voiceRecorder.meteringEnabled = YES;
}
如果有的话,为我提供任何解决方案。
提前完成。
答案 0 :(得分:0)
iPad不支持UIStatusBarStyleBlackTranslucent,将其更改为正常,您将摆脱错误。可能是因为他们认为大屏幕无论如何都不需要额外的20像素。