Packageorg.flowplayer.controller
Classpublic class NetStreamControllingStreamProvider
ImplementsStreamProvider

A StreamProvider that does it's job using the Flash's NetStream class. Implements standard HTTP based progressive download.



Public Properties
 PropertyDefined by
  allowRandomSeek : Boolean
[read-only] Does this provider support random seeking to unbuffered areas in the timeline?
NetStreamControllingStreamProvider
  bufferEnd : Number
[read-only] The point in timeline where the buffered data region ends, in seconds.
NetStreamControllingStreamProvider
  bufferStart : Number
[read-only] The point in timeline where the buffered data region begins, in seconds.
NetStreamControllingStreamProvider
  fileSize : Number
[read-only] File size in bytes.
NetStreamControllingStreamProvider
  model : ProviderModel
Gets the provider model.
NetStreamControllingStreamProvider
  netConnection : NetConnection
[read-only] Gets the underlying netConnection object.
NetStreamControllingStreamProvider
  netStream : NetStream
[read-only] Gets the underlying NetStream object.
NetStreamControllingStreamProvider
  player : Flowplayer
[write-only] Sets the player instance.
NetStreamControllingStreamProvider
  playlist : Playlist
NetStreamControllingStreamProvider
  seekTarget : Number
[read-only] Previous seek target value in seconds.
NetStreamControllingStreamProvider
  stopping : Boolean
[read-only] Is this provider in the process of stopping the stream? When stopped the provider should not dispatch any events resulting from events that might get triggered by the underlying streaming implementation.
NetStreamControllingStreamProvider
  streamCallbacks : Dictionary
[read-only] Get the current stream callbacks.
NetStreamControllingStreamProvider
  time : Number
[read-only] Current playhead time in seconds.
NetStreamControllingStreamProvider
  timeProvider : TimeProvider
[write-only]
NetStreamControllingStreamProvider
  type : String
[read-only]
NetStreamControllingStreamProvider
  volumeController : VolumeController
[write-only] Volume controller used to control the video volume.
NetStreamControllingStreamProvider
Protected Properties
 PropertyDefined by
  clip : Clip
[read-only] The current clip in the playlist.
NetStreamControllingStreamProvider
  log : Log
NetStreamControllingStreamProvider
  pauseAfterStart : Boolean
Should we pause on first frame after starting.
NetStreamControllingStreamProvider
  paused : Boolean
[read-only] Are we paused?
NetStreamControllingStreamProvider
  seeking : Boolean
Is the seek in process?
NetStreamControllingStreamProvider
  silentSeek : Boolean
NetStreamControllingStreamProvider
  started : Boolean
[read-only] Have we already received a NetStream.Play.Start from the NetStream
NetStreamControllingStreamProvider
Public Methods
 MethodDefined by
  
NetStreamControllingStreamProvider
  
addConnectionCallback(name:String, listener:Function):void
Adds a callback function to the NetConnection instance.
NetStreamControllingStreamProvider
  
addStreamCallback(name:String, listener:Function):void
Adds a callback function to the NetStream object.
NetStreamControllingStreamProvider
  
attachStream(video:DisplayObject):void
Attaches a stream to the specified display object.
NetStreamControllingStreamProvider
  
getVideo(clip:Clip):DisplayObject
Gets the Video object.
NetStreamControllingStreamProvider
  
load(event:ClipEvent, clip:Clip, pauseAfterStart:Boolean = false):void
Starts loading the specivied clip.
NetStreamControllingStreamProvider
  
onConfig(model:PluginModel):void
Override this to receive the plugin model.
NetStreamControllingStreamProvider
  
onLoad(player:Flowplayer):void
Override this to receive the player instance.
NetStreamControllingStreamProvider
  
pause(event:ClipEvent):void
Pauses playback.
NetStreamControllingStreamProvider
  
resume(event:ClipEvent):void
Resumes playback.
NetStreamControllingStreamProvider
  
seek(event:ClipEvent, seconds:Number):void
Seeks to the specified point in the timeline.
NetStreamControllingStreamProvider
  
stop(event:ClipEvent, closeStreamAndConnection:Boolean = false):void
Stops and rewinds to the beginning of current clip.
NetStreamControllingStreamProvider
  
Stops loading data into the buffer.
NetStreamControllingStreamProvider
  
switchStream(event:ClipEvent, clip:Clip, netStreamPlayOptions:Object = null):void
NetStreamControllingStreamProvider
Protected Methods
 MethodDefined by
  
canDispatchBegin():Boolean
Can we dispatch the start event now? This class uses this method every time before it's about to dispatch the start event.
NetStreamControllingStreamProvider
  
Can we disppatch the onStreamNotFound ERROR event now?
NetStreamControllingStreamProvider
  
connect(clip:Clip, ... rest):void
Connects to the backend.
NetStreamControllingStreamProvider
  
createNetStream(connection:NetConnection):NetStream
NetStreamControllingStreamProvider
  
Have we started streaming the playlist's current clip?
NetStreamControllingStreamProvider
  
Dispatches the specified event.
NetStreamControllingStreamProvider
  
doLoad(event:ClipEvent, netStream:NetStream, clip:Clip):void
Starts loading using the specified netStream and clip.
NetStreamControllingStreamProvider
  
doPause(netStream:NetStream, event:ClipEvent = null):void
Pauses the specified netStream.
NetStreamControllingStreamProvider
  
doResume(netStream:NetStream, event:ClipEvent):void
Resumes the specified netStream.
NetStreamControllingStreamProvider
  
doSeek(event:ClipEvent, netStream:NetStream, seconds:Number):void
Seeks the netStream to the specified target.
NetStreamControllingStreamProvider
  
doStop(event:ClipEvent, netStream:NetStream, closeStreamAndConnection:Boolean = false):void
NetStreamControllingStreamProvider
  
doSwitchStream(event:ClipEvent, netStream:NetStream, clip:Clip, netStreamPlayOptions:Object = null):void
NetStreamControllingStreamProvider
  
getClipUrl(clip:Clip):String
Gets the clip URL from the specified clip.
NetStreamControllingStreamProvider
  
Gets the connection provider for the specified clip.
NetStreamControllingStreamProvider
  
getCurrentPlayheadTime(netStream:NetStream):Number
Gets the current playhead time.
NetStreamControllingStreamProvider
  
Gets the default clip url resolver to be used if the ProviderModel supplied to this provider does not specify a connection provider.
NetStreamControllingStreamProvider
  
Is the playback duration of current clip reached?
NetStreamControllingStreamProvider
  
netStreamPlay(url:String):void
Calls netStream.play(url)
NetStreamControllingStreamProvider
  
NetStreamControllingStreamProvider
  
onMetaData(event:ClipEvent):void
NetStreamControllingStreamProvider
  
onNetStatus(event:NetStatusEvent):void
Called when NetStatusEvents are received.
NetStreamControllingStreamProvider
  
resolveClipUrl(clip:Clip, successListener:Function):void
Resolves the url for the specified clip.
NetStreamControllingStreamProvider
Property detail
allowRandomSeekproperty
allowRandomSeek:Boolean  [read-only]

Does this provider support random seeking to unbuffered areas in the timeline?

Implementation
    public function get allowRandomSeek():Boolean
bufferEndproperty 
bufferEnd:Number  [read-only]

The point in timeline where the buffered data region ends, in seconds.

Implementation
    public function get bufferEnd():Number
bufferStartproperty 
bufferStart:Number  [read-only]

The point in timeline where the buffered data region begins, in seconds.

Implementation
    public function get bufferStart():Number
clipproperty 
clip:Clip  [read-only]

The current clip in the playlist.

Implementation
    protected function get clip():Clip
fileSizeproperty 
fileSize:Number  [read-only]

File size in bytes.

Implementation
    public function get fileSize():Number
logproperty 
protected var log:Log
modelproperty 
model:ProviderModel  [read-write]

Gets the provider model.

Implementation
    public function get model():ProviderModel
    public function set model(value:ProviderModel):void
netConnectionproperty 
netConnection:NetConnection  [read-only]

Gets the underlying netConnection object.

Implementation
    public function get netConnection():NetConnection
netStreamproperty 
netStream:NetStream  [read-only]

Gets the underlying NetStream object.

Implementation
    public function get netStream():NetStream
pauseAfterStartproperty 
pauseAfterStart:Boolean  [read-write]

Should we pause on first frame after starting.

Implementation
    protected function get pauseAfterStart():Boolean
    protected function set pauseAfterStart(value:Boolean):void

See also

pausedproperty 
paused:Boolean  [read-only]

Are we paused?

Implementation
    protected function get paused():Boolean
playerproperty 
player:Flowplayer  [write-only]

Sets the player instance.

Implementation
    public function set player(value:Flowplayer):void
playlistproperty 
playlist:Playlist  [read-write]

Implementation
    public function get playlist():Playlist
    public function set playlist(value:Playlist):void
seekingproperty 
seeking:Boolean  [read-write]

Is the seek in process?

Implementation
    protected function get seeking():Boolean
    protected function set seeking(value:Boolean):void
seekTargetproperty 
seekTarget:Number  [read-only]

Previous seek target value in seconds.

Implementation
    public function get seekTarget():Number
silentSeekproperty 
silentSeek:Boolean  [read-write]Implementation
    protected function get silentSeek():Boolean
    protected function set silentSeek(value:Boolean):void
startedproperty 
started:Boolean  [read-only]

Have we already received a NetStream.Play.Start from the NetStream

Implementation
    protected function get started():Boolean
stoppingproperty 
stopping:Boolean  [read-only]

Is this provider in the process of stopping the stream? When stopped the provider should not dispatch any events resulting from events that might get triggered by the underlying streaming implementation.

Implementation
    public function get stopping():Boolean
streamCallbacksproperty 
streamCallbacks:Dictionary  [read-only]

Get the current stream callbacks.

Implementation
    public function get streamCallbacks():Dictionary
timeproperty 
time:Number  [read-only]

Current playhead time in seconds.

Implementation
    public function get time():Number
timeProviderproperty 
timeProvider:TimeProvider  [write-only]Implementation
    public function set timeProvider(value:TimeProvider):void
typeproperty 
type:String  [read-only]Implementation
    public function get type():String
volumeControllerproperty 
volumeController:VolumeController  [write-only]

Volume controller used to control the video volume.

Implementation
    public function set volumeController(value:VolumeController):void
Constructor detail
NetStreamControllingStreamProvider()constructor
public function NetStreamControllingStreamProvider()
Method detail
addConnectionCallback()method
public function addConnectionCallback(name:String, listener:Function):void

Adds a callback function to the NetConnection instance. This function will fire ClipEvents whenever the callback is invoked in the connection.

Parameters
name:String
 
listener:Function
addStreamCallback()method 
public function addStreamCallback(name:String, listener:Function):void

Adds a callback function to the NetStream object. This function will fire a ClipEvent of type StreamEvent whenever the callback has been invoked on the stream. The invokations typically come from a server-side app running on RTMP server.

Parameters
name:String
 
listener:Function
attachStream()method 
public function attachStream(video:DisplayObject):void

Attaches a stream to the specified display object.

Parameters
video:DisplayObject — the video object that was originally retrieved using getVideo().
canDispatchBegin()method 
protected function canDispatchBegin():Boolean

Can we dispatch the start event now? This class uses this method every time before it's about to dispatch the start event. The event is only dispatched if this method returns true.

Returns
Booleantrue if the start event can be dispatched

See also

ClipEventType.BEGIN
canDispatchStreamNotFound()method 
protected function canDispatchStreamNotFound():Boolean

Can we disppatch the onStreamNotFound ERROR event now?

Returns
Booleantrue if the start event can be dispatched

See also

ClipEventType.ERROR
connect()method 
protected function connect(clip:Clip, ... rest):void

Connects to the backend. The implementation creates a new NetConnection then calls addConnectionStatusListener(connection) and NetConnection.connect(getConnectUrl(clip)).

Parameters
clip:Clip
 
... rest

See also

createNetStream()method 
protected function createNetStream(connection:NetConnection):NetStreamParameters
connection:NetConnection

Returns
NetStream
currentClipStarted()method 
protected function currentClipStarted():Boolean

Have we started streaming the playlist's current clip?

Returns
Boolean
dispatchEvent()method 
protected final function dispatchEvent(event:ClipEvent):void

Dispatches the specified event.

Parameters
event:ClipEvent
doLoad()method 
protected function doLoad(event:ClipEvent, netStream:NetStream, clip:Clip):void

Starts loading using the specified netStream and clip. Can be overridden in subclasses.

Parameters
event:ClipEvent — the event that is dispatched after the loading has been successfully started
 
netStream:NetStream
 
clip:Clip
doPause()method 
protected function doPause(netStream:NetStream, event:ClipEvent = null):void

Pauses the specified netStream. This implementation calls netStream.pause() and dispatches the specified event.

Parameters
netStream:NetStream
 
event:ClipEvent (default = null) — the event that is dispatched after pausing, is null if we are pausing silently
doResume()method 
protected function doResume(netStream:NetStream, event:ClipEvent):void

Resumes the specified netStream. The implementation in this class calls netStream.resume() and dispatches the specified event.

Parameters
netStream:NetStream
 
event:ClipEvent — the event that is dispatched after resuming
doSeek()method 
protected function doSeek(event:ClipEvent, netStream:NetStream, seconds:Number):void

Seeks the netStream to the specified target. The implementation in this class calls netStream.seek(seconds). Override if you need something different.

Parameters
event:ClipEvent — the event that is dispatched after seeking successfully
 
netStream:NetStream
 
seconds:Number — the seek target position
doStop()method 
protected function doStop(event:ClipEvent, netStream:NetStream, closeStreamAndConnection:Boolean = false):voidParameters
event:ClipEvent
 
netStream:NetStream
 
closeStreamAndConnection:Boolean (default = false)
doSwitchStream()method 
protected function doSwitchStream(event:ClipEvent, netStream:NetStream, clip:Clip, netStreamPlayOptions:Object = null):voidParameters
event:ClipEvent
 
netStream:NetStream
 
clip:Clip
 
netStreamPlayOptions:Object (default = null)
getClipUrl()method 
protected function getClipUrl(clip:Clip):String

Gets the clip URL from the specified clip. The URL is supplied to NetStream.play(url). Can be overridden unsubclasses.

Parameters
clip:Clip

Returns
String
getConnectionProvider()method 
protected function getConnectionProvider(clip:Clip):ConnectionProvider

Gets the connection provider for the specified clip. Note: this function should return the same instance on repeated calls for the same clip.

Parameters
clip:Clip

Returns
ConnectionProvider
getCurrentPlayheadTime()method 
protected function getCurrentPlayheadTime(netStream:NetStream):Number

Gets the current playhead time. This should be overridden if the time is not equl to netStream.time

Parameters
netStream:NetStream

Returns
Number
getDefaultClipURLResolver()method 
protected function getDefaultClipURLResolver():ClipURLResolver

Gets the default clip url resolver to be used if the ProviderModel supplied to this provider does not specify a connection provider.

Returns
ClipURLResolver
getVideo()method 
public function getVideo(clip:Clip):DisplayObject

Gets the Video object. A stream will be attached to the returned video object using attachStream().

Parameters
clip:Clip — the clip for which the Video object is queried for

Returns
DisplayObject
isDurationReached()method 
protected function isDurationReached():Boolean

Is the playback duration of current clip reached?

Returns
Boolean
load()method 
public final function load(event:ClipEvent, clip:Clip, pauseAfterStart:Boolean = false):void

Starts loading the specivied clip. Once video data is available the provider must set it to the clip using clip.setContent(). Typically the video object passed to the clip is an instance of flash.media.Video.

Parameters
event:ClipEvent — the event that this provider should dispatch once loading has successfully started, once dispatched the player will call getVideo()
 
clip:Clip — the clip to load
 
pauseAfterStart:Boolean (default = false) — if true the playback is paused on first frame and buffering is continued
netStreamPlay()method 
protected function netStreamPlay(url:String):void

Calls netStream.play(url)

Parameters
url:String
onClipUrlResolved()method 
protected function onClipUrlResolved(clip:Clip):voidParameters
clip:Clip
onConfig()method 
public function onConfig(model:PluginModel):void

Override this to receive the plugin model.

Parameters
model:PluginModel
onLoad()method 
public function onLoad(player:Flowplayer):void

Override this to receive the player instance.

Parameters
player:Flowplayer
onMetaData()method 
protected function onMetaData(event:ClipEvent):voidParameters
event:ClipEvent
onNetStatus()method 
protected function onNetStatus(event:NetStatusEvent):void

Called when NetStatusEvents are received.

Parameters
event:NetStatusEvent
pause()method 
public final function pause(event:ClipEvent):void

Pauses playback.

Parameters
event:ClipEvent — the event that this provider should dispatch once loading has been successfully paused
resolveClipUrl()method 
protected final function resolveClipUrl(clip:Clip, successListener:Function):void

Resolves the url for the specified clip.

Parameters
clip:Clip
 
successListener:Function
resume()method 
public final function resume(event:ClipEvent):void

Resumes playback.

Parameters
event:ClipEvent — the event that this provider should dispatch once loading has been successfully resumed
seek()method 
public final function seek(event:ClipEvent, seconds:Number):void

Seeks to the specified point in the timeline.

Parameters
event:ClipEvent — the event that this provider should dispatch once the seek is in target
 
seconds:Number — the target point in the timeline

See also

stop()method 
public final function stop(event:ClipEvent, closeStreamAndConnection:Boolean = false):void

Stops and rewinds to the beginning of current clip.

Parameters
event:ClipEvent — the event that this provider should dispatch once loading has been successfully stopped
 
closeStreamAndConnection:Boolean (default = false)
stopBuffering()method 
public function stopBuffering():void

Stops loading data into the buffer.

switchStream()method 
public final function switchStream(event:ClipEvent, clip:Clip, netStreamPlayOptions:Object = null):voidParameters
event:ClipEvent
 
clip:Clip
 
netStreamPlayOptions:Object (default = null)