private void Button_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog(); if (ofd.ShowDialog() == true) { isFromEvent = true; System.Windows.Forms.Application.DoEvents(); filenamef = ofd.FileName; m_media = m_factory.CreateMedia <IMediaFromFile>(filenamef); Thread t = new Thread(() => { if (m_player.CurrentMedia != null) { m_player.CurrentMedia.Dispose(); } //m_media.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged); //m_media.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged); //m_media.Events.ParsedChanged += new EventHandler<MediaParseChange>(Events_ParsedChanged); //System.Windows.Forms.Application.DoEvents(); m_player.Open(m_media); //System.Windows.Forms.Application.DoEvents(); m_media.Parse(true); //System.Windows.Forms.Application.DoEvents(); m_player.Play(); }); t.Start(); //isFromEvent = false; } }
private void OpenSourceMedia(string path) { IMediaFromFile media = m_factory.CreateMedia <IMediaFromFile>(path); m_sourcePlayer.Open(media); m_sourcePlayer.Play(); timer.Start(); }
private void playvideo(string path) { m_media = m_factory.CreateMedia <IMediaFromFile>(path); m_player.Open(m_media); m_media.Parse(true); m_player.Play(); }
public void play_video_from_database(string filename) { m_media = m_factory.CreateMedia<IMediaFromFile>(filename); m_media.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged); m_media.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged); m_player.Open(m_media); m_media.Parse(true); m_player.Play(); }
public void play_video_from_database(string filename) { m_media = m_factory.CreateMedia <IMediaFromFile>(filename); m_media.Events.DurationChanged += new EventHandler <MediaDurationChange>(Events_DurationChanged); m_media.Events.StateChanged += new EventHandler <MediaStateChange>(Events_StateChanged); m_player.Open(m_media); m_media.Parse(true); m_player.Play(); }
private void button1_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { textBlock1.Text = ofd.FileName; m_media = m_factory.CreateMedia<IMediaFromFile>(ofd.FileName); m_media.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged); m_media.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged); m_player.Open(m_media); m_media.Parse(true); } }
private void button1_Click(object sender, RoutedEventArgs e) { var ofd = new OpenFileDialog(); if (ofd.ShowDialog() == true) { TextBlock1.Text = ofd.FileName; _mMedia = _mFactory.CreateMedia<IMediaFromFile>(ofd.FileName); _mMedia.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged); _mMedia.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged); _mPlayer.Open(_mMedia); _mMedia.Parse(true); } }
private void button1_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { textBlock1.Text = ofd.FileName; m_media = m_factory.CreateMedia <IMediaFromFile>(ofd.FileName); m_media.Events.DurationChanged += new EventHandler <MediaDurationChange>(Events_DurationChanged); m_media.Events.StateChanged += new EventHandler <MediaStateChange>(Events_StateChanged); m_player.Open(m_media); m_media.Parse(true); } }
public void PlayFile(string path) { this.imageD3D.Source = this.d3dSource.ImageSource; m_media = m_factory.CreateMedia <IMediaFromFile>(path); if (_DurationChanged != null) { m_media.Events.DurationChanged += _DurationChanged; } m_player.Open(m_media); m_media.Parse(false); m_player.Play(); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { if (m_player != null) { m_player.StopAsync(); } SafeDispose(m_media); m_media = m_factory.CreateMedia <IMediaFromFile>(ofd.FileName); m_player.Open(m_media); m_player.Play(); } }
public Subframe(JsonObject paramSchedule) { InitializeComponent(); JsonObjectCollection col = (JsonObjectCollection)paramSchedule; frameInfoStrc frameInfo = new frameInfoStrc(); frameInfo.xPos = int.Parse(col["xPos"].GetValue().ToString()); frameInfo.yPos = int.Parse(col["yPos"].GetValue().ToString()); frameInfo.width = int.Parse(col["width"].GetValue().ToString()); frameInfo.height = int.Parse(col["height"].GetValue().ToString()); frameInfo.contentsFileName = (string)col["fileName"].GetValue(); frameInfo.mute = bool.Parse(col["mute"].GetValue().ToString()); if (frameInfo.width == 0) { this.WindowState = FormWindowState.Maximized; } else { this.Width = frameInfo.width; this.Height = frameInfo.height; } this.Location = new System.Drawing.Point(frameInfo.xPos, frameInfo.yPos); # region ==== Create Player ==== m_factory = new MediaPlayerFactory(true); m_player = m_factory.CreatePlayer<IDiskPlayer>(); m_player.AspectRatio = AspectRatioMode.Default; m_player.Mute = frameInfo.mute; m_player.WindowHandle = this.pnlPlayerBack.Handle; UISync.Init(this); #endregion ====================== #region ==== Contents play ==== FileInfo contentsFileInfo = new FileInfo(@frameInfo.contentsFileName); m_media = m_factory.CreateMedia<IMediaFromFile>(contentsFileInfo.FullName); m_player.Open(m_media); m_media.Parse(true); m_player.Play(); #endregion ===================== }
private void __OpenSelectedFile() { if (MyListView.SelectedIndex >= 0) { string fileName = m_myListViewItems[MyListView.SelectedIndex].FileName; textBlock1.Content = fileName; m_media = m_factory.CreateMedia <IMediaFromFile>(PathName.Text + "\\" + fileName); m_media.Events.DurationChanged += new EventHandler <MediaDurationChange>(Events_DurationChanged); m_media.Events.StateChanged += new EventHandler <MediaStateChange>(Events_StateChanged); m_player.Open(m_media); m_media.Parse(true); } else { MessageBox.Show("파일을 선택해주세요"); } }
private void button3_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text)) { _mMedia = _mFactory.CreateMedia<IMediaFromFile>(textBox1.Text); _mMedia.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged); _mMedia.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged); _mMedia.Events.ParsedChanged += new EventHandler<MediaParseChange>(Events_ParsedChanged); _mPlayer.Open(_mMedia); _mMedia.Parse(true); _mPlayer.Play(); } else { errorProvider1.SetError(textBox1, "Please select media path first !"); } }
private void button3_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text)) { m_media = m_factory.CreateMedia <IMediaFromFile>(textBox1.Text); m_media.Events.DurationChanged += new EventHandler <MediaDurationChange>(Events_DurationChanged); m_media.Events.StateChanged += new EventHandler <MediaStateChange>(Events_StateChanged); m_media.Events.ParsedChanged += new EventHandler <MediaParseChange>(Events_ParsedChanged); m_player.Open(m_media); m_media.Parse(true); m_player.Play(); } else { errorProvider1.SetError(textBox1, "Please select media path first !"); } }
public VlcPlayer() { InitializeComponent(); System.Windows.Forms.Panel p = new System.Windows.Forms.Panel(); p.BackColor = System.Drawing.Color.Transparent; windowsFormsHost1.Opacity = 0.5; windowsFormsHost1.Child = p; m_factory = new MediaPlayerFactory(true); m_player = m_factory.CreatePlayer <IVideoPlayer>(); m_media = m_factory.CreateMedia <IMediaFromFile>(@"E:\Render Library\Movie paths\Dance+SFS2.avi"); // m_media.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged); //m_media.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged); m_player.Open(m_media); m_media.Parse(true); m_player.Play(); }
public PlayerForm(Form ParentForm, List <string> PlayerSongInfoList) { InitializeComponent(); this.Owner = ParentForm; SongId = PlayerSongInfoList[0]; SongLang = PlayerSongInfoList[1]; SongSinger = PlayerSongInfoList[2]; SongSongName = PlayerSongInfoList[3]; SongTrack = PlayerSongInfoList[4]; SongFilePath = PlayerSongInfoList[5]; dvRowIndex = PlayerSongInfoList[6]; UpdateDataGridView = PlayerSongInfoList[7]; this.Text = "【" + SongLang + "】" + SongSinger + " - " + SongSongName; m_factory = new MediaPlayerFactory(true); m_player = m_factory.CreatePlayer <IDiskPlayer>(); m_player.WindowHandle = Player_Panel.Handle; Player_ProgressTrackBar.ProgressBarValue = 0; Player_ProgressTrackBar.TrackBarValue = 0; m_media = m_factory.CreateMedia <IMediaFromFile>(SongFilePath); m_player.Open(m_media); m_media.Parse(true); m_player.Mute = true; m_player.Play(); Thread.Sleep(1000); bool WaitTrackInfo = false; while (!WaitTrackInfo) { if (m_player.AudioTrackCount > 1) { foreach (Declarations.TrackDescription TrackDesc in m_player.AudioTracksInfo) { if (TrackDesc.Id != -1) { WaitTrackInfo = true; } } } } List <int> TrackIdList = new List <int>(); foreach (Declarations.TrackDescription TrackDesc in m_player.AudioTracksInfo) { TrackIdList.Add(TrackDesc.Id); } if (TrackIdList.Count > 2) { switch (SongTrack) { case "1": if (m_player.AudioTrack != TrackIdList[1]) { m_player.AudioTrack = TrackIdList[1]; } break; case "2": if (m_player.AudioTrack != TrackIdList[2]) { m_player.AudioTrack = TrackIdList[2]; } break; } Player_CurrentChannelValue_Label.Text = (TrackIdList.IndexOf(m_player.AudioTrack) == Convert.ToInt32(SongTrack)) ? "伴唱" : "人聲"; } else { string ChannelValue = ""; switch (SongTrack) { case "1": if (m_player.Channel != AudioChannelType.Left) { m_player.Channel = AudioChannelType.Left; } ChannelValue = "1"; break; case "2": if (m_player.Channel != AudioChannelType.Right) { m_player.Channel = AudioChannelType.Right; } ChannelValue = "2"; break; } Player_CurrentChannelValue_Label.Text = (ChannelValue == SongTrack) ? "伴唱" : "人聲"; } m_player.Events.PlayerPositionChanged += new EventHandler <MediaPlayerPositionChanged>(Events_PlayerPositionChanged); m_player.Position = 0; m_player.Mute = false; timer.Tick += new EventHandler(timer_Tick); timer.Interval = 500; timer.Start(); }
private void playEpisode(string path) { m_media = m_factory.CreateMedia<IMediaFromFile>(path); m_media.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged); m_media.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged); m_player.Open(m_media); m_media.Parse(true); m_player.Play(); this.saveManager(); }