IOS

音频

版本/作者/日期修改内容
1.0/Sandy/2015-09-24初版

5.音频

条件:摄像机连接成功
语法:
1)函数
-(int)playAudio; //开启音频
-(void)stopAudio; //关闭音频
2)消息通知

FOUNDATION_EXPORT NSString* const IPCamera_Audio_Status_Changed_Notification;

3)设置后的消息回调

-(void)IPCamera_response_function:(NSNotification*)note;

IPCamera.h宏定义了两种注册消息的方法
#define ADD_IPCAMERA_RESPONSE_WITHOUT_ARG(notice_name) \
    [[NSNotificationCenter defaultCenter] addObserver: self selector:               @selector(IPCamera_response_function:) name: notice_name object: nil]

#define ADD_IPCAMERA_RESPONSE_WITH_ARG(notice_name,camera_object) \
    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(IPCamera_response_function:) name: notice_name object: camera_object]
示列:
1)注册消息通知

ADD_IPCAMERA_RESPONSE_WITH_ARG( IPCamera_Audio_Status_Changed_Notification, cam_)

2)开启音频

[cam_ playAudio];

3)关闭关闭

[cam_ stopAudio];

4)音频状态改变时的消息通知
-(void)IPCamera_response_function:(NSNotification*)note
{
    if( [note.name isEqualToString:IPCamera_Audio_Status_Changed_Notification ])
    {
        NSLog(@"音频状态改变"); 

         if( STATUS_PLAYING == cam_.audio_status )
        {
            NSLog(@"音频开启成功");
        }
        if( STATUS_STOPPED == cam_.audio_status )
        {
            NSLog(@"音频关闭成功");
        }
        if( STATUS_REQUESTING == cam_.audio_status )
        {
            NSLog(@"请求开启音频");
        }     
    }
}
版权所有:深圳新瑞彩网络科技有限公司

信产部备案号:粤ICP备09050685号