04/27/09

Permalink 04:40:03 pm by admin, Categories: Multimedia

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:

03/18/09

Permalink 08:21:17 am by admin, Categories: Multimedia , Tags: aac, flv, h263, h264, mediaserver, mediasuite.net, mp3, rtsp, sip

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:

  • FLVWriter.NET
  • RTSP Server Session Managment classes
  • EasySIP.NET

Yours truly,

Wolfgang Deiml

10/15/08

Permalink 11:15:35 pm by admin, Categories: Multimedia

Hi Everbody,

MediaSuite.NET 1.0.800 got released yesterday, or the time of frustration for .NET multimedia developers is finally over!

If you haven't yet seen the features:

  • Streaming Protocols
    • RTSP.NET
    • SDP.NET
    • Advanced RTP.NET
  • Video
    • H263Decoder.NET
    • H263Encoder.NET
    • MPEG4Decoder.NET
    • MPEG4Encoder.NET
    • H264Decoder.NET
    • H264Encoder.NET
  • Speech/Voice/Audio
    • SpeechDecoder.NET
    • SpeechEncoder.NET
    • AACDecoder.NET

All this, available to any .NET developer using Version 2.0 or higher.

The features are pretty amazing and we have put a good 6 months of effort into this software package. It is not only the first all around set of multimedia components for the .NET framework, but also a very easy to use and performance wise not that far behind native code.
You can pretty much create any type of multimedia application with it. You can write a Streaming Server with it. Or make the decoders and encoders part of your softphones media capabilities.

For example, we have written a complete media player for Microsoft WPF from scratch in under (generously spaced) 700 lines of code using only a few buttons and an Image control. It includes more or less a complete video framing infrastructure for H.263, MPEG4 and H.264 and SDP capability disovery.

Download the Trial to see this demo.

We will also start posting useful code snippets and of course continue to extend MediaSuite.NET with some pretty awesome new features in the near future.

<< Previous :: Next >>

Search

XML Feeds

blog engine