示例#1
0
        private async Task PushLiveAsync()
        {
            if (PushLiveChecked)
            {
                _localPushLiveService.GetLiveParam();

                StartLiveStreamResult result =
                    await
                    _localPushLiveService.StartPushLiveStream(
                        _viewLayoutService.GetStreamLayout(_localPushLiveService.LiveParam.m_nWidth,
                                                           _localPushLiveService.LiveParam.m_nHeight));

                if (HasErrorMsg(result.m_result.m_rc.ToString(), result.m_result.m_message))
                {
                    PushLiveChecked = false;
                }
                else
                {
                    PushLiveStreamTips =
                        string.Format(
                            $"分辨率:{_localPushLiveService.LiveParam.m_nWidth}*{_localPushLiveService.LiveParam.m_nHeight}\r\n" +
                            $"码率:{_localPushLiveService.LiveParam.m_nVideoBitrate}\r\n" +
                            $"推流地址:{_localPushLiveService.LiveParam.m_url1}");
                }
            }
            else
            {
                AsynCallResult result = await _localPushLiveService.StopPushLiveStream();

                if (HasErrorMsg(result.m_rc.ToString(), result.m_message))
                {
                    PushLiveChecked = true;
                }
            }
        }
示例#2
0
        private async Task StartPushLiveStreamAutomatically()
        {
            _serverPushLiveService.GetLiveParam();

            UserInfo userInfo = IoC.Get <UserInfo>();

            AsyncCallbackMsg result =
                await
                _serverPushLiveService.StartPushLiveStream(
                    GetStreamLayout(_serverPushLiveService.LiveParam.Width,
                                    _serverPushLiveService.LiveParam.Height), userInfo.PushStreamUrl);
        }
        private async Task StartPushLiveStreamAutomatically()
        {
            _serverPushLiveService.GetLiveParam();

            UserInfo userInfo = DependencyResolver.Current.GetService <UserInfo>();

            StartLiveStreamResult result =
                await
                _serverPushLiveService.StartPushLiveStream(
                    GetStreamLayout(_serverPushLiveService.LiveParam.m_nWidth,
                                    _serverPushLiveService.LiveParam.m_nHeight), userInfo.PushStreamUrl);

            if (result.m_result.m_rc == 0)
            {
                await
                _serverPushLiveService.RefreshLiveStream(
                    GetStreamLayout(_serverPushLiveService.LiveParam.m_nWidth,
                                    _serverPushLiveService.LiveParam.m_nHeight));
            }
            else
            {
                //log error msg
            }
        }