Name

mediastream

Synopsis

LZX: mediastream
JavaScript: 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 (23)

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'.
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.
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.
paused
<attribute name="paused" value="false" />
public var paused;
True to pause playback. Named this way to pun with paused for animators.
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).
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 (7)

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.
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.
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.
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.

Events (5)

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.

LZX Synopsis

<class name="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=" broadcasting " value="${(this.mode == 'broadcasting') || (this.mode == 'recording')}" />
  <attribute name=" cam " value="null" />
  <attribute name=" debug " value="false" />
  <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=" paused " value="false" />
  <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=" totaltime " type="number" value="0" />
  <attribute name=" type " type="string" value="http" />
  <attribute name=" url " type="string" value="" />
  <method name=" broadcast " />
  <method name=" close " />
  <event name=" oncuepoint " />
  <event name=" oninsufficientbandwidth " />
  <event name=" onmetadata " />
  <event name=" onstart " />
  <event name=" onstop " />
  <method name=" pause " args="p" />
  <method name=" play " args="start, pause, length, reset" />
  <method name=" record " />
  <method name=" seek " args="t" />
  <method name=" stop " />
</class>

JavaScript Synopsis

public mediastream extends  LzNode  {
  public var autoplay ;
  public var autoplayLength ;
  public var autoplayPause ;
  public var autoplayReset ;
  public var autoplayStart ;
  public read-only var broadcasting ;
  public var cam ;
  public var debug ;
  public var fps  : Number;
  public var mic ;
  public read-only var mode  : String;
  public var muteaudio ;
  public var mutevideo ;
  public var paused ;
  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;
  public var totaltime  : Number;
  public var type  : String;
  public var url  : String;
  prototype public function broadcast ();
  prototype public function close ();
  prototype public event oncuepoint ;
  prototype public event oninsufficientbandwidth ;
  prototype public event onmetadata ;
  prototype public event onstart ;
  prototype public event onstop ;
  prototype public function pause (p);
  prototype public function play (start, pause, length, reset);
  prototype public function record ();
  prototype public function seek (t);
  prototype public function stop ();
}