对讲
This page only Chinese language
版本/作者/日期 | 修改内容 |
---|---|
1.0/Sandy/2015-09-24 | 初版 |
6.对讲
条件:摄像机连接成功
语法:
1)函数
-(int)start_talk; //开启对讲 -(int)start_talk_with_buffer_ms:(unsigned int) buffer_ms; //开启对讲,buffer_ms延迟时间 -(void)stop_talk; //关闭对讲,摄像机断开或离开视频页面,一定要停止对讲,否则下次录像会有异常
2)消息通知
FOUNDATION_EXPORT NSString* const IPCamera_Talk_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_Talk_Status_Changed_Notification, cam_)
2)开启对讲
[cam_ start_talk]; 或: [cam_ start_talk_with_buffer_ms:50];
3)关闭对讲
[cam_ stop_talk];
4)对讲状态改变时的消息通知
-(void)IPCamera_response_function:(NSNotification*)note { if( [note.name isEqualToString:IPCamera_Talk_Status_Changed_Notification ]) { NSLog(@"对讲状态改变"); if( STATUS_PLAYING == cam_.talk_status) { NSLog(@"对讲开启成功"); } if( STATUS_STOPPED == cam_.talk_status) { NSLog(@"对讲关闭成功"); } if( STATUS_REQUESTING == cam_.talk_status ) { NSLog(@"请求开启对讲"); } } }