Search code examples
c#visual-studio-2010mp3wmplib

Pausing and resuming mp3 with WMPLib and C#


I'm working on a simple mp3 player project with C# and the WMPLib library. The idea is to make it controllable with a PIC component, to control media playing in the PC from "anywhere" in my house (yes, this is a college project).

The problem: I can't get the WindowsMediaPlayer.controls.play() method to resume a paused playback. How should I do it? I've already tried to save and set the WindowsMediaPlayer.controls.currentPosition property, but it doesn't work.

PS:
The same problem: http://social.msdn.microsoft.com/Forums/en-US/windowspro-audiodevelopment/thread/770d22fc-7ef1-475e-a699-b60e2282a7c7/
Different problem: pause and resume Windows Media Player in C#

Thanks in advance

EDIT: WindowsMediaPlayer.controls.currentPosition works fo setting the position, but not for getting it:

double time = Player.controls.currentPosition; //Returns 0 always
Player.controls.currentPosition = time; //Works fine, makes music jump to time seconds

Solution

  • You can get currentposition by converting it to string for example:
    label1.text = convert.tostring(Player.controls.currentPosition);

    I've used a label to show you the exactly currentPosition value.

    Regards