0 Replies Latest reply on Oct 24, 2011 2:32 PM by _conradosouza

    How to stream a encrypted FLV in OSMF?

    _conradosouza

      I'm working on a local application ( it's not a website or nothing related ) and I have various FLVs with a very simple encryptation method by now (just like adding 10 at each byte).

      I can load/play them using NetStream.appendBytes() after decrypting, but that happens only after I read all video data it's not streamed.

      What I really need is to stream those videos from a remote url, and decrypting while receiving data, using a OSMF based player that I already have built. I'm lost on how OSMF deals with FLV, otherwise, I would try to create a plugin or something like. I'd be very thankful if someone point me how to deal with that.

      But I'd be happy if someone help me to find a way to load a local file using OSMF, passing a ByteArray value, instead of a url (below). Or even giving me directions to create a OSMF plugin to solve my problem.

       

      videoElement.resource = "video_url/video.flv";
      

       

       

      This is my current code just to play my decoded FLV byte array

       

       

      private function playBytes(bytes:ByteArray):void 
      {
                  // detecting it's header
                  if (bytes.readUTFBytes(3) != "FLV")
                  {
                      _text.appendText("\nFile \""+ file +"\" is not a FLV")
                      return void;
                  }
      
                  bytes.position = 0;
                  netConnection.connect(null);
                  netStream = new NetStream(netConnection);
                  netStream.client = { onMetaData:function(obj:Object):void { } }
                  video.attachNetStream(netStream);
      
                  addChild(video); 
      
      
                  // put the NetStream class into Data Generation mode
                  netStream.play(null);
                  // before appending new bytes, reset the position to the beginning
                  netStream.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
                  // append the FLV video bytes
                  netStream.appendBytes(bytes);
      }