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