/// <summary> /// 设置回调委托 /// </summary> /// <param name="callBack"> 回调委托 </param> /// <param name="userptr"> 用户自定义数据 </param> /// <returns></returns> public KeyValuePair <bool, string> SetCallback(EasyRTMPCallBack callBack, IntPtr userptr) { if (!this.IsInit) { return(new KeyValuePair <bool, string>(false, "RTMP 未创建!")); } try { int ret = EasyRTMP_SetCallback(this.RtmpHandle, callBack, userptr); if (ret == 0) { this.RTMPCallBack = callBack; return(new KeyValuePair <bool, string>(true, "RTMP 设置回调成功!")); } else { return(new KeyValuePair <bool, string>(false, string.Format("RTMP 设置回调失败,错误代码:{0}", ret))); } } catch (System.Exception e) { return(new KeyValuePair <bool, string>(false, e.Message)); } }
private extern static int EasyRTMP_SetCallback(IntPtr handle, EasyRTMPCallBack callBack, IntPtr userptr);