PDA

View Full Version : Need testers and helpers


honion
08-16-2005, 08:43 PM
I have been trying to adapt found actionscript to work for streaming video and I am having problems. The buffering video that plays at the beginning is supposed to show up whenever the buffer is empty, it isn't doing that when the pause and play again buttons are used. They do work but the screen is just black. Second problem is the video cutting off at a different spot everytime and rewinding. Any ideas? Here is the link for testing

See it here (http://www.view-career-video.com/videos/flash/cingularcorp535x460.html)

Here is the actionscript used


var nc:NetConnection = new NetConnection();
nc.connect("rtmp://flash.maddash.net/flashv/cingular");

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(15);

ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
if(info.code == "NetStream.Play.Stop") {
ns.seek(0);
}
}

theVideo.attachVideo(ns);

ns.play("cingularcorp");

againButton.onRelease = function() {
ns.seek(0);
}

pauseButton.onRelease = function() {
ns.pause();
}

var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
duration = obj.duration;
}

function videoStatus() {
loader.scrub._x = ns.time / duration * 240;
}

var scrubInterval;

function scrubit() {
ns.seek(Math.floor((loader.scrub._x/235) * duration));
}

Navarone
08-16-2005, 09:15 PM
I think you have a mistake here try using a global duration parameter:

ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
//should be
ns.onMetaData = function(obj) {
_global.videoDuration = obj.duration;
// trace(obj.duration);
};

honion
08-16-2005, 09:25 PM
I tried that but now the progress indicator doesn't move at all. :(

Navarone
08-16-2005, 09:34 PM
Ok, check this fla file. I found this sometime ago probably on flashMX, and used it to build my own scrubber, so I'll pass this on to you. It may be helpful.