Skip to content

Commit

Permalink
Merge pull request #1800 from flibitijibibo/mediaplayer-activesongcha…
Browse files Browse the repository at this point in the history
…nged

MediaPlayer: ActiveSongChanged
  • Loading branch information
tomspilman committed Jun 18, 2013
2 parents 473e5c9 + 1352128 commit 56d5e3c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions MonoGame.Framework/Media/MediaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public static class MediaPlayer
private static bool _isMuted = false;
private static readonly MediaQueue _queue = new MediaQueue();

public static event EventHandler<EventArgs> ActiveSongChanged;

#if WINDOWS_MEDIA_ENGINE
private static readonly MediaEngine _mediaEngineEx;
#if WINDOWS_PHONE
Expand Down Expand Up @@ -440,6 +442,12 @@ internal static void OnSongFinishedPlaying(object sender, EventArgs args)
if (!IsRepeating)
{
State = MediaState.Stopped;

if (ActiveSongChanged != null)
{
ActiveSongChanged.Invoke(null, null);
}

return;
}
}
Expand Down Expand Up @@ -523,6 +531,11 @@ private static void NextSong(int direction)
Stop();
else
Play(nextSong);

if (ActiveSongChanged != null)
{
ActiveSongChanged.Invoke(null, null);
}
}
}
}
Expand Down

0 comments on commit 56d5e3c

Please sign in to comment.