Silverlight players5/18/2023 ![]() SampleMediaElement.MediaEnded += new RoutedEventHandler(SampleMediaElement_MediaEnded) SampleMediaElement.MediaOpened += new RoutedEventHandler(SampleMediaElement_MediaOpened) ![]() Public partial class MainPage : UserControl Now let’s go ahead and implement the codebehind for the media player: Now define the XAML code for the Media player. After adding the sample video to the project, right click on the video file and click on properties. Add a sample video file to the Silverlight application. In this section we will create a sample application named SampleMediaPlayer in Silverlight and implement a Simple Media Player.įirst, create a Silverlight application and name it as SampleMediaPlayer. Sample Silverlight Multimedia Application Code ![]() For example when the state of the media element is changed from Play to Pause or Stop. This event gets fired when the current state of the event is changed. MediaFailedĪny special handling which needs to occur when the media element fails to play the content can be implemented using this event. This event can be used to implement resetting the MediaElement’s state or to play the next video. This event gets fired when the media gets closed after playing is complete. This event gets fired when the media source of the MediaElement gets opened. ![]() Notable Events of MediaElementīelow are some of the important MediaElement events that could be very useful which creating a MediaPlayer control in the Silverlight application. So playing the media file would wait until the set time is elapsed. This is a property used to get or set the buffering time of the media file to be played. This property is used to specify whether the media file being played has to be cached or not. This is a Boolean property used to specify whether the Media sound should be muted or not. When set to True the media file gets played as soon as the MediaElement control is loaded if the value is set to false then the media file is not played by default. This is the first and foremost property which is used to provide the path of the multimedia file which needs to be played. Notable Properties of MediaElementīelow are some of the important properties of the MediaElement control: Source All the developer needs to do is simply drag drop the UI element onto the XAML page and set a few basic properties which enables the media files to be played. In Silverlight the multimedia files can be handled using the MediaElement control. But with Silverlight a wide range of multimedia support is available which includes video files, audio files and photos. Until the introduction of Silverlight there was no prominent Microsoft technology which could handle multimedia files. With this basic idea you could very well create a complete implementation of a fully sophisticated media player.įor this demonstration I have used Silverlight 4.0 and Visual Studio 2010. Source code for creating a simple media player in Silverlight application is provided and explained. In this article we will learn about handling and implementing multimedia in a Silverlight application. Introduction to Multimedia in Silverlight
0 Comments
Leave a Reply. |