
We just introduced SilverSuite for Silverlight 3 with MPEG4.2, RTSP and Flash FLV support. So you can now play RTSP streams and Flash Video streams from your Silverlight applications. The component comes with full source code to the MediaStreamSource classes and therefore allows you to extend or customize them individually. Also included is a policy server and proxy server, that takes care of your cross domain access restrictions if necessary. Check out the demo
I thought I'd share a simple way to play Youtube videos from the MediaSuite FilePlayer demo application.
When opening a video on youtube the url has following form:
http://www.youtube.com/watch?v=[uniqueID]
From that the server generates an HTML page that includes the parameters to be passed to the video players swf file. Using those parameters we can create a new URL to www.youtube.com that will retrieve an FLV file for us.
Simply add another button to the toolbar:
Double-Click it to create an event and insert following code:
Code:
System.IO.Stream stream; | |
System.Net.WebClient webclient; | |
webclient = new System.Net.WebClient(); | |
webclient.UseDefaultCredentials = true; | |
webclient.Headers.Add(System.Net.HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;)"); | |
try | |
{ | |
stream = webclient.OpenRead(toolStripTextBox2.Text); | |
} | |
catch (System.Exception) | |
{ | |
return; | |
} | |
| |
System.IO.BinaryReader reader = new System.IO.BinaryReader(stream); | |
string httpTxt = ""; | |
byte[] buffer = new byte[1024]; | |
while(true) | |
{ | |
int read = reader.Read(buffer, 0, 1024); | |
| |
if(read == 0) | |
break; | |
| |
httpTxt += System.Text.ASCIIEncoding.ASCII.GetString(buffer, 0, read); | |
| |
} | |
| |
if (string.IsNullOrEmpty(httpTxt)) | |
return; | |
string par ="watch_fullscreen?"; | |
int fullscrPos = httpTxt.IndexOf(par); | |
if (fullscrPos == -1) | |
return; | |
| |
int endQuote = httpTxt.Substring(fullscrPos + par.Length).IndexOf("';"); | |
| |
if (endQuote == -1) | |
return; | |
| |
int startpos = fullscrPos + par.Length; | |
string newurl = string.Format("http://www.youtube.com/get_video.php?{0}", httpTxt.Substring(startpos, endQuote + 1)); | |
| |
toolStripTextBox2.Text = newurl; | |
toolStripButton2_Click(sender, e); |
Here's the end-result for Steve Ballmer going crazy:

We're releasing a new Version of MediaSuite.NET (1.5.892)
New Features include:
Resampler.NET
You can now resample your audio data, from any frequency to another. I'm not going to go into detail of delay lines and taps, but let's just say it works like a charm.

To resample your stream simply call Resample on the buffers you encounter.
FLVReader.NET
We're also including the release version of FLVReader.NET able to parser and split Adobes Flash Video Files up to its most recent version (Version 10) of the file format. This component also doesn't get any easier to use. You simply provide FileName and call Init and then proceed to getting your TrackInfo just like with AVI or MP4 Reader class of MediaSuite. It is able to parse all codec types specified by Adobe. Though, due to license restrictions, you might just be able to use:
Video: H.264 and H.263
Audio: AAC and MP3
Nellymoser and VP6 are still off limits, as far as we know.
Download MediaSuite.NET
What else is coming up:
Yours truly,
Wolfgang Deiml
:: Next >>