Packagegs.display.flv
Classpublic class FLV
InheritanceFLV Inheritance flash.events.EventDispatcher

The FLV class loads and plays an FLV.

It's integrated with the AssetManager so if you preload an flv, f4v, or mp4 the net stream will be availale in the asset manager, and an FLV instance would use the cached net stream (pulling it from the asset manager).

You have to add the video property to the display list.

Examples are in the guttershark repository.



Public Properties
 PropertyDefined by
  currentTime : Number
[read-only] Get the current time.
FLV
  height : Number
Video height.
FLV
  metadata : Object
FLV
  netStream : NetStream
[read-only] The currently playing net stream.
FLV
  percentBuffered : Number
[read-only] The percent of the total buffer that is full.
FLV
  percentLoaded : Number
[read-only] The percent of the video that has loaded.
FLV
  percentPlayed : Number
[read-only] The percent of the video that has played.
FLV
  pixelsPlayed : Number
[read-only] The amount of pixels that are full.
FLV
  pixelsToFill : int
The amount of pixels to use when calculating how many pixels have played and how many pixels for buffer are full.
FLV
  smoothing : Boolean
[write-only] Set the smoothing property on the video.
FLV
  soundTransform : SoundTransform
The sound transform of the stream.
FLV
  totalTime : Number
[read-only] Get the total time.
FLV
  traceStatuses : Boolean
Whether or not to trace out status events from the net stream.
FLV
  updateInterval : Number
The update interval for progress.
FLV
  video : Video
[read-only] The internal video object used to display the flv.
FLV
  volume : Number
The volume of the video player.
FLV
  width : Number
Video width.
FLV
  xmpdata : Object
FLV
Public Methods
 MethodDefined by
  
FLV(pixelsToFill:int = 100, updateIntervalMS:int = 400)
Constructor for FLV instances.
FLV
  
close():void
Stops and closes the net stream and net connection.
FLV
  
dispose():void
Stops playback, closes the net stream, and removes the net stream from the asset manager.
FLV
  
forward(step:Number = 2):void
Fast-forward playback.
FLV
  
isPaused():Boolean
Check if the FLV is paused.
FLV
  
isPlaying():Boolean
Check if the FLV is playing.
FLV
  
isStopped():Boolean
Check if the FLV is stopped.
FLV
  
load(url:String, width:int = 320, height:int = 240, buffer:uint = 4, autoPlay:Boolean = false, showFirstFrame:Boolean = true):void
Loads the video, and optionally shows the first frame.
FLV
  
pause():void
Pause the flv.
FLV
  
pauseResume():void
Pauses or resumes the flv.
FLV
  
play():void
Play the flv.
FLV
  
Seeks to 0 and plays.
FLV
  
resume():void
Resume the flv playback.
FLV
  
rewind(step:Number = 2):void
Rewind playback.
FLV
  
seek(time:Number):void
Seek to a playback time.
FLV
  
seekToAndStop(position:Number = 0):void
Stop the flv, and seeks to the specified position.
FLV
  
seekToPercent(percent:Number):void
Seek to a playback percent.
FLV
  
seekToPixel(pixel:int):void
Seek to a width based off of the pixelsToFill property.
FLV
  
stop():void
Stop the flv.
FLV
Events
 EventSummaryDefined by
   Dispatched when the buffer is empty.FLV
   Dispatched when the buffer was flushed.FLV
   Dispatched when the buffer is full.FLV
   Dispatched when a cue point is reached.FLV
   Dispatched when meta data is received for the current flv.FLV
   Dispatched for progress of the flv.FLV
   Dispatched when an invalid seek time was attempted.FLV
   Dispatched when a seek occurs.FLV
   Dispatched when the flv starts playing.FLV
   Dispatched when the flv stops playing.FLV
   Dispatched when a stream was not found.FLV
Property detail
currentTimeproperty
currentTime:Number  [read-only]

Get the current time.

Implementation
    public function get currentTime():Number
heightproperty 
height:Number  [read-write]

Video height.

Implementation
    public function get height():Number
    public function set height(value:Number):void
metadataproperty 
metadata:Object  [read-write]Implementation
    public function get metadata():Object
    public function set metadata(value:Object):void
netStreamproperty 
netStream:NetStream  [read-only]

The currently playing net stream.

Implementation
    public function get netStream():NetStream
percentBufferedproperty 
percentBuffered:Number  [read-only]

The percent of the total buffer that is full.

Implementation
    public function get percentBuffered():Number
percentLoadedproperty 
percentLoaded:Number  [read-only]

The percent of the video that has loaded.

Implementation
    public function get percentLoaded():Number
percentPlayedproperty 
percentPlayed:Number  [read-only]

The percent of the video that has played.

Implementation
    public function get percentPlayed():Number
pixelsPlayedproperty 
pixelsPlayed:Number  [read-only]

The amount of pixels that are full.

For example, you might set the pixels to fill to 300, and if the movie is 50% played through, you'd get back the number 150. Which correlates to 50% of 300.

Implementation
    public function get pixelsPlayed():Number
pixelsToFillproperty 
public var pixelsToFill:int

The amount of pixels to use when calculating how many pixels have played and how many pixels for buffer are full.

smoothingproperty 
smoothing:Boolean  [write-only]

Set the smoothing property on the video.

Implementation
    public function set smoothing(value:Boolean):void
soundTransformproperty 
soundTransform:SoundTransform  [read-write]

The sound transform of the stream.

Implementation
    public function get soundTransform():SoundTransform
    public function set soundTransform(value:SoundTransform):void
totalTimeproperty 
totalTime:Number  [read-only]

Get the total time.

Implementation
    public function get totalTime():Number
traceStatusesproperty 
public var traceStatuses:Boolean

Whether or not to trace out status events from the net stream.

updateIntervalproperty 
updateInterval:Number  [read-write]

The update interval for progress.

Implementation
    public function get updateInterval():Number
    public function set updateInterval(value:Number):void
videoproperty 
video:Video  [read-only]

The internal video object used to display the flv.

Implementation
    public function get video():Video
volumeproperty 
volume:Number  [read-write]

The volume of the video player.

Implementation
    public function get volume():Number
    public function set volume(value:Number):void
widthproperty 
width:Number  [read-write]

Video width.

Implementation
    public function get width():Number
    public function set width(value:Number):void
xmpdataproperty 
xmpdata:Object  [read-write]Implementation
    public function get xmpdata():Object
    public function set xmpdata(value:Object):void
Constructor detail
FLV()constructor
public function FLV(pixelsToFill:int = 100, updateIntervalMS:int = 400)

Constructor for FLV instances.

Parameters
pixelsToFill:int (default = 100) — The width of the video object.
 
updateIntervalMS:int (default = 400) — The height of the video object.
Method detail
close()method
public function close():void

Stops and closes the net stream and net connection.

dispose()method 
public function dispose():void

Stops playback, closes the net stream, and removes the net stream from the asset manager.

forward()method 
public function forward(step:Number = 2):void

Fast-forward playback.

Parameters
step:Number (default = 2) — seconds to step forward.
isPaused()method 
public function isPaused():Boolean

Check if the FLV is paused.

Returns
Boolean
isPlaying()method 
public function isPlaying():Boolean

Check if the FLV is playing.

Returns
Boolean
isStopped()method 
public function isStopped():Boolean

Check if the FLV is stopped.

Returns
Boolean
load()method 
public function load(url:String, width:int = 320, height:int = 240, buffer:uint = 4, autoPlay:Boolean = false, showFirstFrame:Boolean = true):void

Loads the video, and optionally shows the first frame.

Parameters
url:String — The url of the FLV to load.
 
width:int (default = 320) — The width of the video.
 
height:int (default = 240) — The height of the video.
 
buffer:uint (default = 4) — Seconds of buffer to maintain.
 
autoPlay:Boolean (default = false) — Whether or not to auto play the video.
 
showFirstFrame:Boolean (default = true) — Whether or not to show the first frame of the flv if auto play is false.
pause()method 
public function pause():void

Pause the flv.

pauseResume()method 
public function pauseResume():void

Pauses or resumes the flv.

play()method 
public function play():void

Play the flv.

playFromBeginning()method 
public function playFromBeginning():void

Seeks to 0 and plays.

resume()method 
public function resume():void

Resume the flv playback.

rewind()method 
public function rewind(step:Number = 2):void

Rewind playback.

Parameters
step:Number (default = 2) — seconds to step backwards.
seek()method 
public function seek(time:Number):void

Seek to a playback time.

note that unless you're using a flash media server, it will only seek to the nearest key frame (i-frame) (see video docs in flash help for more info).

Parameters
time:Number — The time in seconds to seek to.
seekToAndStop()method 
public function seekToAndStop(position:Number = 0):void

Stop the flv, and seeks to the specified position.

Parameters
position:Number (default = 0) — The seek position.
seekToPercent()method 
public function seekToPercent(percent:Number):void

Seek to a playback percent.

Parameters
percent:Number — of playback to seek to.
seekToPixel()method 
public function seekToPixel(pixel:int):void

Seek to a width based off of the pixelsToFill property.

For example, if the pixels to fill was 300, you could seek anywhere between 0-300.

Parameters
pixel:int — The width to seek to.
stop()method 
public function stop():void

Stop the flv.

Event detail
bufferEmptyevent 
Event object type: gs.support.events.FLVEvent

Dispatched when the buffer is empty. The event manager can handle this event, as "BufferEmpty". When this is dispatched, you should pause the video, and wait for the buffer full event.

bufferFlushevent  
Event object type: gs.support.events.FLVEvent

Dispatched when the buffer was flushed. The event manager can handle this event, as "BufferFlush".

bufferFullevent  
Event object type: gs.support.events.FLVEvent

Dispatched when the buffer is full. The event manager can handle this event, as "BufferFull". When this is dispatched, you can begin playing the video again - call play or resume.

cuePointevent  
Event object type: gs.support.events.FLVEvent

Dispatched when a cue point is reached. The event manager can handle this event, as "CuePoint".

metaDataevent  
Event object type: gs.support.events.FLVEvent

Dispatched when meta data is received for the current flv. The event manager can handle this event, as "Meta".

progressevent  
Event object type: gs.support.events.FLVEvent

Dispatched for progress of the flv. The event manager can handle this event, as "Progress".

seekInvalidTimeevent  
Event object type: gs.support.events.FLVEvent

Dispatched when an invalid seek time was attempted. The event manager can handle this event, as "SeekInvalidTime".

seekNotifyevent  
Event object type: gs.support.events.FLVEvent

Dispatched when a seek occurs. The event manager can handle this event, as "SeekNotify".

startevent  
Event object type: gs.support.events.FLVEvent

Dispatched when the flv starts playing. The event manager can handle this event, as "Start".

stopevent  
Event object type: gs.support.events.FLVEvent

Dispatched when the flv stops playing. The event manager can handle this event, as "Stop".

streamNotFoundevent  
Event object type: gs.support.events.FLVEvent

Dispatched when a stream was not found. The event manager can handle this event, as "StreamNotFound".