hi everyone!
i have built an flv video player in flash 8 which is working perfectly in safari and internet explorer. in firefox, however, it is playing the clip immediately whilst still buffering with very distorted sound. then its jumping back to the beginning repeatedly. here is a relevant code sample, if anyone can help me i’ll be eternally grateful, its making me CRAZY!!!
var nc:NetConnection = new NetConnection();
nc.connect(null);
var my_ns:NetStream;
var my_ns:NetStream = new NetStream(nc);
my_ns.setBufferTime(10);
my_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”) {
my_ns.seek(0);
}
};
this.createEmptyMovieClip(“vSound”, this.getNextHighestDepth());
var sound:Sound = new Sound(vSound);
var listenerObject:Object = new Object();
// the XML Object that will hold the track information
var videoListXml:XML;
//the callback function triggered by the XML onLoad event
function loadXML(loaded) {
if (loaded) {
loadingText.mediaLoading.traceIt = “media loaded”;
xmlNodeSongs = this.firstChild.childNodes[1];
header = [];
high = [];
low = [];
wmv = [];
total = xmlNodeSongs.childNodes.length;
for (i=0; i<total; i++) {
header* = xmlNodeSongs.childNodes*.attributes.title;
high* = xmlNodeSongs.childNodes*.attributes.hi;
low* = xmlNodeSongs.childNodes*.attributes.lo;
wmv* = xmlNodeSongs.childNodes*.attributes.wmv;
videoMenu(i);
}
firstVideo();
loadingText.mediaLoading.traceIt = “”;
} else {
loadingText.mediaLoading.traceIt = “media not loaded!”;
}
}
videoListXml = new XML();
videoListXml.ignoreWhite = true;
//specify which function to handle on load event
videoListXml.onLoad = loadXML;
//the core function
function doPlay() {
if (_root.format == “flash”) {
//we always want to start with a fresh NetStream object,
//so initialize the environment:
clearInterval(videoInterval);
clearInterval(timeInterval);
my_ns.stop();
displayDuration_txt.text = “”;
displayPosition_txt.text = “”;
theStatus.playingPausing.videoStatus = bufferingStatus
//initialization is finished; now start from scratch
theVideo.attachVideo(my_ns);
if (_root.bandwidth == “hi”) {
my_ns.play(high[p]);
trace(high[p])
} else if (_root.bandwidth == “lo”) {
my_ns.play(low[p]);
}
nowPlaying = header[p];
btnPause._visible = true;
btnPlay._visible = false;
vSound.attachAudio(my_ns);
volume_mc.slider_mc._x = (Math.floor((volume_mc._width+20)/2));
theStatus.playingPausing.videoStatus = playingStatus;
//create the setInterval functions that display time data
var videoInterval = setInterval(videoStatus, 100, my_ns);
//var timeInterval:Number = setInterval(checkTime, 100, my_ns);
my_ns.onMetaData = function(obj) {
duration = obj.duration;
var Dminutes:Number = Math.floor(duration/60);
var Dseconds = Math.floor(duration%60);
if (duration<10) {
Dseconds = (“0”+duration);
}
displayDuration_txt.text = Dminutes+":"+Dseconds;
};
} else if (_root.format == “wmv”) {
getURL(“video.php?lang=”+_root.lang+"&mix=/video/"+wmv[p], “_blank”)
muteBtn._visible = false;
maxBtn._visible = false;
btnNext._visible = false;
btnPrevious._visible = false;
loader._visible = false;
volume_mc._visible = false;
btnPlay._visible = false;
btnPause._visible = false;
theVideo._visible= false;
volumeLabel = “”;
controlsLabel = “”;
displayPosition_txt = “”;
displayDuration_txt = “”;
}
}
function firstVideo() {
p = 0;
doPlay();