Guest sebapi Posted March 19, 2006 Report Posted March 19, 2006 (edited) I have some problem. I can create application in Windows Application. I add a media player control from toolbox. I can create this application too without add media player control from toolbox, just add right library (WMPLib wmp.dll) and everything work. I have question: in what way can I create some kind of mp3 player on Smartphone using C# ? On deviceApplication project I can't find media player control in toolBox, so I add WMPLib library into project, but when I start my application, there is no sound. I've noticed that, when I go to bin/debug directory and execute the exe file the application works and there is sound. Can anyone help me ? Thanks. Sebastian Edited March 19, 2006 by sebapi
Guest Tech Posted March 20, 2006 Report Posted March 20, 2006 What version of .NET CF are you using? What is the device? you cannot add a WMP SDK control on the mobile application as the SDK is for PC's you can however play sound through WMP as I had demonstrated/explained in this thread: [will post link to thread] but generally you need to import the System.Diagnostics name space Make a process and run Windows media player given it the path to the audio file you wish to play as an argument so could be something like: Process audioPlayer = new Process(); audioPlayer.StartInfo = new ProcessStartInfo("wmplayer", "pathToFile"); audioPlayer.Start(); this code is for .NET CF 2.0
Guest sebapi Posted March 20, 2006 Report Posted March 20, 2006 I using .NET CF 2.0 I testing this application on default emulator for smartphone (.NET 2005) I'll check your solution. Thx
Guest sebapi Posted March 20, 2006 Report Posted March 20, 2006 I've checked this solution: Process audioPlayer = new Process(); audioPlayer.StartInfo = new ProcessStartInfo("wmplayer", "Baby.mp3"); audioPlayer.Start(); When I use mp3 file then it appears message like: "Cannot play the file. The file is either corrupted or the Player does not support the format you are trying to play". If I use wav file then it appears message like: "Cannot play the file because the specified network protocol is not supported. If you entered a URL to play the file, try a different protocol (such as HTTP). If you clicked a link to play the file, the link might not be valid" Hmm... Do enyone have some idea ?
Guest rogueqd Posted March 24, 2006 Report Posted March 24, 2006 Have you provided the full path to the file?
Guest sebapi Posted March 24, 2006 Report Posted March 24, 2006 Have you provided the full path to the file? <{POST_SNAPBACK}> Yes, I have tried with full path. Maybe I give a wrong path ? Where should be mp3 file physically ? Could you give me some example ? Maybe I have to set some settings in emulator ?
Guest Tech Posted March 25, 2006 Report Posted March 25, 2006 \ << this is the root directory of the phone in general so if your mp3 was stored in my documents on the phone memory, path would be: \My Documents\baby.mp3 in .NET 2.0 I believe, perhaps not for CF I cannot remember, there is a special path class/special folder class which allows you to select a folder of a special system type (like Windows, or my documents) - see if you can find it (I think its in the environment class) and use that to guide the path to the mp3 file. if you store the mp3 file on storage card, path: \Storage Card\someFile.mp3
Guest StephenL Posted June 20, 2006 Report Posted June 20, 2006 Process audioPlayer = new Process(); audioPlayer.StartInfo = new ProcessStartInfo("wmplayer", "Baby.mp3"); audioPlayer.Start(); Is there anyway to determine when the media clip has finished from within the C# code though? So that the player can be exited etc.. Cheers, Steve
Guest Tech Posted June 20, 2006 Report Posted June 20, 2006 unfortunately not, that is only possible I believe in Windows and the WMP SDK, not on Windows Mobile
Guest aniljain Posted October 27, 2006 Report Posted October 27, 2006 unfortunately not, that is only possible I believe in Windows and the WMP SDK, not on Windows Mobile I tried to play mp3 file with the following code but it throws an error: "An object or name was not found" and when I try to play mp3 file I get the following error: "Cannot play the file. The file is either corrupted or the player does not support the format you are trying to play" Process audioPlayer = new Process(); audioPlayer.StartInfo = new ProcessStartInfo("wmplayer", currentSoundTrack); audioPlayer.Start(); Any idea?? Thanks Anil
Guest Tech Posted November 3, 2006 Report Posted November 3, 2006 make sure the path to the file is correct. It's been a while since I've done this but that could be one reason
Guest keyur47831 Posted February 4, 2008 Report Posted February 4, 2008 make sure the path to the file is correct. It's been a while since I've done this but that could be one reason By default the emulator does not support mp3 files. If u are checking the same on actual device, the code will work properly.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now