Skip to content

an independent widget for audio recording, very easy to use

License

Notifications You must be signed in to change notification settings

wustzhy/ZYAudioRecorderWidget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZYAudioRecorderWidget

an independent widget for audio recording, very easy to use
一个独立的录音按钮封装(自带->录音继续、结束的提示动画, 保存、时长、播放...)[写聊天专用哦^_^]

Have a look at the screenshot

image

Usage here

  • step1
#import "ZYVoiceView.h"     // usage of voice --- import header file
  • step2
    // ----------------- usage of voice begin ------------------
    CGFloat inputViewHeight = 45;
    // 输入工具条的frame
    CGRect inputFrame = CGRectMake(0.0f,
                                   self.view.frame.size.height -
                                   inputViewHeight,
                                   self.view.frame.size.width,
                                   inputViewHeight);
    ZYVoiceView * voiceView = [[ZYVoiceView alloc]initWithFrame:inputFrame];    // __block
    WEAKSELF
    // 回调的voice block
    voiceView.zyVoiceCBBlock = ^(NSString *voicePath ,NSString *voiceDuration){
        STRONGSELF
        strongSelf.voicePath = voicePath;
        [strongSelf playVoiceAction];
        
        if([voiceDuration floatValue] < 1){
            
        }
        
    };
    [self.view addSubview:voiceView];
    // ----------------- usage of voice end ------------------

To test recorded audio here

#import "XHVoiceCommonHelper.h" //测试save audio
#import "XHAudioPlayerHelper.h" //测试play audio
-(void)playVoiceAction{
    
    if([XHVoiceCommonHelper fileExistsAtPath:self.voicePath]){
        
     [[XHAudioPlayerHelper shareInstance] managerAudioWithFileName:self.voicePath toPlay:YES];
    }
}

About

an independent widget for audio recording, very easy to use

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published