locked
How to loop video in asx playlist using mediaelement ??? RRS feed

  • Question

  •  Hello all i'm new to silverlight, i have question about mediaelement.

    i have video asx playlist and have successful to play all my video in my playlist. but i need to loop all my video from first video when my playlist end.

     i have try to make mediaended event and try to make all timespan zero and play again but it only repeat last video in my playlist. i want to know is there any way to make my mediaelement loop my video from first again ???

     thanks for your help.

     

    below my CS code :

    private void backgroundVideo_MediaEnded(object sender, RoutedEventArgs e)
            {

                videoplayer.Position = TimeSpan.FromSeconds(0);
                videoplayer.Play();
                   
            }

     

    My ASX Playlist :

    <Asx Version = "3.0" >
    <Title > myplaylist</Title>

    <Entry>
    <Ref href = "video/t_terminators_excl_2016_hd.wmv"/>
    </Entry>

    <Entry>
    <Ref href = "video/t_streetf4_inkbleed_h264.wmv"/>
    </Entry>
    </Asx>
    Sunday, May 10, 2009 4:04 AM

Answers

  • This is by design. Seeking in an ASX will seek within the current entry. You can reset the source on media ended to the ASX, so that it will restart from the beginning, but it will not be seamless.

    Monday, May 11, 2009 2:30 PM

All replies

  •  I'm using Silverlight 2

    Sunday, May 10, 2009 4:10 AM
  • This is by design. Seeking in an ASX will seek within the current entry. You can reset the source on media ended to the ASX, so that it will restart from the beginning, but it will not be seamless.

    Monday, May 11, 2009 2:30 PM
  •  Thanks for your answer.

    Could you please give me some idea how to reset that playlist.

    Because i try to set new source for my mediaelement by doing this code below but still no success.

    videoplayer.Stop();

    videoplayer.Souce = new Uri("myplaylist.asx");

    videoplayer.Play();

     My mediaelement back to first video then it stop. i have no idea how to do why this happen.

    Tuesday, May 12, 2009 1:10 AM
  •  upss wrong typing

    videoplayer.Source = new Uri("myplaylist,.asx");

    Tuesday, May 12, 2009 1:12 AM
  • Hello daniz185
     
     
    if only to make the loop, you have to do it in code-behind _MediaEnded the event, as Silverlight does not support certain properties. ASX and placed in the table below
     
    Note:
    The following features of ASX files are not supported in Silverlight.
    ASX feature Description
    PreviewMode Attribute This attribute is found on the root ASX object. It is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ATTRIBUTE.
    BannerBar Attribute This attribute is found on the root ASX object. It is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ATTRIBUTE.
    SkipIfRef This attribute is found on the root ENTRY object. It is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ATTRIBUTE.
    PARAM Element This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT.
    REPEAT Element This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT.
    EVENT Element This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT.
    STARTMARKER Element This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT.
    ENDMARKER Element This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT.
    Invalid content If a valid ASX tag has content that is not accepted (for example, a MOREINFO tag contains a REF tag), a MediaFailed error is raised.
    Fallback URLs

    If an ENTRY tag has multiple REF children, only the first one is read. Unlike WMP, Silverlight will not attempt to open additional REF URLs in case the first one fails, and a MediaFailed error is raised.

     

     
    Already in the event _MediaEnded when placed me in this way he worked the loop repeats the first video after you have closed the last with a small range with a black screen video, there may be range buferização ... it reappeared a few seconds after my first video that comes from a source. asx
    private void video_MediaEnded(object sender, RoutedEventArgs e)
    
    {
    
    video.Source = new Uri(http://silverlight.asx);
    
    }
    
     
    I helped him

     

    Monday, May 25, 2009 11:35 PM