Copyright © CompuTeK Data Consultants
Previous Page

FLV Video file on server is 10.8 Megabyes

This examples uses ActionScript to load the movie externally into a custom created player, read the bytes loaded and give function to the stop and play button plus 45 seconds of buffering for smooth playback. Buffering can be adjusted in this line :
( netStream.setBufferTime(45);)

Code for the streaming movie ----------------------------->

Code for Stop Button:

on (release) {
stream_ns.close();
stop();
}

Code for Play Button:

on (release) {
stream_ns.play("hanging_final.flv");
gotoAndPlay(1);
}

Haven't worked on position tracking, rewinding or other player features.

 

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
netStream.setBufferTime(45);
stream_ns.play("hanging_final2.flv");

this.createTextField("loaded_txt", this.getNextHighestDepth(), 10, 10, 160, 22);

var loaded_interval:Number = setInterval(checkBytesLoaded, 500, stream_ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded/my_ns.bytesTotal*100);
loaded_txt.text = Math.round(my_ns.bytesLoaded/1000)+" of "+Math.round(my_ns.bytesTotal/1000)+" KB loaded ("+pctLoaded+"%)";
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded>=100) {
clearInterval(loaded_interval);
}
}

Flaws:

According to this:

http://www.macromedia.com/devnet/mx/flash/articles/flv_download_05.html

this is a progressive download. It states the flv file is cached on the hard drive but I can't locate it in my IE Temp files. Since we don't have Flash Communication Server we can't stream the video.