コード例 #1
0
        private async void StartStreaming(object sender, EventArgs e)
        {
            // Сбрасываем токен для возможности возобновления трансляции
            if (token.IsCancellationRequested)
            {
                cts   = new CancellationTokenSource();
                token = cts.Token;
            }

            if (!streamIsStarted && selectedCamera != null && res != null && fpsSelector.Text != "" && url != null)
            {
                pictureBox.BackColor = Color.Black;
                streamIsStarted      = true;

                await MjpegDecoder.GetByteArray(DrawImage, url, token);
            }
            else if (!streamIsStarted && url != null)
            {
                MessageBox.Show("Пожалуйста, заполните все поля и нажмите \"Применить\"", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }