Return to Snippet

Revision: 21134
at December 4, 2009 06:13 by johnlync


Initial Code
//to add Event Handler where "ambient1" and "ambient2" are different media elements... 

ambient1.MediaEnded += new RoutedEventHandler(media_MediaEnded);
ambient2.MediaEnded += new RoutedEventHandler(media_MediaEnded);

//Event Handler

void media_MediaEnded(object sender, RoutedEventArgs e)
        {
            MediaElement ctrl = (MediaElement)sender;
            ctrl.Stop();
            ctrl.Play();
        }

Initial URL
http://www.john-lynch.org/

Initial Description
There's no built-in "loop" property on the Silverlight mediaElement control. Add a listener to any mediaElement and this function will loop it.

Initial Title
Silverlight C# Sound Loop

Initial Tags
video

Initial Language
C#