如何编码媒体播放器. [英] how to code of media player.

查看:124
本文介绍了如何编码媒体播放器.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的C#项目中播放mp3 vedios..但我不知道媒体播放器的确切代码.但是我没有找到任何代码,请帮助我解决问题..

I wanted to play mp3 vedios in my c# project.. but I don''t know the exact code of media player.. I have searched every where . but i have not found any code please help me and solve my problem..

推荐答案

您的Google-fu需要工作.


很多工作...


Google: 添加mediaplayer c#" [
Your Google-fu needs work.


A lot of work...


Google: "add mediaplayer c#"[^]


A)选中工具箱.如果可以找到Windows Media Player组件,请跳过此步骤并继续.否则请执行以下操作:

1.在工具箱"中右键单击,然后选择选择项目".这将打开自定义工具箱"对话框.

2.在"COM组件"选项卡上,选择"Windows Media Player".
如果Windows Media Player没有出现在列表中,请单击浏览",然后打开Wmp.dll,该文件应位于Windows \ System32文件夹中.
3.单击确定. Windows Media Player控件将放置在当前的工具箱"选项卡上.

B)从工具箱中选择Windows Media PLayer组件,然后将其添加到表单中.

C)在您的窗体中选择Windows Media Player控件,然后将uiMode属性更改为"none".此设置隐藏UI控件.当用户播放视频时,它将出现在窗口中.

D)双击播放"按钮以查看其代码窗口.

E)将以下代码添加到播放按钮的事件中:

A) Check toolbox. If you can find Windows Media Player componet skip this step and continue. Else do the following:

1. Right-click within the Toolbox, and then select Choose Items. This opens the Customize Toolbox dialog box.

2. On the COM Components tab, select Windows Media Player.
If Windows Media Player does not appear in the list, click Browse, and then open Wmp.dll, which should be in the Windows\System32 folder.

3. Click OK. The Windows Media Player control will be placed on the current Toolbox tab.

B) Select Windows Media PLayer component from toolbox and add it to your form.

C) Select the Windows Media Player control in your form, then change the uiMode property to "none". This setting hides the UI controls. When the user plays a video, it will appear in the window.

D) Double Click the "Play" Button to see its code window.

E) Add below code to the event of play button:

axWindowsMediaPlayer1.URL = @"c:\mediafile.wmv";



其中"c:\ mediafile.wmv"是要播放的媒体项目名称的占位符.

F)并添加停止代码,双击停止按钮并添加以下代码:



Where "c:\mediafile.wmv" is a placeholder for the name of the media item you want to play.

F) And to add the stop code, double click on stop button and add the followinfg code:

axWindowsMediaPlayer1.Ctlcontrols.stop();



无论您要播放什么类型的文件.您只需要将Windows Media Player组件的URL设置为您的文件.例如:



No matter what type of file you want to play. You just need to set the url of windows media player component to your file. For example:

axWindowsMediaPlayer1.URL = @"c:\Music.mp3";


C#中的DirectShow MediaPlayer [ ^ ]
http://msdn.microsoft.com/en-us/library/system. windows.media.mediaplayer.aspx [ ^ ]
http://msdn.microsoft.com/zh-我们/library/windows/desktop/dd562851%28v=vs.85%29.aspx [
DirectShow MediaPlayer in C#[^]
http://msdn.microsoft.com/en-us/library/system.windows.media.mediaplayer.aspx[^]
http://msdn.microsoft.com/en-us/library/windows/desktop/dd562851%28v=vs.85%29.aspx[^]


这篇关于如何编码媒体播放器.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆