Exemplo n.º 1
0
        public LiveBroadcast(IVideoEncoder videoEncoder, IAacEncoder aacEncoder)
        {
            State         = RecAndLiveState.NotStart;
            _videoEncoder = videoEncoder;
            _aacEncoder   = aacEncoder;

            _handle = VsNetRtmpSenderSdk.RtmpSender_AllocInstance();
            VsNetRtmpSenderSdk.RtmpSender_SendInThread(_handle, true);
        }
Exemplo n.º 2
0
        public bool ResumeLive()
        {
            bool success = VsNetRtmpSenderSdk.RtmpSender_Resume(_handle) == 0;

            if (success)
            {
                State = RecAndLiveState.Started;
            }
            return(success);
        }
Exemplo n.º 3
0
 public bool StopLive()
 {
     if (!IsLive)
     {
         return(true);
     }
     if (_StopLive())
     {
         State  = RecAndLiveState.NotStart;
         IsLive = false;
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
        public bool PauseLive()
        {
            _videoEncoder.PushingData -= VideoEncoderPushingData;
            _aacEncoder.PushingData   -= AACEncoderPushingData;
            bool success = VsNetRtmpSenderSdk.RtmpSender_EndWrite(_handle) == 0;

            if (success)
            {
                State  = RecAndLiveState.Pause;
                IsLive = false;
            }
            else
            {
                _videoEncoder.PushingData += VideoEncoderPushingData;
                _aacEncoder.PushingData   += AACEncoderPushingData;
            }
            return(success);
        }
Exemplo n.º 5
0
        public bool StartLive(string liveServer, int liveServerPort, string liveChannel, string liveStreamName)
        {
            if (IsLive)
            {
                return(true);
            }

            _liveServer     = liveServer;
            _liveServerPort = liveServerPort;
            _liveChannel    = liveChannel;
            _liveStreamName = liveStreamName;
            if (StartLive())
            {
                State  = RecAndLiveState.Started;
                IsLive = true;
                return(true);
            }
            return(false);
        }