[Red5] Live Silverlight streaming is a go.

Andy Shaules bowljoman at hotmail.com
Sun Nov 8 16:14:40 PST 2009


Ok, I have had enough fun playing with this toy.

Here is the complete story.

http://www.thebitstream.com/?p=108

and source code 

http://www.thebitstream.com/downloads/red5/Red5ToSilverlight.zip

Every thing is released under gpl. 

Have fun!

Andy

  ----- Original Message ----- 
  From: Andy Shaules 
  To: red5 at osflash.org 
  Sent: Wednesday, November 04, 2009 1:38 PM
  Subject: Re: [Red5] Live Silverlight streaming is a go.


  no live demo, its all in my laboratory network.

  Live video will materialize when I nail down h264 codec private data that is needd by silverlight.

  VOD is possible too if you write a BucketFactory to stuff flv packet data payloads into a cookie with the time and type.

  It could go progressive or stream similar to rtmp scrubbing depending on the class you write to copy the buffer payloads.

  I think that control messages can be posted by the client to signify seek points.


    ----- Original Message ----- 
    From: Ignacio Lopez 
    To: red5 at osflash.org 
    Sent: Wednesday, November 04, 2009 1:31 PM
    Subject: Re: [Red5] Live Silverlight streaming is a go.


    Great! Any live demo we can see?? hehe sorry for the anxiety but this stuff is really cool. Have you tried it with video (live or VOD)?


    On Wed, Nov 4, 2009 at 6:15 PM, Andy Shaules <bowljoman at hotmail.com> wrote:

      I meesed with florine for abut an hour and decided it was far too asp related. Seems most of te work is to use flash amf with asp servers.

      There is a nice 'NetConnection' class I played with for a bit, but the security policy of silvver light SUCKS.

      You though flash was restrictive, howabout no socket connections lowe than 5040 or so.

      FLourine is an awesome project with a buch of neat things to look into, but having to run a socketpolicy server on port 943 just to begin, I decided it was far faster and extendable FOR ME, to implement a Http client , although it will still need a crossdomain policy file.

      I think in the end, until mms protocol is implemented into tomcat and easy to use with red5, My 'Bucket-Cookie' Nest protocol is ready to go. Even using the netconnection client in Flourine would leave a whole bunch of stuff TODO.

      The protocol was writen , implemented and tested in two days. Then I spent two days writting and testing a source class in silverlight.

      Although I did mention that non-GUI threading is available, you wont 'feel' it in firefox like you will in IE.

      In firefox, while moving the window I could sense all my debugging output was causing some hesitation. I dont like that.

      Andy

        ----- Original Message ----- 
        From: Ignacio Lopez 
        To: red5 at osflash.org 
        Sent: Wednesday, November 04, 2009 12:57 PM
        Subject: Re: [Red5] Live Silverlight streaming is a go.


        Hey! Cool stuff indeed! 


        Something came up to the list previously that may be an interesting addition to the mix: http://www.fluorinefx.com/


        On Wed, Nov 4, 2009 at 5:30 PM, Andy Shaules <bowljoman at hotmail.com> wrote:

          Waaahooo! Joy does stream!

          I will likey release the java side first.

          Rough draft.

          Redsilver Messenger Service:
          Version 0.2.1
          Copyright Andy Shaules. All rights reserved.

          Redsilver messenger service is an http streaming method to deliver timestamped media samples of multiple data types, to a silverlight subscriber. The container fomat is fractal, in that a container I call a 'Bucket', can contain nested buckets with multiple channels of multiple data types.


          ----------------------------------------

          Raw Bucket chunk from red5

          U32 (NUMBER OF Buckets)
          BYTE  [ UNKNOWN ]

          ------------------------------------------

          Bucket: Simple type

          U32 (TIMESTAMP or CHANNEL)
          U32 (FourCC Code TYPE)
          U32 (LENGTH)
          BYTE[LENGTH] of raw data


          ------------------------------------------

          If TYPE =  'N' 'E' 'S' 'T'
          {
            TIMESTAMP = Data CHANNEL number.
            LENGTH= LENGTH of nested Bucket Chunk

            BYTE[LENGTH]= Nested Bucket of samples or another subchannel within a nested bucket.

          }




          So, for the mp3 audio streaming to silverlight, I grab the data out of the rtmp packet and stuff it into a Bucket with the same timestamp, and size. I could also grab video samples and stuff them into another bucket. Buckets are segmented together into a bucket chunk, OR fed into another bucket NEST. and fed to clients. Subscribers are noted and Old buckets are disposed as they are no longer needed by the clients.

          The red5 application can register 'Redsilver' resources under a string-name. The tomcat client from silverlight passes a request for a resource and if it exists, he gets a token, if not, he gets a status message.

          With a token, the client passes it to red5. Red5 looks at the bucket segment stream in the resource and sends one to the client. The client advances up the segment stream, and old ones are deleted. After a timeout of not requesting, his token is deleted the segment stream garbage collected to the point of ant other client's cue.

          THe Developer has control over all aspects of the protocol. THe number of samples, the length of segments, the period of garbage collection. Resources can be registerred similar to a context path. "lobby/sex/upper" (hahaha joking).

          A service is created by overriding an abstract class called 'BucketFactory' and I added the 'NestedBucketFactory' class to produce the multi channel + multi media  + interlaced data streams.

          BucketStreamSubscription.registerBucketFactory(test.getName());




          I wrote the bucket codec to use with easy methods.

          public static byte[] encode(int timestamp,int fourCC, byte[] data)

          public static byte[] encodeNestData(int streamChannel, byte[] data)

          The folllowing is a little jumbled but it takes about 10 lines of java using my framework to setup a stream into silverlight.


          -------------------------
          Add several samples to the bucket factory like so:

          byte[] bufferOfRawMp3Frames;

          test.nestFactory.onData(BucketCodec.encode(((AudioData)packet).getTimestamp(),('M' | 'P' <<8 |'3' <<16 | ' ' << 24), bufferOfRawMp3Frames.array()));

          --------------------------------------------------------
          when full encode nested buckets into a parent bucket.

          nestData =nestFactory.nestFull();

          //true means it is full and send to bucket segment cue, false would hold it for more data.

          onData(BucketCodec.encodeNestData(0 , nestData),true);


          -----------------------------
          The client then parses as described above.


          You can use sigle channel bucket stream by skipping the 'nest factory' methods and stuff them into the toplevel bucket.
          byte[] encode(int timestamp,int fourCC, byte[] data)

          Conversly, you can stuff Nested buckets into nested buckets into nested buckets inside a BucketChunk. And end up with Multimedia samples for each separate channel delivered to exacting time-points.


            >From there it goes to silverlight :


          MediaStreamSource Classes which become the source for MediaElement display object.


          FUN STUFF! BEAUTIFUL!

          More to come soon.

          Andy

          ----- Original Message ----- From: Mondain
          To: red5 at osflash.org
          Sent: Tuesday, November 03, 2009 8:09 PM
          Subject: Re: [Red5] Live Silverlight streaming is a go. 



          Nice! once again you've done "it".. ;)


          On Tue, Nov 3, 2009 at 7:29 PM, Andy Shaules <bowljoman at hotmail.com> wrote:

          Hey guys, soon Ill write up another full length hair-brained article, but just putting the word out that it works as advertised. I have implemented a hybrid http streaming protocol into a red5 servlet. Combining DNAS NSV and RTMPS and fractals, yes, fractals, I have implemented a multi channel data pipe to silverlight. I doubt its revolutionary but it is very effective.

          Proof of concept project is live mp3 audio streaming from FME 3 to red5 .9 to silverlight 3.0. This evening was the break through when the PC started echoing success through the speakers.

          Interesting points I like about silverlite:

            Real framework for custom transcoders and parsers built into the API.
            True non-GUI thread support and Thread delegates to support said transcoders and parsers.

          Happy campin'

          _______________________________________________
          Red5 mailing list
          Red5 at osflash.org
          http://osflash.org/mailman/listinfo/red5_osflash.org





          -- 
          http://gregoire.org/
          http://code.google.com/p/red5/
          http://code.google.com/p/blue5/




          _______________________________________________
          Red5 mailing list
          Red5 at osflash.org
          http://osflash.org/mailman/listinfo/red5_osflash.org 

          _______________________________________________
          Red5 mailing list
          Red5 at osflash.org
          http://osflash.org/mailman/listinfo/red5_osflash.org





------------------------------------------------------------------------


        _______________________________________________
        Red5 mailing list
        Red5 at osflash.org
        http://osflash.org/mailman/listinfo/red5_osflash.org



      _______________________________________________
      Red5 mailing list
      Red5 at osflash.org
      http://osflash.org/mailman/listinfo/red5_osflash.org






----------------------------------------------------------------------------


    _______________________________________________
    Red5 mailing list
    Red5 at osflash.org
    http://osflash.org/mailman/listinfo/red5_osflash.org



------------------------------------------------------------------------------


  _______________________________________________
  Red5 mailing list
  Red5 at osflash.org
  http://osflash.org/mailman/listinfo/red5_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20091108/7ac89fd0/attachment-0001.html>


More information about the Red5 mailing list