public EasyLiveClient() { this.streamClient = new EasyStreamClientLive.EasyStreamClientAPI(); this.streamClientCallBack = new EasyStreamClientAPI.EasyStreamClientCallBack(this.EasyStreamClientCallBack); this.rtmpClient = new EasyStreamClientLive.EasyRTMPAPI(); this.rtmpCallback = new EasyRTMPAPI.EasyRTMPCallBack(this.EasyRTMPCallBack); }
/// <summary> /// 启动 /// </summary> /// <returns></returns> public KeyValuePair <bool, string> Start() { //激活rtsp if (!EasyStreamClientAPI.Activated) { var retActivate = EasyStreamClientAPI.Activate(); if (!retActivate.Key) { return(retActivate); } } //激活rtmp if (!EasyRTMPAPI.Activated) { var retActivate = EasyRTMPAPI.Activate(); if (!retActivate.Key) { return(retActivate); } } //初始化rtsp var ret = this.streamClient.Init(); if (!ret.Key) { this.Stop(); return(ret); } //启用音频 streamClient.SetAudioEnable(true); //设置rtsp回调 ret = this.streamClient.SetCallback(this.streamClientCallBack); if (!ret.Key) { this.Stop(); return(ret); } //打开rtsp网络 ret = this.streamClient.OpenStream(new StringBuilder(this.RtspUrl), IntPtr.Zero); if (!ret.Key) { this.Stop(); return(ret); } return(new KeyValuePair <bool, string>(true, "启动成功!")); }