Here is sample coding for how to play a mp3 song in C# applicatin using AxWMPLib library.
- First add the library from Com reference with the name of Windows Media Player (wmp.dll).
- Drag the media player control from tool box in to your form.
- Copy the following code into Form_Load
axWindowsMediaPlayer1.URL = "C:\\test.mp3";
axWindowsMediaPlayer1.Ctlcontrols.stop();
- Copy the following code when click the play button
axWindowsMediaPlayer1.Ctlcontrols.play();
- Copy the following code when click the pause button.
axWindowsMediaPlayer1.Ctlcontrols.pause();
- We can get the time duration of playing file as follows,
axWindowsMediaPlayer1.currentMedia.attributeCount.ToString();
axWindowsMediaPlayer1.currentMedia.durationString;
axWindowsMediaPlayer1.Ctlcontrols.currentPositionString;
...S.VinothkumaR.
Subscribe to:
Post Comments (Atom)
7 comments:
Great!! Exactly what i was looking for. :)
Great this is exactly what I needed
There's one little detail, once you add the reference you must explicitly add the new component to the toolbox.
Thanks a lot for your help
thanks vinothkumar.. you help me creating my timer... ;-)
hi ...
how can i give multiple URL's to axwindowsmediaplayer .
i want to create a windows form which contains buttons and when the user clicks on a button the particular mp3 urL present in that button should be playe in the media player .
Post a Comment