-
Working fine in Flash Player but not in browsers.
I followed the excellent tutorials at gotoAndLearn.com to build a .flv scrubber utilizing NetStream.seek(). It shows the frames as you scrub thru them perfectly in the Flash player itself.
However, when I view the .swf thru browsers. I have tested on many both Mac and PC, you can't see the frames as you scrub them. You only see the frame where you release the scrubber at.
I have posted the code if it will help. I am knew to working with FLVs and the NetStream obj.
Any thoughts?
Thanks
Code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.play("vic2768K.flv");
rewindBtn.onRelease = function() {
ns.seek(0);
}
playBtn.onRelease = function() {
ns.pause();
}
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function (obj) {
duration = obj.duration;
}
var videoInterval = setInterval (videoStatus, 100);
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.bar_mc._width = amountLoaded * 200;
loader.scrub._x = ns.time / duration * 200;
}
var scrubInterval;
loader.scrub.onPress = function () {
clearInterval (videoInterval);
scrubInterval = setInterval (scrubit, 10);
this.startDrag (false, 0, this._y, 200, this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function () {
clearInterval (scrubInterval);
videoInterval = setInterval (videoStatus, 100);
this.stopDrag();
}
function scrubit () {
ns.seek(Math.floor((loader.scrub._x / 200) * duration));
}
-
I figured it out. Even though the video was completely loaded the problem would still persist. For whatever reason though, simply setting this method NetStream.setBufferTime(Number); to even 1 made the progressively loaded flv scrub the same way it did when playing in the Flash Player.
It seams like setting the buffer would make sense, but as I said I had the problem even once the flv was completely loaded.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|