Skip to content

Record audio and video, video recording of 3D model animation, and compression of audio and video(进行音频视频的录制,3D模型动画的视频录制以及音视频的压缩保存)

Notifications You must be signed in to change notification settings

CrystalMarch/RecordVideoAndAudio

Repository files navigation

RecordVideoAndAudio

  1. Audio recording (like WeChat display changes in volume during recording), audio playback, audio format conversion and file compression, limiting recording duration, countdown, etc.
  2. Video recording, video playback, video compression (support switching camera, turn off the flash, record video ratio 1:1, 4:3 or 16:9), limit the recording duration
  3. Video recording of 3D model animation, you can limit the recording duration and save it to a local album or app sandbox file.

  1. 音频录制(仿微信显示录制时音量的变化),音频播放,音频的格式转换以及文件压缩,限制录制时长,倒计时等功能
  2. 视频录制,视频播放,视频压缩(支持切换摄像头,打开关闭闪光灯,录制视频的比例1:1,4:3或者16:9),限制录制时长
  3. 3D模型动画的视频录制,可以限制录制时长,保存到本地相册或app沙盒文件中。

Effect picture

alt text

Quick start

  1. Audio Recording(音频录制)

Just add the button that inherits from AudioRecordButton to the page and set the proxy. Call the proxy method endRecord to refresh the data when you end the audio recording to see the latest recording file.(只需要把继承于AudioRecordButton的按钮添加到页面上并设置代理即可,在结束音频录制时调用代理方法endRecord刷新数据就可以看到最新的录音文件)

   _recordButton.delegate = self;
   #pragma mark - audio delegate
    -(void)endRecord{
        [self refreshDataSource];
    }
  1. Audio Play (音频播放)
AudioPlayView *voiceButton;
if (indexPath.row >= self.playViews.count || self.playViews.count == 0) {
voiceButton = [[AudioPlayView alloc] initWithFrame:CGRectMake(10, 10, 200, 30)];
voiceButton.filePath = filePath;
voiceButton.isShowLeftImg = YES;
if (![self.playViews containsObject:voiceButton]) {
[self.playViews addObject:voiceButton];
}
if (indexPath.row % 2 == 0){
voiceButton.isInvert = YES;
voiceButton.frame =CGRectMake(kScreenWidth-210, 10, 200, 30);
}
}else{
voiceButton = [self.playViews objectAtIndex:indexPath.row];
}
[cell.contentView addSubview:voiceButton];

Audio Play Delegate:

  [Audio shareAudio].audioPlay.delegate = self;

Audio Play Delegate Function:

    /// 开始播放音频(状态:加载中、加载失败、加载成功正在播放、未知)
    - (void)audioPlayBegined:(AVPlayerItemStatus)state;
    /// 正在播放音频(总时长,当前时长)
    - (void)audioPlaying:(NSTimeInterval)totalTime time:(NSTimeInterval)currentTime;
    /// 结束播放音频
    - (void)audioPlayFinished;
  1. Video Recording (视频录制)
    _videoView  =[[VideoView alloc] initWithFMVideoViewType:TypeFullScreen];
    _videoView.delegate = self;
    [self.view addSubview:_videoView];

Video View Delegate:

    ///退出录制
    -(void)dismissVC;
    ///视频录制完成
    -(void)recordFinishWithvideoUrl:(NSURL *)videoUrl;
  1. Video Play (视频播放)
    VideoPlayViewController *playVC = [[VideoPlayViewController alloc] init];
    playVC.videoUrl =  videoUrl;
    [self presentViewController:playVC animated:YES completion:nil];
  1. AR Video Recording (AR动画录制)
    [Video shareVideo].arRecord.delegate = self;
    [Video shareVideo].arRecord.renderer.scene = self.sceneView.scene;
    [Video shareVideo].arRecord.needToSavedPhotosAlbum = YES; //是否保存到本地相册
    [Video shareVideo].arRecord.needCompress = NO;//是否压缩视频

AR Video Record Delegate:

    ///合成视频
    - (void)endMerge:(NSURL *)url;
    - (void)updateRecordingProgress:(CGFloat)progress;
    - (void)updateRecordState:(RecordState)recordState;

    #pragma mark - AR Video Record
    ///开始录制视频
    - (void)recordBegined;
    ///停止录制视频
    - (void)recordFinshed;

About

Record audio and video, video recording of 3D model animation, and compression of audio and video(进行音频视频的录制,3D模型动画的视频录制以及音视频的压缩保存)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published