Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 92756

Re: Load mp4 from Server and Save local

$
0
0

I took your example and modified it slightly and got no error. Before I modified it, Flash CS6 froze on my machine and I had to force quit it. I think it comes from trying to have the ByteArray be set equal to the Loader.data property. I changed it so that the ByteArray is a new ByteArray() and wrote the data to the array once the load finished and it seems to work fine.

 

import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.utils.ByteArray;

var ba:ByteArray = new ByteArray();
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoadComplete);
loader.addEventListener(ProgressEvent.PROGRESS, onProgress);
loader.load(new URLRequest("http://178.62.142.45/media/filer_public/d7/54/d754171a-f63b-4d62-923b-36619fd5dbc5/1.mp4"));

function onProgress(e:ProgressEvent):void {
  trace(int(100 * (e.bytesLoaded / e.bytesTotal)) + "%");
}

function onLoadComplete(e:Event):void {
  ba.writeObject(loader.data);  trace(ba.length);
}

Viewing all articles
Browse latest Browse all 92756

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>