Monday, September 24, 2007 2:11 PM
Im generating a live stream using the WriterNetworkSink object from the WMF 11 SDK.
I have a very simple Silverlight 1.0 web application, based on the Silverlight VS2005 template that installs with the Silverlight 1.0 SDK. It just has a canvas with a MediaElement:<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<MediaElement x:Name="mediaPlayer" Source="mms://myHost:port" Width="300" Height="300" />
But when i load the application in a browser (IE 7) I don't see any video.
I've also tried setting the Source to http://myHost:port. At the moment the live stream and the Silverlight application are both on the same machine (my development machine, WinXP SP2). The live stream is on port 123 (I've tried several different ports with the same results) and I'm tesing the Silverlight app using the VS2005 Development Server (F5).
If I change the MediaElement's Source to a local media file (video.wmv) with the same profile as the live stream, or to a remote URL to a media file (http://path to remote file.wmv) it works fine.
1. Does MediaElement support this usage scenario?
2. If so, any ideas why it doesn't work in this case?
3. If not, is there an alternative way to play a live stream generated on a Win XP / Vista system in a Silverlight MediaElement?
Thanks in advance, Andy
Thursday, September 27, 2007 11:03 AM
I thought I should update this thread just in case anyone else is experiencing similar problems...
The scenario described does work using the mms://host:port URL on the MediaElement's Source property. It does not work using the http://host:port URL. Both the http and mms based URLs work in Windows Media Player. I think I read that the MediaElement uses the http / mms prefixes as a hint, and should fall back to streaming if downloading under http doesn't work, but that doesn't seem to be the case in this scenario.
I think my original problem was that I was emulating the live stream by using a wmv file and the WMVNetWrite sample from the WMF SDK to re-transmit the video. The MediaElement was taking so long to connect to the source and buffer the content that the file was ending before anything got displayed - probably a combination of the profile used by the video file and the MediaElement's BufferingTime property setting. I've now put together a test live source that generates a test pattern with a frame counter at various resolutions / frame-rates and with various media profiles and I also reduced the MediaElement's BufferingTime to 2 seconds and it all works pretty well.
I've tested under Windows XP / Vista and Mac OS, using the development web-server integrated with VS2005 and IIS, LAN and WAN (with appropriate firewall / router setup) and it all seems to work as expected so far using the Silverlight 1.0 release.
Now I just need to get to grips with the Windows Media SDK and the media profiles and wire it up to the real live source (a high resolution digital camera) and ...
But that's another set of questions for a different forum...
Friday, September 28, 2007 2:19 AM
Silverlight TV1 and 2 links http://guide.ceit.metu.edu.tr/ site is a the only working sample of live broadcast.
I hope the guys there teach us how they did this. They re broadcast NTV television live.
MS experts are not interested in this problem, although it is the most asked question.
Friday, September 28, 2007 12:29 PM
I am also getting problems with this, problem is I actually need to stream video from files as I need to ensure they are not stored in the client local proxy as until v1.1 has DRM enabled, this is the only way to ensure the content of the videos can't be copied, this being the main value of the application I am developing.
If anyone does manage to figure out a solution I'd love to hear it!!
Monday, May 26, 2008 4:28 PM
thanks for posting this answer; I faced the same problem and your answer helped me solve it.
In contrast to your solution I tried to create the MediaElement in the code behind file, which brought another problem with it: If I set the Source Property of the MediaElement directly, it does NOT work:
// The following line does NOT Work:// mediaElement.Source = new Uri("mms://localhost:8080/", UriKind.Absolute); However, if I use the SetValue(..) method, it works fine:
// The following line works:
I hope that my findings will be helpful to others.
By the way, this is for Silverlight 2.0
Thursday, June 12, 2008 10:01 AM
This is not working
Thursday, June 12, 2008 10:18 AM
Can you please be more specific?
What exactly is not working?
Please share your code
Which Exact version of Silverlight? (My example above is for Silverlight 2.0 Beta 1)
How to you create your live video stream?
Thursday, September 04, 2008 5:39 AM
sorry, that was my mistake.
Now it is working fine
Tuesday, September 09, 2008 6:45 AMhi, can you plaese tell me what kind of project did you started? i need to use mms, but i am not sure what type of project to start. thnaks
Tuesday, September 09, 2008 7:22 AM
On the client side (Silverlight) I used the Visual Studio 2005 project template that is installed with the Silverlight 1.0 SDK. I guess there are different options available with the Silverlight 2.0 Beta, but I haven't played with it yet.
On the server end (Windows Media Format 11) I just created a C++ application project and added appropriate references to the WMF components based on the sample applications and WMF SDK documentation.
Wednesday, September 10, 2008 2:17 PM
One quick correction to the following:
// The following line works:
mediaElement.SetValue(MediaElement.SourceProperty, new Uri("mms://localhost:8080", UriKind.Absolute));
Thursday, September 18, 2008 7:21 AM
My code is
PartyName.SetValue(MediaElement.SourceProperty,new Uri("http://silverlight.services.live.com/74017/PrajaRajyam/video.wmv", UriKind.Absolute));
but this doest work plz help
i am using silverlight.live.com for video streaming