Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello how can i use media player in a winform? i want the user of my app to be able to listen to music while using the app.
is there any code in the codeproject that can help.
or any help
thank you
Posted
Comments
BillWoodruff 29-Dec-14 12:07pm    
Please search CodeProject for "media player," "play music," "DirectSound," etc.

There are many resources here.

Have a look at this MSDN article about adding a media player:
http://msdn.microsoft.com/en-us/library/bb383953%28v=vs.90%29.aspx[^]
If you just want to play music, without a media player control, take a look here:
http://msdn.microsoft.com/en-us/library/bb383890%28v=vs.90%29.aspx[^]
 
Share this answer
 
v2
Comments
Maciej Los 29-Dec-14 12:09pm    
+5
Thomas Daniels 29-Dec-14 12:09pm    
Thank you!
ridoy 29-Dec-14 12:37pm    
5ed!
Thomas Daniels 29-Dec-14 12:39pm    
Thank you!
Member 11308295 29-Dec-14 12:40pm    
thank u a lot. but what about if I wanna play an mp3 song?
In addition to the Solution 1:

What you want make sense only if you want to play some audio related to your application. Say, for applications related to music, you can play what the user edits (or something like that); in other cases, it could be instructional audio.

If your music is unrelated to the task, adding music would be purely negative quality. Why? Because all system capable of playing do have a separate player, and because your user knows better than you what to play and when. Adding such feature to the application means pushing the user to do something you think should be done, not the user. It could be so irritating (even if it is optional) that the user may decide to avoid using your products. Seriously.

—SA
 
Share this answer
 
v3
Comments
Maciej Los 29-Dec-14 12:18pm    
Good advice ;)
Sergey Alexandrovich Kryukov 29-Dec-14 12:20pm    
Thank you, Maciej.
—SA
Thomas Daniels 29-Dec-14 12:39pm    
Good answer, 5'ed.
Sergey Alexandrovich Kryukov 29-Dec-14 12:41pm    
Thank you.
—SA
[no name] 29-Dec-14 12:40pm    
I totally agree with Sergey Alexandrovich.
Playing music with your app has deviated from the main goal.
It will also consume more resources talking about memory needed to run the application. Instead, if you want the user to enjoy music when using the app you can launch the windows media player from code with Process.Start("wmplayer") or you send the selected audio file to the player.
ProgramFOX already provided what you need, just some more extension for you:
Audio and Video Player C# Winform[^]
Playing a MP3 file in a WinForm application[^]
Audio and Video Player C# Winform[^]
 
Share this answer
 
Comments
Thomas Daniels 29-Dec-14 12:44pm    
+5!
ridoy 29-Dec-14 12:48pm    
Thank you.
Member 11308295 30-Dec-14 6:31am    
http://www.c-sharpcorner.com/UploadFile/8ea152/mp3-media-player-in-C-Sharp-4-0/
this link is helpful for mp3 song playing.:D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900