Name

mediastream

Synopsis

LZX: mediastream
JavaScript: lz.mediastream
Type: Class
Access: public
Topic: Extensions.Audio-Video
Declared in: lps/components/extensions/av/mediastream.lzx

Superclass Chain

node (LzNode) » mediastream

Known Subclasses

Details

Properties (28)

autoplay
<attribute name="autoplay" value="false" />
public var autoplay;
If true, video will start playing as soon as url is set. Default: false.
autoplayLength
<attribute name="autoplayLength" value="'end'" />
public var autoplayLength;
Autoplay length argument passed to mediastream.play(). See the mediastream.play documentation for its values. Default: 'end'.
autoplayPause
<attribute name="autoplayPause" value="false" />
public var autoplayPause;
Autoplay pause argument passed to mediastream.play(). See the mediastream.play documentation for its values. Default: false.
autoplayReset
<attribute name="autoplayReset" value="true" />
public var autoplayReset;
Autoplay reset argument passed to mediastream.play(). See the mediastream.play documentation for its values. Default: true.
autoplayStart
<attribute name="autoplayStart" value="'either'" />
public var autoplayStart;
Autoplay start argument passed to mediastream.play(). See the mediastream.play documentation for its values. Default: 'either'.
_basetime
<attribute name="_basetime" type="number" value="0" />
private var _basetime : Number;
The base time when we started recording.
broadcasting
<attribute name="broadcasting" value="${(this.mode == 'broadcasting') || (this.mode == 'recording')}" />
public read-only var broadcasting;
True if broadcasting right now.
cam
<attribute name="cam" value="null" />
public var cam;
A reference to the camera. This must be set if broadcasting. This is set automatically if the stream is a child of a videoview.
debug
<attribute name="debug" value="false" />
public var debug;
When true, print extra info to the debugger.
_flashstream
<attribute name="_flashstream" value="null" />
private var _flashstream;
A reference to the Flash NetStream object.
fps
<attribute name="fps" type="number" value="0" />
public var fps : Number;
The current frames per second for playing video .
mic
<attribute name="mic" value="null" />
public var mic;
A reference to the microphone. This must be set if broadcasting. This is set automatically if the stream is a child of a videoview.
mode
<attribute name="mode" type="string" value="" />
public read-only var mode : String;
Mode: "" if doing nothing, "playing" if playing, "broadcasting" if can be received, "recording" if recording. Recording also implies can be received, i.e., broadcasting. Pausing does not affect the mode, unlike stopping.
muteaudio
<attribute name="muteaudio" value="false" />
public var muteaudio;
True iff audio is muted.
mutevideo
<attribute name="mutevideo" value="false" />
public var mutevideo;
True iff video is muted.
_nc
<attribute name="_nc" value="null" />
private var _nc;
A reference to the Flash NetConnection object.
paused
<attribute name="paused" value="false" />
public var paused;
True to pause playback. Named this way to pun with paused for animators.
_pendingstreamname
<attribute name="_pendingstreamname" type="string" value="" />
private var _pendingstreamname : String;
The pending stream name.
playing
<attribute name="playing" value="${(this.mode == 'playing') && (!this['paused'])}" />
public read-only var playing;
True if playing right now.
progress
<attribute name="progress" type="number" value="0" />
public var progress : Number;
Progress of mediastream currently downloading. (from 0 for none to 1 for all).
recording
<attribute name="recording" value="${this.mode == 'recording'}" />
public read-only var recording;
True if recording right now.
rtmp
<attribute name="rtmp" value="null" />
public var rtmp;
The rtmp to use (defaults to the first one created).
streamname
<attribute name="streamname" type="string" value="" />
public var streamname : String;
The rtmp streamname (without .flv suffix).
time
<attribute name="time" type="number" value="0" />
public var time : Number;
Current time of mediastream currently playing or recording (in seconds).
_timedel
<attribute name="_timedel" value="null" />
private var _timedel;
A delegate to update the time, progress and fps attributes.
totaltime
<attribute name="totaltime" type="number" value="0" />
public var totaltime : Number;
Total length (in seconds) of mediastream currently playing.
type
<attribute name="type" type="string" value="http" />
public var type : String;
Protocol "rtmp" or "http" (default: "http").
url
<attribute name="url" type="string" value="" />
public var url : String;
The url of the mediastream, maybe be relative URL, for example: http://localhost/myvideo.flv, or simply myvideo.flv when type="rtmp" the url is always relative to the rtmpconnection.

Methods (32)

_activateTimeDel()
<method name="_activateTimeDel" />
private function _activateTimeDel();
Activate the idle _updateTime handler.
broadcast()
<method name="broadcast" />
public function broadcast();
start sending a live mediastream to the server.
close()
<method name="close" />
public function close();
Close the stream.
_createStream()
<method name="_createStream" />
private function _createStream();
Create Flash NetStream object.
_deactivateTimeDel()
<method name="_deactivateTimeDel" />
private function _deactivateTimeDel();
Deactivate the idle _updateTime handler.
_findnc()
<method name="_findnc" />
private function _findnc();
Find or create the Flash NetConnection object.
_flushnc()
<method name="_flushnc" />
private function _flushnc();
Delete the Flash NetConnection object.
_handleAutoplay()
<method name="_handleAutoplay" />
private function _handleAutoplay();
Trigger autoplay if requested. Called by videoview.init.
init()
<method name="init" />
private function init();
Initialize the mediastream.
_namefromurl()
<method name="_namefromurl" args="fromurl" />
private function _namefromurl(fromurl);
If the type is rtmp, then return the url without the .flv suffix, if there was one.
_onCuePoint()
<method name="_onCuePoint" args="info" />
private function _onCuePoint(info);
Handle the onCuePoint callback from the Flash NetStream object.
_onInsufficientBandwidth()
<method name="_onInsufficientBandwidth" />
private function _onInsufficientBandwidth();
This is called when a media stream hits the end and stops playing.
_onMetaData()
<method name="_onMetaData" args="info" />
private function _onMetaData(info);
Handle the onMetaData callback from the Flash NetStream object. Pick out the "duration" property and set our totaltime from it. Then forward the metadata on as a parameter to the onmetadata event.
_onPlayStatus()
<method name="_onPlayStatus" args="info" />
private function _onPlayStatus(info);
Handle the onPlayStatus callback from the Flash NetStream object.
_onStart()
<method name="_onStart" />
private function _onStart();
This is called when a media stream starts playing or recording.
_onStatus()
<method name="_onStatus" args="info" />
private function _onStatus(info);
Handle the onStatus callback from the Flash NetStream object.
_onStop()
<method name="_onStop" />
private function _onStop();
This is called when a media stream stops playing or recording.
pause()
<method name="pause" args="p" />
public function pause(p);
Works for playback and mimics animator pause() semantics.
play()
<method name="play" args="start, pause, length, reset" />
public function play(start, pause, length, reset);
Play the mediastream at this.url. Start is a number or string that specifies the start time and behavior, one of the following values: non-negative number: start playing the given number of seconds into a recorded stream; 'recorded': play a recorded stream from the beginning; 'live': play a live stream; 'either': play either a live or recorded stream from the beginning; default: 'either'. Pause is a flag that pauses the video if true; default: false. Length is the duration in the playback in seconds or a string, 0 to play a single frame, or "end" to play until the end; default: 'end'. Reset is a flag or string to control how the play list is reset; false: queue at the end of the current playlist; true: reset playlist and play immediately; 'queueWithImmediateMessages': queue and deliver all messages at once, 'ResetWithImmediateMessages': reset playist and deliver all messages at once; default: true.
_publishSetup()
<method name="_publishSetup" />
private function _publishSetup();
Set up to publish a mediastream.
record()
<method name="record" />
public function record();
Start recording.
seek()
<method name="seek" args="t" />
public function seek(t);
Seek the video to the given time t, in seconds.
_setCam()
<method name="_setCam" args="cam" />
private function _setCam(cam);
Called by the videoview or camera to tell the stream about the camera.
_setMic()
<method name="_setMic" args="mic" />
private function _setMic(mic);
Called by the videoview or microphone to tell the stream about the microphone.
_setMuteaudio()
<method name="_setMuteaudio" args="muteaudio" />
private function _setMuteaudio(muteaudio);
Setter for the "muteaudio" attribute.
_setMutevideo()
<method name="_setMutevideo" args="mutevideo" />
private function _setMutevideo(mutevideo);
Setter for the "mutevideo" attribute.
_setPaused()
<method name="_setPaused" args="paused" />
private function _setPaused(paused);
Pause the video if true. This does nothing when you record.
_setType()
<method name="_setType" args="newtype" />
private function _setType(newtype);
Setter for the "type" attribute.
_setUrl()
<method name="_setUrl" args="newurl" />
private function _setUrl(newurl);
Setter for the "url" attribute.
stop()
<method name="stop" />
public function stop();
Stop the stream. Whereas pause will keep the 'mode' as playing, stop will set mode to "" and is heavier-weight operation.
_updateTime()
<method name="_updateTime" />
private function _updateTime();
Update the time, progress and fps attributes.
_updateUrl()
<method name="_updateUrl" />
private function _updateUrl();
Do whatever necessary setup for a new url, based on the value of this.url.

Events (7)

oncuepoint
<attribute name="oncuepoint" />
public event oncuepoint;
Event sent when a cue point occurs, whose parameter is a dictionary of metadata.
oninsufficientbandwidth
<attribute name="oninsufficientbandwidth" />
public event oninsufficientbandwidth;
Event sent when insufficient bandwidth.
onmetadata
<attribute name="onmetadata" />
public event onmetadata;
Event sent when metadata is received, whose parameter is a dictionary of metadata.
onstart
<attribute name="onstart" />
public event onstart;
Event sent when playing or recording starts.
onstop
<attribute name="onstop" />
public event onstop;
Event sent when playing or recording stops.
ontype
<attribute name="ontype" />
private event ontype;
Event sent when type changes.
onurl
<attribute name="onurl" />
private event onurl;
Event sent when url changes.

LZX Synopsis

<class name="lz.mediastream" extends=" LzNode ">
  <attribute name=" autoplay " value="false" />
  <attribute name=" autoplayLength " value="'end'" />
  <attribute name=" autoplayPause " value="false" />
  <attribute name=" autoplayReset " value="true" />
  <attribute name=" autoplayStart " value="'either'" />
  <attribute name=" _basetime " type="number" value="0" />
  <attribute name=" broadcasting " value="${(this.mode == 'broadcasting') || (this.mode == 'recording')}" />
  <attribute name=" cam " value="null" />
  <attribute name=" debug " value="false" />
  <attribute name=" _flashstream " value="null" />
  <attribute name=" fps " type="number" value="0" />
  <attribute name=" mic " value="null" />
  <attribute name=" mode " type="string" value="" />
  <attribute name=" muteaudio " value="false" />
  <attribute name=" mutevideo " value="false" />
  <attribute name=" _nc " value="null" />
  <attribute name=" paused " value="false" />
  <attribute name=" _pendingstreamname " type="string" value="" />
  <attribute name=" playing " value="${(this.mode == 'playing') && (!this['paused'])}" />
  <attribute name=" progress " type="number" value="0" />
  <attribute name=" recording " value="${this.mode == 'recording'}" />
  <attribute name=" rtmp " value="null" />
  <attribute name=" streamname " type="string" value="" />
  <attribute name=" time " type="number" value="0" />
  <attribute name=" _timedel " value="null" />
  <attribute name=" totaltime " type="number" value="0" />
  <attribute name=" type " type="string" value="http" />
  <attribute name=" url " type="string" value="" />
  <method name=" _activateTimeDel " />
  <method name=" broadcast " />
  <method name=" close " />
  <method name=" _createStream " />
  <method name=" _deactivateTimeDel " />
  <method name=" _findnc " />
  <method name=" _flushnc " />
  <method name=" _handleAutoplay " />
  <method name=" init " />
  <method name=" _namefromurl " args="fromurl" />
  <event name=" oncuepoint " />
  <method name=" _onCuePoint " args="info" />
  <event name=" oninsufficientbandwidth " />
  <method name=" _onInsufficientBandwidth " />
  <event name=" onmetadata " />
  <method name=" _onMetaData " args="info" />
  <method name=" _onPlayStatus " args="info" />
  <event name=" onstart " />
  <method name=" _onStart " />
  <method name=" _onStatus " args="info" />
  <event name=" onstop " />
  <method name=" _onStop " />
  <event name=" ontype " />
  <event name=" onurl " />
  <method name=" pause " args="p" />
  <method name=" play " args="start, pause, length, reset" />
  <method name=" _publishSetup " />
  <method name=" record " />
  <method name=" seek " args="t" />
  <method name=" _setCam " args="cam" />
  <method name=" _setMic " args="mic" />
  <method name=" _setMuteaudio " args="muteaudio" />
  <method name=" _setMutevideo " args="mutevideo" />
  <method name=" _setPaused " args="paused" />
  <method name=" _setType " args="newtype" />
  <method name=" _setUrl " args="newurl" />
  <method name=" stop " />
  <method name=" _updateTime " />
  <method name=" _updateUrl " />
</class>

JavaScript Synopsis

public lz.mediastream extends  LzNode  {
  public var autoplay ;
  public var autoplayLength ;
  public var autoplayPause ;
  public var autoplayReset ;
  public var autoplayStart ;
  private var _basetime  : Number;
  public read-only var broadcasting ;
  public var cam ;
  public var debug ;
  private var _flashstream ;
  public var fps  : Number;
  public var mic ;
  public read-only var mode  : String;
  public var muteaudio ;
  public var mutevideo ;
  private var _nc ;
  public var paused ;
  private var _pendingstreamname  : String;
  public read-only var playing ;
  public var progress  : Number;
  public read-only var recording ;
  public var rtmp ;
  public var streamname  : String;
  public var time  : Number;
  private var _timedel ;
  public var totaltime  : Number;
  public var type  : String;
  public var url  : String;
  prototype private function _activateTimeDel ();
  prototype public function broadcast ();
  prototype public function close ();
  prototype private function _createStream ();
  prototype private function _deactivateTimeDel ();
  prototype private function _findnc ();
  prototype private function _flushnc ();
  prototype private function _handleAutoplay ();
  prototype private function init ();
  prototype private function _namefromurl (fromurl);
  prototype public event oncuepoint ;
  prototype private function _onCuePoint (info);
  prototype public event oninsufficientbandwidth ;
  prototype private function _onInsufficientBandwidth ();
  prototype public event onmetadata ;
  prototype private function _onMetaData (info);
  prototype private function _onPlayStatus (info);
  prototype public event onstart ;
  prototype private function _onStart ();
  prototype private function _onStatus (info);
  prototype public event onstop ;
  prototype private function _onStop ();
  prototype private event ontype ;
  prototype private event onurl ;
  prototype public function pause (p);
  prototype public function play (start, pause, length, reset);
  prototype private function _publishSetup ();
  prototype public function record ();
  prototype public function seek (t);
  prototype private function _setCam (cam);
  prototype private function _setMic (mic);
  prototype private function _setMuteaudio (muteaudio);
  prototype private function _setMutevideo (mutevideo);
  prototype private function _setPaused (paused);
  prototype private function _setType (newtype);
  prototype private function _setUrl (newurl);
  prototype public function stop ();
  prototype private function _updateTime ();
  prototype private function _updateUrl ();
}