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.
function onMediaOpened(sender, eventArgs)
var MediaPlayer = sender;
MediaElement = MediaPlayer.get_mediaElement();
<asp:ScriptManager ID="ScriptManager1" runat="server" />asp:MediaPlayer ID="MediaPlayer1" runat="server"
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! :)
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."
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."
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:
<Grid x:Name="LayoutRoot" Background="White">
<MediaElement Name="mediaElement1" Margin="1" Width="400" Height="400"
<Button Name="button1" Width="50" Height="50"
<TextBox Name="textBox1" Width="100" Height="20"
System.Uri mediaSource = new System.Uri(@"http://windowsmediaservices/publishingpoint");
mediaElement1.Source = mediaSource;
textBox1.Text = mediaElement1.Attributes.Count.ToString();
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
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).aspxIt 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?
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?
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
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