资源简介
支持mp3 mp4,avi,wma,rm等等
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using QuartzTypeLib;//播放器
using System.Runtime.InteropServices;//播放声音
namespace MYplayer
{
public partial class mediaplayer : Form
{
private System.ComponentModel.IContainer components;
private const int WM_APP = 0x8000;
private const int WM_GRAPHNOTIFY = WM_APP + 1;
private const int EC_COMPLETE = 0x01;
private const int WS_CHILD = 0x40000000;
private const int WS_CLIPCHILDREN = 0x2000000;
private FilgraphManager m_objFilterGraph = null;
private IBasicAudio m_objBasicAudio = null;
private IVideoWindow m_objVideoWindow = null;
private IMediaEvent m_objMediaEvent = null;
private IMediaEventEx m_objMediaEventEx = null;
private IMediaPosition m_objMediaPosition = null;
private IMediaControl m_objMediaControl = null;
enum MediaStatus { None Stopped Paused Running };
private MediaStatus m_CurrentStatus = MediaStatus.None;
OpenFileDialog openFileDialog;
private int second = 0;
private int minute = 0;
private int hour = 0;
private bool flag = false;
public mediaplayer()
{
InitializeComponent();
this.tsbt_open.Enabled = true;
this.tsbt_play.Enabled = false;
this.tsbt_stop.Enabled = false;
this.tsbt_pause.Enabled = false;
}
private void tsbt_play_Click(object sender EventArgs e)
{
m_objMediaControl.Run();
m_CurrentStatus = MediaStatus.Running;
this.tsbt_play.Enabled = false;
this.tsbt_stop.Enabled = true;
this.tsbt_pause.Enabled = true;
this.flag = true;
}
//播放文件
private void tsbt_pause_Click(object sender EventArgs e)
{
m_objMediaControl.Pause();
m_CurrentStatus = MediaStatus.Paused;
this.tsbt_play.Enabled = true;
this.tsbt_stop.Enabled = true;
this.tsbt_pause.Enabled = false;
this.flag = false;
}
//暂停播放
private void tsbt_stop_Click(object sender EventArgs e)
{
m_objMediaControl.Stop();
m_objMediaPosition.CurrentPosition = 0;
m_CurrentStatus = MediaStatus.Stopped;
CleanUp();
this.tsbt_play.Enabled = false;
this.tsbt_stop.Enabled = false;
this.tsbt_pause.Enabled = false;
ToolStripMenuItem_play.Enabled = false;
this.flag = false;
}
//停止播放
private void tsbt_close_Click(object sender EventArgs e)
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 516096 2006-08-18 11:50 MYpla
文件 30720 2009-04-16 21:51 MYpla
文件 32256 2009-04-16 21:51 MYpla
文件 14328 2009-04-17 12:27 MYpla
文件 490 2007-07-21 01:33 MYpla
文件 16262 2006-03-22 12:32 MYpla
文件 18944 2007-12-07 08:45 MYpla
文件 13180 2006-03-22 06:00 MYpla
文件 18944 2007-12-07 08:45 MYpla
文件 10581 2009-04-16 21:51 MYpla
文件 15115 2009-04-16 21:48 MYpla
文件 25705 2009-04-16 21:48 MYpla
文件 3889 2009-04-16 21:48 MYpla
文件 168 2009-04-15 22:30 MYpla
文件 853 2009-04-17 12:27 MYpla
文件 853 2009-04-16 21:48 MYpla
文件 30720 2009-04-16 21:51 MYpla
文件 13272 2009-04-16 21:49 MYpla
文件 32256 2009-04-16 21:51 MYpla
文件 180 2009-04-16 21:49 MYpla
文件 6728 2009-04-16 21:48 MYpla
文件 4608 2009-04-15 22:31 MYpla
文件 310 2007-12-07 08:51 MYpla
文件 474 2007-12-07 08:47 MYpla
文件 1174 2007-12-07 08:38 MYpla
文件 2840 2009-04-15 22:31 MYpla
文件 5612 2007-12-07 08:38 MYpla
文件 1106 2009-04-15 22:31 MYpla
文件 249 2007-12-07 08:38 MYpla
文件 914 2009-04-15 22:31 MYpla
............此处省略19个文件信息
评论
共有 条评论