/// <summary> /// 打开摄像头 /// </summary> public void StartCamera() { var errno = PlcmProxy.StartCamera(); if (ErrorNumber.OK != errno) { var errMag = "开启摄像头失败,errno=" + errno; log.Error(errMag); throw new Exception(errMag); } log.Info("开启摄像头成功"); }
private void RenderVedio() { try { var hwnd = pnlVideo.Handle; if (_channel.IsVideo) { switch (_channel.MediaType) { case MediaType.LOCAL: { var errno = PlcmProxy.AttachStreamWnd(MediaType.LOCAL, _channel.ChannelID, _channel.Call.CallHandle, hwnd, 0, 0, this.pnlVideo.Width, this.pnlVideo.Height - 40); if (ErrorNumber.OK != errno) { log.Error("本地视频附加失败"); } PlcmProxy.StartCamera(); } break; case MediaType.REMOTE: { var errno = PlcmProxy.AttachStreamWnd(MediaType.REMOTE, _channel.ChannelID, _channel.Call.CallHandle, hwnd, 0, 0, this.pnlVideo.Width, this.pnlVideo.Height - 40); if (ErrorNumber.OK != errno) { log.Error("远程视频附加失败"); } } break; case MediaType.CONTENT: { var errno = PlcmProxy.AttachStreamWnd(MediaType.CONTENT, _channel.ChannelID, _channel.Call.CallHandle, hwnd, 0, 0, this.pnlVideo.Width, this.pnlVideo.Height - 40); if (ErrorNumber.OK != errno) { log.Error("共享视频附加失败"); } } break; case MediaType.LOCALCONTENT: { } break; } } else //音频 { switch (_channel.MediaType) { case MediaType.LOCAL: { var errno = PlcmProxy.DetachStreamWnd(MediaType.LOCAL, _channel.ChannelID, _channel.Call.CallHandle); if (ErrorNumber.OK != errno) { log.Error("本地视频卸载失败"); } PlcmProxy.StopCamera(); } break; case MediaType.REMOTE: { var errno = PlcmProxy.DetachStreamWnd(MediaType.REMOTE, _channel.ChannelID, _channel.Call.CallHandle); if (ErrorNumber.OK != errno) { log.Error("远程视频卸载失败"); } } break; case MediaType.CONTENT: { var errno = PlcmProxy.DetachStreamWnd(MediaType.CONTENT, _channel.ChannelID, _channel.Call.CallHandle); if (ErrorNumber.OK != errno) { log.Error("共享视频卸载失败"); } } break; case MediaType.LOCALCONTENT: { } break; } } } catch (Exception ex) { log.Error(ex.Message); } }