Skip to main content
Microsoft Silverlight
Home Forums Silverlight Programming Report a Silverlight Bug Attributes missing when Silverlight plays stream from server-side playlist
10 replies. Latest Post by pmarker34 on April 9, 2009.
(1)
Tim Acheson
Member
45 points
45 Posts
06-10-2008 11:52 AM |
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" />
<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" /><
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! :)
Yi-Lun L...
All-Star
25054 points
2,747 Posts
06-12-2008 5:55 AM |
Hello, asp:MediaPlayer Server Control will create a Silverlight 1.0 application. Please create your own Silverlight 2 Beta 2 application for this scenario.
06-12-2008 6:52 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
"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
"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
06-13-2008 11:05 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
<
Page.xaml.cs
MarauderzMY
633 points
273 Posts
07-01-2008 6:02 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
rtrimble
2 points
1 Posts
07-03-2008 9:24 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
brianb
6 Posts
07-04-2008 2:13 PM |
Ditto. This seems like a pretty obvious requirement to overlook. Anyone find a workaround in beta 2?
Ken Pletzer
07-10-2008 4:51 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
ajayajay
12 points
20 Posts
08-27-2008 12:51 AM |
Plz help on this issue ASAP
iandixon
03-31-2009 7:08 PM |
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
pmarker34
4 points
04-09-2009 3:20 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?