//供时间轴调用 public void PlayRecVideo(int index) { if (lPort != -1) { lRet = VM_Player_Vlc.VMK_Player_Close(lPort); } lPort = lPorts[index]; lRet = VM_Player_Vlc.VMK_Player_Open(lPort, paths[index]); lRet = VM_Player_Vlc.VMK_Player_SetHwnd(lPort, pictureBox1.Handle); lRet = VM_Player_Vlc.VMK_Player_Play(lPort); if (lRet < 0) { MessageBox.Show("播放录像失败!"); } }
private void trackBar1_ValueChanged(object sender, EventArgs e) { int Hours = trackBar1.Value / 3600; int Minutes = (trackBar1.Value - Hours * 3600) / 60; int seconds = (trackBar1.Value - Hours * 3600) % 60; string str = Hours + ":" + Minutes + ":" + seconds; //DateTime dt = DateTime.ParseExact(str, "HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture); label5.Text = str; if (count == 5) { //获取视频当前时间 int CurrentTime = VM_Player_Vlc.VMK_Player_GetPlayedTime(lPort); //设置滑动条时间 trackBar1.Value = seconds; count = 0; } }
//播放 private void button1_Click(object sender, EventArgs e) { //if(lPort!=-1) //lRet = VM_Player_Vlc.VMK_Player_Close(lPort); lPort = 1; string path = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); lPort = (int)dataGridView1.SelectedRows[0].Cells[2].Value; lRet = VM_Player_Vlc.VMK_Player_Open(lPort, path); lRet = VM_Player_Vlc.VMK_Player_SetHwnd(lPort, pictureBox1.Handle); lRet = VM_Player_Vlc.VMK_Player_Play(lPort); int RecodingTime = VM_Player_Vlc.VMK_Player_GetPlayedTime(lPort); //trackBar1.Value = 0; trackBar1.Maximum = RecodingTime * 1000; if (lRet < 0) { MessageBox.Show("播放录像失败!"); } }
//播放 private void button10_Click(object sender, EventArgs e) { if (lPort != -1) { lRet = VM_Player_Vlc.VMK_Player_Close(lPort); } if (dataGridView1.Rows.Count == 0 || dataGridView1.SelectedRows.Count == 0) { return; } string path = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); lPort = (int)dataGridView1.SelectedRows[0].Cells[2].Value; lRet = VM_Player_Vlc.VMK_Player_Open(lPort, path); lRet = VM_Player_Vlc.VMK_Player_SetHwnd(lPort, pictureBox1.Handle); lRet = VM_Player_Vlc.VMK_Player_Play(lPort); if (lRet < 0) { MessageBox.Show("播放录像失败!"); } }
//恢复播放速度 private void button7_Click(object sender, EventArgs e) { lRet = VM_Player_Vlc.VMK_Player_ReSpeed(lPort); }
//慢放 private void button6_Click(object sender, EventArgs e) { lRet = VM_Player_Vlc.VMK_Player_Slow(lPort); }
//恢复 private void button4_Click(object sender, EventArgs e) { lRet = VM_Player_Vlc.VMK_Player_Pause(lPort, false); }