Ejemplo n.º 1
0
        /// <summary>
        /// Await a server response that indicates that a client to connect to is found.
        /// When the correct message ("Start recording") is passed, the capturing and streaming is started.
        /// </summary>
        /// <param name="serverConnector"></param>
        private async void SetUpStreams(ServerConnector serverConnector)
        {
            // Await the server response.
            //dynamic jsonMessage = await serverConnector.ReceiveMessage();
            ////Start streaming if the "Start recording" message is received.
            //if (jsonMessage.MESSAGE.equals("Start recording"))
            //{
            capturer.InitializeAndSetMediaCaptureAsync();
            // capturer.StartVideoRecording(serverConnector.GetSocket());

            Task.Run(() =>
            {
                capturer.StartVideoRecordingOnThread(serverConnector.GetSocket());
            });



            receiver = new Receiver(serverConnector.GetSocket());
            mediaPlayer.MediaEnded  += MediaEnded;
            mediaPlayer.MediaFailed += MediaFailed;
            mediaPlayer.MediaOpened += MediaOpened;
            mediaPlayer.SetPlaybackSource(_playlist);

            //inStream = new InputVideoStream(serverConnector.GetSocket());
            //mediaPlayer.SetSource(inStream, "video/HEVC");
            //}
        }