Hi folks,

Im currently doing a media player, ripper and burner and was wondering if anyone could help me with a few things. Im looking for

- how to create a display to show track name, slider bar, track time etc.
- code for a cd burner (cant seem to find any)
- how to create a playlist (can you use custom list boxes or what?)

Any help would be greatly appreciated.

Thanks,
Simon.

Dani AI

Generated

A custom-look media player is easiest to build by splitting responsibilities: a headless playback/burn engine and a thin UI wrapper. correctly noted that existing player controls can be hosted invisibly, but for a project that must not show the vendor UI it’s cleaner to pick a playback library or a small wrapper over the system APIs so the interface and behaviour are fully under control.

Common playback options (pros/cons): a managed audio library for audio-only work; DirectShow/Media Foundation or native engines (BASS, FMOD) when reliable audio+video support is needed; or a small wrapper around the OS multimedia API for minimal dependencies. ’s folder-scan approach is a robust playlist source — build an ordered list of file paths at startup and keep an index for next/previous behavior.

A simple pattern for UI updates is a short timer that polls the playback engine for position/length and updates a trackbar and time label; pausing the timer while the user drags the slider prevents feedback loops:

// assumes player.Position and player.Length are seconds (double)
timer.Interval = 250;
timer.Tick += (s,e) => {
    int len = Math.Max(1, (int)player.Length);
    trackBar.Maximum = len;
    trackBar.Value = Math.Min(trackBar.Maximum, (int)player.Position);
    lblTime.Text = TimeSpan.FromSeconds(player.Position).ToString(@"mm\:ss")
                 + " / " + TimeSpan.FromSeconds(player.Length).ToString(@"mm\:ss");
};
trackBar.MouseDown += (s,e) => timer.Stop();
trackBar.MouseUp   += (s,e) => { player.Position = trackBar.Value; timer.Start(); };

For playlists, persist simple M3U files (human-readable, widely supported):

#EXTM3U
#EXTINF:215,Artist - Title
C:\Music\Artist\Track.mp3

Burning is the most hardware-sensitive piece: use the OS image-mastering API or a well-tested third-party library rather than raw SCSI commands, and expect to handle device busy/permission errors and blank-media checking. Testing on real hardware and keeping playback and burning code decoupled will make the UI work, playlist handling, and burner features easier to implement and debug.

Recommended Answers

All 13 Replies

Well, you could use the Windows Media Player Control for the player, that will display the song name, and allow you to control the volume. To do this, you need to add a reference to the C:\Windows\System32\wmp.dll. you can then add a control to the form from there.

As for the CD burner take a look at the XP Burn Component http://msdn.microsoft.com/vcsharp/downloads/samples/xpburn/

For the playlists, if you use the WMP control, I am pretty sure there are built in methods for playlists.

If you need a small sample, on how to play songs with the WMP control let me know, I will put one together...

I used the Windows Media Player control like you suggested but I cant really use it as you have to use the whole WMP interface. I already have my own design and buttons for the player and what im looking for is just a small display to use on my own interface. Its for a project so I if I just used the WMP interface id get zero marks!!

You can embed it so, its not visible, then use your own buttons to control it. The interface doesn't have to be visible.

Really sorry to keep bugging you but do you know how that can be done? Ive searched for articles and examples on the web but no luck. Have you ever done it before or do you know any good sites?

Thanks,
Simon.

Ok, well I have changed my mind ;). There is a good chance that if your not allowed to use the WMP Interface, you won't be allowe to use its controlls. So I have attached a little Media Player project that I whipped up, that plays media files, without the WMP control.

It has the follwoing features.


-Play, pause, stop button
-Shows Track File
-Slider Bar

If you have any question feel free to ask :).

Coded on the 2.0 framework...

Thanks a million man, gonna try that out. The only problem im left with though is creating playlists. Its no problem using the WMP control cos all I have to design myself is the interface. For the actual functionality (burning, playlists etc) Im using code Ive found on the web. Does the WMP control help with playlists or will i have to look elsewhere.

Thanks again, youve been a great help so far!

I did a little project attempting to build my own little mp3 player that listened for keys like ctrl+alt+n for next. All the things I found to play a MP3 looked like it needed C++ so I moved to another project due to time constraints.

Anyways what I did is instead of creating a gui playlist is I dedicated a folder for my mp3. When the program started it built a new list of all the files *.mp3 in that folder and stuck it in an array. When the next button or previous button was pressed it either sutracted one or plus one on the array and passed the full filepath to the mp3 player class.

This is how I did it and if you want I could go through and try to find the project I wrote. That was on my last laptop and was about 6 months ago. Well hope that helps and that is my two cents worth.

Good Luck!!

Thanks a million man, gonna try that out. The only problem im left with though is creating playlists. Its no problem using the WMP control cos all I have to design myself is the interface. For the actual functionality (burning, playlists etc) Im using code Ive found on the web. Does the WMP control help with playlists or will i have to look elsewhere.

Thanks again, youve been a great help so far!

Yeah that would be great if you could find that project. My project has to be in on Wednesday (4 days!!) so if you cant find it before then thats fine.

Thanks again,
Simon.

Hiiii !!!!!!
i am trying to make An enhanced media player.....can anyone help me in coding.......if u hav a sample code for media player in c#.....pls send me at rahul_ratnawat26....
thanks....

thank you very much.... it helps me alot..

Hi there!
I have pretty much fininshed a audio/video/picture player in C#. I can not for the life of me find how to simply code the trackbar to the song/video i have playing referenced to a textbox. CAN ANYBODY HELP ME?

Thanks,
James

e7r2kooo where code media paler ???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.