视频
This page only Chinese language
版本/作者/日期 | 修改内容 |
---|---|
1.0/Sandy/2015-09-24 | 初版 |
4.视频
条件:摄像机连接成功
语法:
1)函数
-(int)playVideo:(unsigned int)streamIndex; //播放视频 参数:(unsigned int)streamIndex:播放哪一路视频 -(void)stopVideo;//关闭视频
2)消息通知
FOUNDATION_EXPORT NSString* const IPCamera_Video_Status_Changed_Notification;//视频状态改变 FOUNDATION_EXPORT NSString* const IPCamera_Video_Frame_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_Video_Status_Changed_Notification, cam_)
2)播放视频
[cam_ playVideo: 0 ];//播放第一路视频
3)关闭视频
[cam_ stopVideo]
4)视频消息通知
-(void)IPCamera_response_function:(NSNotification*)note { //视频图像状态改变 if( [note.name isEqualToString:IPCamera_Video_Status_Changed_Notification ]) { NSLog(@"视频状态改变"); if( STATUS_STOPPED == cam_.video_status ) { printf("视频关闭"); } else if( STATUS_REQUESTING == cam_.video_status ) { printf("请求视频"); } else if( STATUS_PLAYING == cam_.video_status ) { printf("视频播放"); } } //视频数据通知 if( [note.name isEqualToString:IPCamera_Video_Frame_Notification ]){ //如果是第一个画面,可能你需要根据不同的机形调整视图比列 16:9 或4 UIImage* image = [ note.userInfo objectForKey:@"image"]; m_video_image.imageView_.image = image; } }