Sunday, February 14, 2010

Programmer - Lib to play audio media in .NET?

Programmer Question

I tried fmod.net but got a 'System.BadImageFormatException' error. I then tried WindowsMediaPlayer and have sounds playing. However i am having issues playing a sound when the current one ends (callback code below. It doesnt seem to like me playing a new song during a state change however i cant find another way to inform me when the song is done) and using this link i was able to get title but not artist, album etc.



What lib can i use to play back sound (mp3, m4a and i would like ogg and aac). I looked up FFMPEG.NET and found a project with no release and another called fflib which seems to do conversions only (and also had the bad image exception). What may i use? or How do i get the title/artist/etc in WMPLib.WindowsMediaPlayer and have it play another song when one ends (i do not want to add a playlist inside of WMP. I'd like to maintain it and just be notified when a song ends to do further actions).



    private void Player_PlayStateChange(int NewState)
{
var newState = (WMPLib.WMPPlayState)NewState;
Console.WriteLine(newState);
//if (newState == WMPLib.WMPPlayState.wmppsMediaEnded)
if (newState == WMPLib.WMPPlayState.wmppsStopped)
{
next();
}
}

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails