View comments | RSS feed

NetStream


Object
    |
    +-NetStream

public dynamic class NetStream
extends Object

The NetStream class provides methods and properties for playing Flash Video (FLV) files from the local file system or an HTTP address. You use a NetStream object to stream video through a NetConnection object. Playing external FLV files provides several advantages over embedding video in a Flash document, such as better performance and memory management, and independent video and Flash frame rates. This class provides a number of methods and properties you can use to track the progress of the file as it loads and plays, and to give the user control over playback (stopping, pausing, and so on).

Availability: ActionScript 1.0; Flash Player 7

Property summary

Modifiers

Property

Description

 

bufferLength:Number [read-only]

The number of seconds of data currently in the buffer.

 

bufferTime:Number [read-only]

The number of seconds assigned to the buffer by NetStream.setBufferTime().

 

bytesLoaded:Number [read-only]

The number of bytes of data that have been loaded into the player.

 

bytesTotal:Number [read-only]

The total size in bytes of the file being loaded into the player.

 

currentFps:Number [read-only]

The number of frames per second being displayed.

 

time:Number [read-only]

The position of the playhead, in seconds.

Properties inherited from class Object

constructor, __proto__, prototype, __resolve


Event summary

Event

Description

onCuePoint = function(infoObject:Object) {}

Invoked when an embedded cue point is reached while playing an FLV file.

onMetaData = function(infoObject:Object) {}

Invoked when the Flash Player receives descriptive information embedded in the FLV file being played.

onStatus = function(infoObject:Object) {}

Invoked every time a status change or error is posted for the NetStream object.

Constructor summary

Signature

Description

NetStream(connection:NetConnection)

Creates a stream that can be used for playing FLV files through the specified NetConnection object.

Method summary

Modifiers

Signature

Description

 

close() : Void

Stops playing all data on the stream, sets the NetStream.time property to 0, and makes the stream available for another use.

 

pause([flag:Boolean]) : Void

Pauses or resumes playback of a stream.

 

play(name:Object, start:Number, len:Number, reset:Object) : Void

Begins playback of an external video (FLV) file.

 

seek(offset:Number) : Void

Seeks the keyframe closest to the specified number of seconds from the beginning of the stream.

 

setBufferTime(bufferTime:Number) : Void

Specifies how long to buffer messages before starting to display the stream.

Methods inherited from class Object

addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch



Version 8

Comments


mzscott said on Sep 23, 2005 at 10:01 AM :
Where is the publish method for FCS??
No screen name said on Oct 2, 2005 at 7:27 AM :
Is there any way to control the volume of the sound when playing video using the NetStream object?
djtechwriter said on Oct 20, 2005 at 2:50 PM :
No screen name,

To control the sound in a movie, you need to create an instance of the Sound object. See:
http://livedocs.macromedia.com/flash/8/main/00002668.html
gibbz_ said on Oct 21, 2005 at 8:56 AM :
The documentation about NetStrem.publish() method is here:
http://livedocs.macromedia.com/flashcom/mx2004/main/00000389.html#157902
Why there isn't in the Flash 8 documentation?
djtechwriter said on Oct 21, 2005 at 1:57 PM :
Re: Netstream.publish()

You can find this method documented as part of the Flash Communication Server API. Flash Communication Server is a separate product from Flash Authoring. This livedocs page, and the book it is part of, targets the audience using the Flash Authoring environment. To avoid confusion for those who have Flash Authoring without Flash Communication Server, we have produced separate documentation.
The entire set of Flash Communication Server documents can be found here: www.macromedia.com/support/documentation/en/flashcom/
JohnGrden said on Nov 6, 2005 at 10:28 PM :
Playing an FLV using the NetSream object with a null netConnection fails to play when the path is a UNC path.

If you create a drive letter connection to a network share, it works. Using an UNC, it fails:

http://labs.blitzagency.com/?p=80

Anyone confirm this as a bug? We asked the Security expert at MAX at his presentation, and he seemed stumped and asked us to send him a demo (which we did) but wondered if anyone else experienced this.

John Grden
john@blitzds.com
suzyleech said on Aug 7, 2006 at 7:56 AM :
Is there a way to use the Netstream properties to create a bar showing playhead progress while playing an .flv?

Since there is no 'bytesPlayed' property, nor a 'timeTotal' property, there is no way to compare these with the 'bytesTotal' or the 'time' properties.

I tried to create a progress bar by estimating the total time of the video clip, knowing that I had imported the movie at 400kbps:

function checkSecondsPlayed(my_ns:NetStream) {
var fileSize:Number = my_ns.bytesTotal;
var fileTotalSec:Number = fileSize * 8 / 400000;
var pctPlayed:Number = Math.round(my_ns.time / fileTotalSec * 100);
progressBar_mc.slider_mc._x = pctPlayed;
if (pctPlayed >= 100) {
clearInterval(played_interval);
}
}

var played_interval:Number = setInterval(checkSecondsPlayed,200,ns);

... but the file size must obviously have overhead beyond the strict compression at 400kbps - since the actual playtime of the clip is always shorter then the value computed by fileTotalSec.

Is there any other way to build a play Progress bar?
DarkLightShineth said on Nov 17, 2006 at 8:22 AM :
I can confirm this is a bug, a highly annoying one too, although there seems to be some indication that it can be fixed ammending security configuration files, there is nothing I have seen that fixes the issue. Hopefuly this can be fixed without any security problems, as both the SWF and FLV are local.
No screen name said on Jan 15, 2007 at 4:53 PM :
correct, that is a bug.
lusoned said on Jul 30, 2007 at 3:15 AM :
We are indeed having problems with FLV not running in a UNC path.
Would Adobe have an answer to this?

We ,and many others, would be most appreciated.
Lusoned, NL

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002553.html