• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to load a ByteArray FLV in OSMF?

New Here ,
Oct 19, 2011 Oct 19, 2011

Copy link to clipboard

Copied

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 (just like adding 10 at each byte).

I can load/play them using NetStream.appendBytes() after my decrypt, but that happens only after I read all video data.

What I really need is to stream those videos from a remote url, and decrypting while receiving data, using a OSMF player that I already have.

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);

}

[I moved the discussion from OSMF, to here, due the lack of attention there]

TOPICS
ActionScript

Views

1.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2011 Oct 22, 2011

Copy link to clipboard

Copied

Well, this is a very daunting task. In OSMF there is whole group of classes related to HTTP streaming that have this implementation - appending packets to previously established NetStream.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 22, 2011 Oct 22, 2011

Copy link to clipboard

Copied

Andrei1, thank you for replying, but I still need  directions.

I searched all the web, and various OSMF classes, and OSMF docs, and I found nothing related - I'd be happy if I realize that I wasn't searching well, and someone show me all the links I have missed.

I also thought in creating a plugin for OSMF, but I realized that is not an easy task.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2011 Oct 22, 2011

Copy link to clipboard

Copied

I looked at it a couple of month ago and, frankly, don't remember exact package that takes care of it. I don't have OSMF code on this machine - so I cannot look into it now.

I doubt there are many resources on the web regarding this. This is a very specialized functionality and very few people attempted to do what OSMF does. We have figured out certain aspects but were not able to completely replicate it. Again, it is a very daunting task to search of byte offsets and match with file format specs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 30, 2012 May 30, 2012

Copy link to clipboard

Copied

LATEST

Have you more code for this example ?

thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines