Archive for June, 2010

Live Streaming in Silverlight 4

A few days ago I started to deep into live streaming in Silverlight since I needed to insert a live IP broadcasting webcam in a Silverlight project.

As we know there is MediaElement that has a limited supported formats and a first approach was to provide the Source of the MedialElement with the link to the video live stream.

The problem in all this was that the webcam provided a stream in .mjpg format witch is not supported by Silverlight.

So I started to do research campaign on Google and went over IIS Smooth Streaming , which was very nice to see how easy you can make a smooth stream from a video at high resolution, but this was not fit to my problem from to main reasons:

1. I had no hardware aces to my webcam so I can make a Live Broadcasting Project in Expression Encoder

2. my stream was real live stream not a video that I could encode

3. I had no Server to encode the live stream

clip_image002

Here is the clasic wey with an existing video How Do I: Getting Started with Smooth Streaming 

So the solution was either to make the webcam somehow broadcast a Silverlight supported format or to do an live encoding without using a Windows Server.

The encoding can be made either using ffmpeg.exe of using VLC media player.

I started to experiment different links an types of formatting supported by Silverlight ad I arrived to the conclusion that this is very good and looks good in Silverlight

http://91.121.173.78:8254;stream.nsv :sout=#transcode vcodec=WMV2,vb=5000,fps=30,scale=1,acodec=wma2,ab=128,channels=1,samplerate=44100}:std{access=mmsh,mux=asfh,dst=MyIP:PortNo} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep

The link is from a live broadcasting TV named Hit Music TV , and the rest is the settings configured and generated in\by VLC.

To make a very simple test:

1. make a Silverlight project,

2. add a MediaElement

3. Open VLC , start a live stream Like This

4. Very important thing -> set the media Source like this

clip_image004

Where MediaUrl is the uri to the Live stream

Also pay attention to the port on which you start the local stream , usually is 8080.

The thing that I didn’t like about all this is that every time I waned to start a VLC stream I had to manually introduce the parameter for the stream, and all settings, so I’ve found the way to lunch the VLC from command line and start the stream directly from a WPF application.

To facilitate all this and show all this in a more presentable way I had created a small Silverlight 4 application and an Expander with the links for the Stream Sources and a window so you can create either a Media element or a Medial Player control to display the stream from the provided link.

Here is a video that illustrates the functionality of this small project.

Since the point here is Live stream in Silverlight I, will not get into project details here.

Here is a video of projects Silverlight and WPF.

  

Advertisements

Leave a comment

Talking about Implementing Model-View-ViewModel in Silverlight – Pixel8 – Infragistics Community

Leave a comment

Talking about Understanding the Model-View-ViewModel Pattern :: Sessions :: Microsoft MIX10

Leave a comment

DomainDataSource is gone and namespaces are different in new RiaServicesToolkit

 

After trying to make a Ria application and going into details I started to see real live problems and one of them is that in the release version of RiaServicesToolkit Ria Libraries Namespaces are not the same as use to be and much of the demo applications are made with old namespaces.

A document where that is explained can be found here WCF_RIA_Breaking_Changes

Here is a small example:

Previous Assembly Name

New Assembly Name

System.Windows.Ria

System.ServiceModel.DomainServices.Client + System.ServiceModel.DomainServices.Client.Web

System.Windows.Controls.Ria

System.Windows.Controls.DomainServices

 

And a very nice explanation of DomainDataSource  can be found here DomainDataSource Filters and Parameters

Leave a comment