private void frmPlayer_Load(object sender, EventArgs e) { string FormTitle = StreamingContent.StreamInformation.ContentTitle; this.Text = FormTitle; //player.URL = StreamingContent.StreamUrl; if (!PVS.MediaPlayer.Player.MFPresent) { MessageBox.Show("MediaFoundation is not installed. The player will not be able to stream the selected content :(", "System Error", MessageBoxButtons.OK, MessageBoxIcon.Error); CanFadeOut = false; this.Close(); } if (StreamingContent.StreamInformation.Container == "mkv") { DialogResult msg = MessageBox.Show("PlexDL Matroska (mkv) playback is not supported. Would you like to open the file in VLC Media Player? Note: It must already be installed", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (msg == DialogResult.No) { CanFadeOut = false; this.Close(); } else { try { VLCLauncher.LaunchVLC(StreamingContent.StreamInformation); CanFadeOut = false; this.Close(); } catch (Exception ex) { CanFadeOut = false; MessageBox.Show("Error occurred whilst trying to launch VLC\n\n" + ex.ToString(), "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Home.recordException(ex.Message, "VLCLaunchError"); this.Close(); } } } if (!IsWMP) { mPlayer = new PVS.MediaPlayer.Player(pnlPlayer); mPlayer.Sliders.Position.TrackBar = trkDuration; mPlayer.Events.MediaPositionChanged += mPlayer_MediaPositionChanged; mPlayer.Events.MediaEnded += mPlayer_ContentFinished; mPlayer.Events.MediaStarted += mPlayer_ContentStarted; mPlayer.FullScreenMode = FullScreenMode.Display; //MessageBox.Show(TitlesTable.Rows.Count + "\n" +StreamingContent.StreamIndex); //MessageBox.Show("Duration: "+StreamingContent.ContentDuration+"\nSize: "+StreamingContent.ByteLength); } else { //disable default player pnlPlayer.Visible = false; mtlPlayerControls.Visible = false; btnPlayPause.Visible = false; btnStop.Visible = false; btnPrevTitle.Visible = false; btnNextTitle.Visible = false; btnSkipBack.Visible = false; btnSkipForward.Visible = false; trkDuration.Visible = false; lblTotalDuration.Visible = false; lblTimeSoFar.Visible = false; //enable WMP axWindowsMediaPlayer1.Visible = true; axWindowsMediaPlayer1.URL = StreamingContent.StreamInformation.Link; } }
private void btnStreamInVLC_Click(object sender, EventArgs e) { VLCLauncher.LaunchVLC(StreamingContent.StreamInformation); }