none
Attributes missing when Silverlight plays stream from server-side playlist

    Question

  • Silverlight now supports server-side playlists (Silverlight 2.0 Beta 2). But when the MediaPlayer control plays a stream from a Windows Media Services publishing point which uses a server-side playlist, the MediaAttributeCollection property of the MediaPlayer's MediaElement is not populated. In other words, there is no way to access the track's meta data: Artist, Title, Copyright, etc.

    When the MediaPlayer source URL is pointed to a client-side playlist (ASX format) the metadata is available through the MediaAttributesCollection property. Why isn't the collection populated when the source URL is a publishing point with a server-side playlist? Technically, the collection can be populated, and it should be populated, otherwise there is no way to access this essential metadata. I believe this constitutes a bug which must be fixed before Silverlight 2.0 is released.

    The following code produces a simple ASP.NET web page (Visual Studio 2008, .NET 3.5) on which Silverlight would play a stream from a Windows Media Services publishing point which uses a server-side playlist. Windows Media Player does provide access to the media attributes (Artist, Track, Copyright, etc) when playing the very same URL, because of course this is essential information. The data is there, but Silverlight fails to use it.

    <script language="javascript" type="text/javascript">
    function
    onMediaOpened(sender, eventArgs)
    {
       
    var MediaElement
       
    var MediaAttributeCollection;
       
    var MediaPlayer = sender;
       MediaElement = MediaPlayer.get_mediaElement();
       alert(MediaElement.Attributes.Count);

    }
    </script>

    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <
    asp:MediaPlayer ID="MediaPlayer1" runat="server"
     
    MediaSource="http://internal.windowsmediaservices/publishingpoint"
      AutoPlay="True"
      Height="100px"
      Width="100px"
      OnClientMediaOpened="onMediaOpened" />

    Conclusion

    Clearly, the Silverlight run-time needs to be fixed to obtain this data from the stream headers and use it to populate the Attributes collection. Failing to populate the attributes is a clearly bug, since the missing functionality is essential. I assume that somebody forgot to execute the procedure when implementing the new SSPL functionality in Beta 2. It needs to be there. Please put it back! :)

    Tuesday, June 10, 2008 11:52 AM

All replies

  • Hello, asp:MediaPlayer Server Control will create a Silverlight 1.0 application. Please create your own Silverlight 2 Beta 2 application for this scenario.

    Thursday, June 12, 2008 5:55 AM
  • 1. Are you suggesting that a correctly produced Silverlight 2.0 Beta 2 application will not be affected by this problem? if so, could you please specify which property you believe provides access to the metadata in question: Title, Artist, Copyright?

    2. I have installed both the Beta 2 runtime and the "Silverlight Tools Beta 2 for Visual Studio 2008", therefore would expect the asp:MediaPlayer control to produce a Silverlight 2.0 client:-

    "This add-on to Visual Studio 2008 allows you to use .NET to create Silverlight 2 Beta 2 Web sites. The Silverlight 2 Beta 2 Runtime and the Silverlight 2 Beta 2 SDK are installed as part of this install."

    http://www.microsoft.com/downloads/details.aspx?FamilyId=50A9EC01-267B-4521-B7D7-C0DBA8866434&displaylang=en

    3. I would like to try your methodology to "create your own Silverlight 2 Beta 2 application". Could you explain how you would reccomend doing this? I do have "Expression Blend 2.5 June 2008 Preview" installed, if you believe your suggestion will solve the problem at hand:-

    "The Blend 2.5 June Preview has added support for flexible authoring of Silverlight 2 Beta 2 projects."

    http://expression.microsoft.com/en-us/cc643423.aspx

     

    Thursday, June 12, 2008 6:52 AM
  • To clarify, this serious problem exists no matter how you create the Silverlight 2.0 Beta 2 client application. The Attributes property of the MediaElement (Title, Artist, Copyright, etc) is not populated when playing a stream. It could be, and it should be, but it isn't. Windows Media Player and other streaming media clients provide access to this data when playing the same stream, as of course they rightly should do.

    For example, here is another simple Silvelight Application created in either Expression Blend 2.5 or VS2008 with Silverlight Tools Beta 2. In this example, the number of attributes is always zero (Attributes.Count = 0) because the collection is never populated:

    Page.xaml

    <UserControl x:Class="SilverlightApplication2.Page"
        xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation 
        xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml 
        Width="400" Height="400">
     
    <Grid x:Name="LayoutRoot" Background="White">
       
    <MediaElement Name="mediaElement1" Margin="1" Width="400" Height="400"  
            MediaOpened
    ="MediaElement_MediaOpened"></MediaElement>
       
    <Button Name="button1" Width="50" Height="50"
            Click
    ="Button_Click"></Button>
       
    <TextBox Name="textBox1" Width="100" Height="20"
            MouseLeftButtonDown
    ="TextBox_MouseLeftButtonDown"></TextBox>
      </Grid>
    </
    UserControl>

    Page.xaml.cs

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        System.
    Uri mediaSource = new System.Uri(@"http://windowsmediaservices/publishingpoint");
        mediaElement1.Source = mediaSource;
        mediaElement1.Play();
    }

    private void MediaElement_MediaOpened(object sender, RoutedEventArgs e)
    {
        textBox1.Text = mediaElement1.Attributes.Count.ToString();
        textBox1.UpdateLayout();
    }

     

    Friday, June 13, 2008 11:05 AM
  • I'm facing the same problems and would like to also say that we HAVE to have access to the media metadata.

    I'm trying to replace the Windows Media Player control which doesn't work too well across browsers with a Silverlight application to listen to our streams, this essentially makes SL useless for the purpose

    Tuesday, July 01, 2008 6:02 AM
  • Has any one found a fix for this yet, i am also faced by the same problem.  i do get the information in the asx client side asx file  but nothing from the media being played on the server,  ie descriptions etc

     

     

    Thursday, July 03, 2008 9:24 AM
  • Ditto. This seems like a pretty obvious requirement to overlook. Anyone find a workaround in beta 2?

    Here is a link to more about sspl's in beta 2: http://msdn.microsoft.com/en-us/library/cc189079(VS.95).aspx
     
    It looks like only WSX is supported? Correct me if I am wrong, but it is ASX we want for live streams? Anyone know is ASX can be supported?
    Friday, July 04, 2008 2:13 PM
  • I would like to add my voice here...

     I use the WebClient and then a SetSource to assign the stream to the MediaElement ... the attributes are empty, and it would be handy for our application to have this information.

     Thanks

    Thursday, July 10, 2008 4:51 PM
  • Plz help on this issue  ASAPCrying

    Wednesday, August 27, 2008 12:51 AM
  • does anybody have a solution or a workaround for this? All I want to do is get the name of name of the current file from the server

    Tuesday, March 31, 2009 7:08 PM
  • Can we get an answer on this from Microsoft please?

    I too am having this problem.  My company is currently evaluating using Silverlight and this would contractually remove it from the running and we would be forced to go with Flash.  I would prefer Silverlight, but I must be able to read the stream meta data, media information and closed captioning params that were available to me in WMP.

     Does anyone know if this has been resolved?

    Thursday, April 09, 2009 3:20 PM
  • Hi I have the same problem here. I am using a Silverlight 4 MediaElement and setting the source to my MP3 audio track which contains the ID3V1 Tag only. The attributes are checked after getting the "Media_Opened" event from MediaElement. I will be pleased to know how the MediaElement will support the MP3 Tag. Regards
    Thursday, June 17, 2010 2:55 PM
  • I've uploaded a track to test. Please download this MP3 track to test here:
    http://www.file-upload.net/download-2617219/Elenor_techno.mp3.html
    Monday, June 21, 2010 5:53 PM
  •  Here is the sourcecode and XAML. As you will see, any player can show the MP3 Tag. Except Silverlight. I need to know how to solve it (without using additional other thirdpary software).

     

     

    <UserControl x:Class="MP3_Tag_test.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
    
        <Grid x:Name="LayoutRoot" Background="White" Margin="12">
            <StackPanel Orientation="Vertical">
                <MediaElement x:Name="MediaHelper" Visibility="Visible" />
                <TextBlock x:Name="txtTitle" Text="Title" FontSize="28" />
                <Button Content="STOP" Height="23" HorizontalAlignment="Left" Name="Button3" Width="75" />
                <Button Content="Play MP3" Height="23" HorizontalAlignment="Left" Name="Button1" VerticalAlignment="Top" Width="75" Margin="0,20,0,0" />
                <Button Content="Play stream" Height="23" HorizontalAlignment="Left" Name="Button2" VerticalAlignment="Top" Width="75" />
            </StackPanel>
        </Grid>
    </UserControl>
    
       
    Partial Public Class MainPage
        Inherits UserControl
    
        Public Sub New()
            InitializeComponent()
        End Sub
    
        Private Sub MainPage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
    
        End Sub
    
        Private Sub MediaHelper_CurrentStateChanged(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles MediaHelper.CurrentStateChanged
            If Me.MediaHelper.Attributes.ContainsKey("Title") Then Me.txtTitle.Text = Me.MediaHelper.Attributes("Title")
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
            Me.txtTitle.Text = "Loading mp3..."
            
            Me.MediaHelper.Source = New Uri("http://dave-d.ch/database/music/public/1000036869_stefan%20lange%20koolja.mp3")
            Me.MediaHelper.Play()
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button2.Click
            Me.txtTitle.Text = "Loading stream..."
           
            Me.MediaHelper.Source = New Uri("http://asx.skypro.ch/radio/internet-128/fm1-nord.asx")
            Me.MediaHelper.Play()
        End Sub
    
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button3.Click
            Me.MediaHelper.Stop()
        End Sub
    End Class
     
    Monday, June 21, 2010 7:20 PM
  • Wow!  This thread was going so well... it describes my "problem" perfectly. 

    Have we gotten anywhere on how to read the attributes/tags from a Windows Media Services Publishing Point?

    Friday, January 14, 2011 3:07 AM