Exemple #1
0
        private void StartLiveTv()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                Channel channel = GetSelectedChannel();
                if (channel != null)
                {
                    _channelsGridView.ClearSelection();
                    LiveStream liveStream = null;
                    var        result     = Proxies.ControlService.TuneLiveStream(channel, liveStream).Result;
                    liveStream = result.LiveStream;
                    if (result.LiveStreamResult == LiveStreamResult.Succeeded)
                    {
                        LoadAllActiveStreams();
                        WinFormsUtility.RunStreamPlayer(liveStream.RtspUrl, true);
                    }
                    else
                    {
                        ShowLiveStreamResultMessageBox(result.LiveStreamResult);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Exemple #2
0
        private void OpenSelectedRecording()
        {
            try
            {
                RecordingSummary recording = GetSelectedRecording();
                if (recording != null)
                {
                    if (Properties.Settings.Default.StreamRecordingsUsingRtsp)
                    {
                        string rtspUrl = null;
                        if (WinFormsUtility.IsVlcInstalled())
                        {
                            rtspUrl = Proxies.ControlService.StartRecordingStream(recording.RecordingFileName).Result;
                        }
                        if (String.IsNullOrEmpty(rtspUrl) ||
                            !WinFormsUtility.RunStreamPlayer(rtspUrl, false))
                        {
                            MessageBox.Show(this, "Failed to start VLC player.", null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            if (!String.IsNullOrEmpty(rtspUrl))
                            {
                                Proxies.ControlService.StopRecordingStream(rtspUrl).Wait();
                            }
                        }
                    }
                    else if (recording.IsFileOnDisk)
                    {
                        ProcessStartInfo startInfo = new ProcessStartInfo(recording.RecordingFileName);
                        startInfo.WindowStyle     = ProcessWindowStyle.Normal;
                        startInfo.UseShellExecute = true;
                        System.Diagnostics.Process.Start(startInfo);

                        Proxies.ControlService.SetRecordingLastWatched(recording.RecordingFileName).Wait();
                        recording.LastWatchedTime = DateTime.Now;
                        SetRecordingNodeIcon(_recordingsTreeView.SelectedNode);
                    }
                    else
                    {
                        MessageBox.Show(this, "Failed to find recording file.", null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        private void _openStreamButton_Click(object sender, EventArgs e)
        {
            LiveStream stream = GetSelectedStream();

            if (stream != null)
            {
                if (DialogResult.Yes == MessageBox.Show(this, "WARNING: opening this stream will hijack it from any other clients." + Environment.NewLine + Environment.NewLine + "Are you sure you want to do this?", this.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    try
                    {
                        if (!WinFormsUtility.RunStreamPlayer(stream.RtspUrl, true))
                        {
                            MessageBox.Show(this, "VLC not found on this system.", null, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }