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

as3 I need to play mp4 video! I use FileReference (ByteArray)

New Here ,
Jan 30, 2014 Jan 30, 2014

This code do not work:

data - ByteArray

var nc:NetConnection;

                              var ns:NetStream;

ns.appendBytes(data);

nc=new NetConnection();

                                        nc.connect(null);

                                        ns=new NetStream(nc);

                                        var video:Video = new Video();

                                        video.attachNetStream(ns);

                                        ns.play(null);    

addChild(video);

Help me!

TOPICS
ActionScript
2.1K
Translate
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
Community Expert ,
Jan 30, 2014 Jan 30, 2014

where's data defined?

Translate
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 ,
Jan 31, 2014 Jan 31, 2014

I download video mp4 or 3gp file from local memory.

Translate
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
Community Expert ,
Jan 31, 2014 Jan 31, 2014

that's where your error is.  show the code that defines data.

Translate
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 ,
Jan 31, 2014 Jan 31, 2014

I try to load video from local computer.

I alreary done it for FLV format via NetStream.

Now i need to support MP4 and 3GP video formats. I don't know can I do it only in client or I need first upload video to server and than than use it.

Translate
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
Community Expert ,
Jan 31, 2014 Jan 31, 2014

i don't understand your lasst question.

in addition, it's not clear why your using appendBytes.  the only thing that's clear is that the error is in defining data and you're not showing what that error is.

Translate
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 ,
Feb 01, 2014 Feb 01, 2014
LATEST

1. appendBytes understands FLV only by default.

2. In order to play mp4 (or any other than FLV format) you need to use appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN) so that Flash reads file correctly. This is quite a flaky proposition anyway.

3. appendBytes must be called after play(null) is called. Otherwise Flash throw an error.

Correct sequence:

     ns.play(null);

     ns.appendBytes(ba);

Incorrect sequence:

     ns.appendBytes(ba);

     ns.play(null);

Translate
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