PDA

View Full Version : flv/netStream problems / questions


fantasio
11-26-2005, 03:29 PM
hi there,

i am trying to make a lean little flv-media player (for local files, without the communication server) -> see the attached files
sorry i could not attach the video...too big

now, most of the stuff works fine, but there are of course some troubles:

the rewind function only works with a scrub-value of 2 and higher. if the value is for example set to 0.1 forward does work, but rewind does not ...
does anyone have an idea ?

the "NetStream.Pause.Notify" and "NetStream.Unpause.Notify" events never get triggered... even though the stream pauses and depauses properly.
( maybe this has to do with the missing server ?)

thanks for any suggestions.
here is the code:

//"clip" is the video object on the stage
var conn = new NetConnection ();
conn.connect (null);
var ns = new NetStream (conn);
ns.setBufferTime (3);
ns.clip = clip;
ns.onStatus = function (info)
{
switch (info.code)
{
case "NetStream.Buffer.Full" :
stat.text = "playing";
break;
case "NetStream.Play.Start" :
break;
case "NetStream.Buffer.Empty" :
stat.text = "buffering";
break;
case "NetStream.Play.InsufficientBW" :
stat.text = "Insufficient bandwidth";
break;
case "NetStream.Play.Failed" :
stat.text = "stream error: " + info.description;
break;
case "NetStream.Play.StreamNotFound" :
stat.text = "stream was not found";
break;
case "NetStream.Pause.Notify" :
stat.text = "paused";
break;
case "NetStream.Unpause.Notify" :
stat.text = "playing";
break;
}
};
ns.onMetaData = function (obj)
{
this.totalTime = obj.duration;
this.clip._width = obj.width;
this.clip._height = obj.height;
this.clip._visible = true;
};
//
clip.attachVideo (ns);
clip._visible = false;
ns.play ("one.flv");
//
//
var scrub_interval;
//if < 2 rewind does not work...
var windSpeed = 1
//
ffw.onPress = ffw.onDragOver = function ()
{
clearInterval (scrub_interval);
wind (1);
scrub_interval = setInterval (wind, 10, 1);
};
rew.onPress = rew.onDragOver = function ()
{
clearInterval (scrub_interval);
wind (-1);
scrub_interval = setInterval (wind, 10, -1);
};
ffw.onRelease = ffw.onReleaseOutside = ffw.onDragOut = rew.onRelease = rew.onReleaseOutside = rew.onDragOut = function ()
{
clearInterval (scrub_interval);
};
wind = function (dir)
{
ns.seek (ns.time + windSpeed * dir);
};
paus.onRelease = function ()
{
ns.pause ();
};
//
this.onEnterFrame = function ()
{
txt.text = "bytesLoaded: " + ns.bytesLoaded + newline + "time: " + ns.time + newline + "fps: " + ns.currentFps + newline + "buffer: " + ns.bufferTime + newline;
};

starhub
04-05-2007, 08:05 AM
can anyone help? plz?