Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 视频录制就像聊天汤姆应用程序_Ios_Xcode_Cocos2d Iphone_Video Recording - Fatal编程技术网

Ios 视频录制就像聊天汤姆应用程序

Ios 视频录制就像聊天汤姆应用程序,ios,xcode,cocos2d-iphone,video-recording,Ios,Xcode,Cocos2d Iphone,Video Recording,我正在开发一个类似于Talking Tom的应用程序。当我们触摸Iphone屏幕时,会产生一些带有声音的狗动画。为此,我实现了Iphone屏幕的视频录制以外的所有功能。我实现了Iphone屏幕的视频录制,基于..它录制了没有声音的狗动画。我需要做什么才能将音频包含在视频文件中?是有没有可用的示例代码 如果你使用cocos2D开发你的应用程序,那么示例代码将非常有用 在AVFoundation框架中使用AVAudioRecorder。导入avfoundationframework和 符合AVAud

我正在开发一个类似于Talking Tom的应用程序。当我们触摸Iphone屏幕时,会产生一些带有声音的狗动画。为此,我实现了Iphone屏幕的视频录制以外的所有功能。我实现了Iphone屏幕的视频录制,基于..它录制了没有声音的狗动画。我需要做什么才能将音频包含在视频文件中?是有没有可用的示例代码


如果你使用cocos2D开发你的应用程序,那么示例代码将非常有用

在AVFoundation框架中使用AVAudioRecorder。导入avfoundationframework和 符合AVAudioRecorderDelegate标准 创建AVAudioRecorder实例和NSURL实例 **示例代码

录音:

    [audioSession setCategory:AVAudioSessionCategoryRecord error:nil]; // assign it to recording session
    [audioSession setActive:YES error:nil]; // activate it!
      NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
       [recordSetting setValue: [NSNumber numberWithInt:kAudioFormatAppleIMA4]    forKey:AVFormatIDKey]; // assign this special hardware component as the function to record
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0]
    forKey:AVSampleRateKey]; //44100 is the sample rate 
   [recordSetting setValue:[NSNumber numberWithInt: 2]
    forKey:AVNumberOfChannelsKey]; // same thing
   tmpFile = [NSURL fileURLWithPath:
      [NSTemporaryDirectory() stringByAppendingPathComponent:
    [NSString stringWithFormat: @"%.0f.%@",
     [NSDate timeIntervalSinceReferenceDate] * 1000.0,
      @"caf"]]]; // how we identify the audio written to the file to play later
      recorder = [[AVAudioRecorder alloc] initWithURL:tmpFile settings:recordSetting
    [recorder setDelegate:self];
   [recorder prepareToRecord];
   [recorder record];
播放:

    AVAudioSession * audioSession = [AVAudioSession sharedInstance];
   [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
       [audioSession setActive:YES error:nil];
      AVAudioPlayer * player =
       [[AVAudioPlayer alloc] initWithContentsOfURL:tmpFile error:nil]; // takes recording data from tmpFile where we wrote the recording in
      [player prepareToPlay];
     [player play];
这只是一些示例代码。。。。帮助您,但请阅读文档 我不知道你如何能动画的嘴,或者如果你想改变音高,但这是一个开始记录