Explain how can Silverlight use ASX files.

Answer

An ASX file is an XML file in which media files are specified in the playlist. Using ASX files in silver is pretty simple. Assign the ‘ source’ property of a MediaElement object to the ASX file name.

The following is an example of ASX file.

<ASX version = "3.0">
<TITLE>MyFirst ASX Application</TITLE>
<ENTRY>
<TITLE>MyVideo</TITLE>
<AUTHOR>MyName</AUTHOR>
<COPYRIGHT>(c)2010 A company name</COPYRIGHT>
<REF HREF = "xbox.wmv" />
</ENTRY>
</ASX>

Later this .asx file need to assigned to the ‘Source’ property of MediaElement in XAML file.

<MediaElement
.
.
Source=”myasxfile.asx”
.
</MediaElement>

Finally, add event handlers for supporting the MediaElement. The following functions are used for stopping, pausing and playing events on CurrentStateChanged event.

function media_stop(sender, args)
{
        sender.findName("MediaPlayer").stop();
}

function media_pause(sender, args)
{
       sender.findName("MediaPlayer").pause();
}

function media_begin(sender, args)
{
        player = sender.findName("MediaPlayer");
        player.play();
}

function media_state_changed(sender, args)
{
       // Obtain the text block for displaying the status
       var mediaStateTextBlock = sender.findName("mediaStateTextBlock");
       // Obtain the media state object
      var media = sender.findName("MediaPlayer");

      mediaStateTextBlock.Text = media.CurrentState;

All silverlight Questions

Ask your interview questions on silverlight

Write Your comment or Questions if you want the answers on silverlight from silverlight Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---