Skip to main content

Unanswered Question Attributes missing when Silverlight plays stream from server-side playlistRSS Feed

(1)

Tim Acheson
Tim Acheson

Member

Member

45 points

45 Posts

Attributes missing when Silverlight plays stream from server-side playlist

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! :)

Yi-Lun Luo - MSFT
Yi-Lun L...

All-Star

All-Star

25054 points

2,747 Posts

Re: Attributes missing when Silverlight plays stream from server-side playlist

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

shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.

Tim Acheson
Tim Acheson

Member

Member

45 points

45 Posts

Re: Attributes missing when Silverlight plays stream from server-side playlist

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

 

Tim Acheson
Tim Acheson

Member

Member

45 points

45 Posts

Re: Attributes missing when Silverlight plays stream from server-side playlist

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();
}

 

MarauderzMY
MarauderzMY

Member

Member

633 points

273 Posts

Re: Re: Attributes missing when Silverlight plays stream from server-side playlist

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
rtrimble

Member

Member

2 points

1 Posts

Re: Re: Attributes missing when Silverlight plays stream from server-side playlist

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
brianb

Member

Member

2 points

6 Posts

Re: Re: Attributes missing when Silverlight plays stream from server-side playlist

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?

Ken Pletzer
Ken Pletzer

Member

Member

2 points

1 Posts

Re: Re: Re: Attributes missing when Silverlight plays stream from server-side playlist

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
ajayajay

Member

Member

12 points

20 Posts

Re: Re: Re: Attributes missing when Silverlight plays stream from server-side playlist

Plz help on this issue  ASAPCrying

iandixon
iandixon

Member

Member

2 points

1 Posts

Re: Re: Re: Attributes missing when Silverlight plays stream from server-side playlist

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
pmarker34

Member

Member

4 points

6 Posts

Re: Re: Re: Attributes missing when Silverlight plays stream from server-side playlist

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?

  • Unanswered Question
  • Answered Question
  • Announcement