![]() Sub OnMouseDownPlayMedia(ByVal sender As Object, ByVal args As MouseButtonEventArgs) Set the media's starting Volume and SpeedRatio to the current value of the TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue) Create a TimeSpan with miliseconds equal to the slider value. Overloaded constructor takes the arguments days, hours, minutes, seconds, milliseconds. Int SliderValue = (int)timelineSlider.Value Private void SeekToMediaPosition(object sender, RoutedPropert圜hangedEventArgs args) Jump to different parts of the media (seek to). Private void Element_MediaEnded(object sender, EventArgs e) Private void Element_MediaOpened(object sender, EventArgs e) to the total number of miliseconds in the length of the media clip. When the media opens, initialize the "Seek To" slider maximum value MyMediaElement.SpeedRatio = (double)speedRatioSlider.Value Private void ChangeMediaSpeedRatio(object sender, RoutedPropert圜hangedEventArgs args) MyMediaElement.Volume = (double)volumeSlider.Value Private void ChangeMediaVolume(object sender, RoutedPropert圜hangedEventArgs args) The Stop method stops and resets the media to be played from Void OnMouseDownStopMedia(object sender, MouseButtonEventArgs args) The Play method can be used to resume. The Pause method pauses the media if it is currently running. Void OnMouseDownPauseMedia(object sender, MouseButtonEventArgs args) ![]() Initialize the MediaElement property values. The Play method will begin the media if it is not currently active or Void OnMouseDownPlayMedia(object sender, MouseButtonEventArgs args) ![]() Public partial class MediaElementExample : Page Finally, the Volume and SpeedRatio properties are used to adjust the volume and playback speed of the media. Changing the Position property of the MediaElement allows you to skip around in the media. The Play, Pause, and Stop methods are used to respectively play, pause and stop the media. The code below implements the functionality of the sample UI controls. The LoadedBehavior property of MediaElement must be set to Manual in order to be able to interactively stop, pause, and play the media.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |