/// <summary> /// 开始预览 /// </summary> /// <returns></returns> public bool StartPreview(string cameraCode, IntPtr intptr) { this.CameraCode = cameraCode; try { int iStreamType = 0; //码流模式,0:主码流 1:子码流 Dictionary <string, object> paramMaps = new Dictionary <string, object>(); paramMaps.Add("cameraIndexCode", this.CameraCode); paramMaps.Add("streamType", iStreamType); paramMaps.Add("protocol", "rtsp"); paramMaps.Add("transmode", 1); paramMaps.Add("expand", "streamform=ps"); string uri = "/artemis/api/video/v1/cameras/previewURLs"; string body = JsonHelper.SerializeObject(paramMaps); byte[] resultByte = HttpUtillib.HttpPost(uri, body, 20); string resultStr = Encoding.UTF8.GetString(resultByte); Result result = JsonHelper.DeserializeJsonToObject <Result>(resultStr); if (result.Code.Equals("0")) { Dictionary <string, object> cameraPreviewResult = JsonHelper.DeserializeJsonToObject <Dictionary <string, object> >(result.Data.ToString()); m_strURL = cameraPreviewResult["url"].ToString(); VIDEO_PLAY_REQ vpr = new VIDEO_PLAY_REQ(); vpr.iHardWareDecode = 0; vpr.fnStream = _pfnStreamCallback; vpr.fnMsg = _pfnMsgCallback; vpr.fnDecodedStream = _pfnDecodeDataCallback; m_lPlayHandle = ISCSDK.Video_StartPreview(m_strURL, intptr, ref vpr); return(m_lPlayHandle != -1); } } catch { } return(false); }
public static extern long Video_StartPlayback(string pszUrl, IntPtr hWnd, long i64StartTimeStamp, long i64EndTimeStamp, ref VIDEO_PLAY_REQ pstPlayReq);
public static extern long Video_StartPreview(string pszUrl, IntPtr hWnd, ref VIDEO_PLAY_REQ pstPlayReq);