[Laszlo-checkins] r10768 - in openlaszlo/trunk/lps/components: av extensions/av
bargull@openlaszlo.org
bargull at openlaszlo.org
Mon Aug 25 11:32:52 PDT 2008
Author: bargull
Date: 2008-08-25 11:32:41 -0700 (Mon, 25 Aug 2008)
New Revision: 10768
Modified:
openlaszlo/trunk/lps/components/av/rtmpstatus.lzx
openlaszlo/trunk/lps/components/extensions/av/mediastream.lzx
openlaszlo/trunk/lps/components/extensions/av/rtmpconnection.lzx
Log:
Change 20080824-bargull-SCM by bargull at dell--p4--2-53 on 2008-08-24 13:33:20
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: make "lz.rtmpconnection._default" static
New Features:
Bugs Fixed: LPP-6848
Technical Reviewer: max
QA Reviewer: matthew
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Make "_default" a static field in "lz.rtmpconnection" instead of any prototype bashing. Update references to "_default" in "lz.mediastream" and "lz.rtmpstatus".
Tests:
Modified: openlaszlo/trunk/lps/components/av/rtmpstatus.lzx
===================================================================
--- openlaszlo/trunk/lps/components/av/rtmpstatus.lzx 2008-08-25 18:14:30 UTC (rev 10767)
+++ openlaszlo/trunk/lps/components/av/rtmpstatus.lzx 2008-08-25 18:32:41 UTC (rev 10768)
@@ -29,8 +29,13 @@
// This class should have an rtmp attribute to use a particular
// rtmpconnection, but default to the global one, and it should
// also clean up properly.
- if (!this.rtmpc)
- this.rtmpc = rtmpconnection.prototype._default;
+ if (! this.rtmpc) {
+ this.rtmpc = lz.rtmpconnection._default;
+ if (! this.rtmpc) {
+ if ($debug) Debug.warn("rtmpconnection not found for %w", this);
+ return;
+ }
+ }
this._updateStageDelegate =
new LzDelegate(this, "_updateStage", this.rtmpc, "onstage");
Modified: openlaszlo/trunk/lps/components/extensions/av/mediastream.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/av/mediastream.lzx 2008-08-25 18:14:30 UTC (rev 10767)
+++ openlaszlo/trunk/lps/components/extensions/av/mediastream.lzx 2008-08-25 18:32:41 UTC (rev 10768)
@@ -260,7 +260,7 @@
break;
default:
- Debug.warn("bogus mode: " + this.mode);
+ if ($debug) Debug.warn("bogus mode: " + this.mode);
break;
}
@@ -297,10 +297,7 @@
return;
}
- //Debug.write('_findnc', this.type);
-
switch (this.type) {
-
case "http": {
if (!this["_nullnc"]) {
// keep one of these around for any http mediastream
@@ -321,15 +318,15 @@
// If we don't define our own connection, then use
// the default one (the first rtmpconnection created).
- //Debug.write("_findnc type rtmp, rtmpconnection", this.rtmpconnection, "_nc", lz.rtmpconnection.prototype._default._nc);
+ //Debug.write("_findnc type rtmp, rtmpconnection", this.rtmpconnection, "_nc", lz.rtmpconnection._default._nc);
this._nc =
this.rtmp ||
- rtmpconnection._default._nc;
+ (lz.rtmpconnection._default && lz.rtmpconnection._default._nc);
break;
}
default: {
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.warn(
"unexpected protocol for url: %w %w",
this.url,
@@ -337,7 +334,6 @@
}
break;
}
-
}
]]>
@@ -365,7 +361,7 @@
//Debug.write("mediastream _createStream", this, "_nc", this._nc, "_flashstream", this._flashstream, "type", this.type, "url", this.url);
if (!this.url) {
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.warn(
"Can't create mediastream w/ no url: %w %w",
this,
@@ -375,7 +371,7 @@
}
if (this._flashstream) {
- Debug.warn("_flashstream already defined: %w", this._flashstream);
+ if ($debug) Debug.warn("_flashstream already defined: %w", this._flashstream);
return;
}
@@ -409,7 +405,7 @@
<!--- Handle the onStatus callback from the Flash NetStream object.
@keywords private -->
<method name="_onStatus" args="info"><![CDATA[
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.write("mediastream _onStatus", this, info.code, info);
}
@@ -502,7 +498,7 @@
}
default: {
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.warn("mediastream _onStatus not handled %w %w %w", this, info.code, info);
}
break;
@@ -560,7 +556,7 @@
<!--- Handle the onPlayStatus callback from the Flash NetStream object.
@keywords private -->
<method name="_onPlayStatus" args="info"><![CDATA[
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.write("mediastream onPlayStatus", this, info.code, info);
}
@@ -577,7 +573,7 @@
}
default: {
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.warn("mediastream _onPlayStatus not handled: %w %w %w", this, info.code, info);
}
break;
@@ -596,7 +592,7 @@
<method name="_onMetaData" args="info"><![CDATA[
var propName;
for (propName in info) {
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.write("MetaData: " + propName + " = " + info[propName]);
}
if (propName == "duration") {
@@ -657,7 +653,7 @@
break;
default:
if (start < 0) {
- Debug.warn("mediastream.play %w called with Flash-dependent start param: %w", this, start);
+ if ($debug) Debug.warn("mediastream.play %w called with Flash-dependent start param: %w", this, start);
}
break;
}
@@ -674,7 +670,7 @@
break;
default:
if (length < 0) {
- Debug.warn("mediastream.play %w called with Flash-dependent length param: %w", this, length);
+ if ($debug) Debug.warn("mediastream.play %w called with Flash-dependent length param: %w", this, length);
}
break;
}
@@ -698,13 +694,13 @@
reset = 3;
break;
default:
- Debug.warn("mediastream.play %w called with Flash-dependent length param: %w", length);
+ if ($debug) Debug.warn("mediastream.play %w called with Flash-dependent length param: %w", length);
break;
}
//Debug.write("PLAY", this, start, pause, length, reset);
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.write("mediastream play", this, "_flashstream", this._flashstream, "type", this.type, "url", this.url);
}
@@ -780,7 +776,7 @@
setAttribute("mode", "playing");
- if (this.debug) {
+ if ($debug && this.debug) {
//Debug.write("mediastream play", this, sname, typeof(sname), start);
}
@@ -911,7 +907,7 @@
//Debug.write("_setPaused", this, "paused", paused, "mode", this.mode, "progress", this.progress);
if ((this.mode != "playing") || !this._flashstream) {
if (paused) {
- Debug.warn("mediastream %w: trying to pause a stream that is not playing", this);
+ if ($debug) Debug.warn("mediastream %w: trying to pause a stream that is not playing", this);
}
return;
}
@@ -945,7 +941,7 @@
// TODO: Remember seek time for when we start?
// That might cause unexpected behavior.
// Just ignore and warn for now.
- Debug.warn("mediastream %w seek with no _flashstream: %w", this, t);
+ if ($debug) Debug.warn("mediastream %w seek with no _flashstream: %w", this, t);
}
]]>
</method>
Modified: openlaszlo/trunk/lps/components/extensions/av/rtmpconnection.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/av/rtmpconnection.lzx 2008-08-25 18:14:30 UTC (rev 10767)
+++ openlaszlo/trunk/lps/components/extensions/av/rtmpconnection.lzx 2008-08-25 18:32:41 UTC (rev 10768)
@@ -7,8 +7,9 @@
<library>
<class name="rtmpconnection" extends="node">
+ <!--- @keywords private -->
+ <attribute name="_default" value="null" allocation="class" />
-
<!--- Connect automatically during init. If false, you need to explicitly
call connect(). Default is true. -->
<attribute name="autoconnect" value="true" type="boolean" />
@@ -49,13 +50,11 @@
// If this is the first instance, define a default NetConnection
// for the class (used by other real-time objects, like videoview).
- if (this["_default"] == undefined) {
- rtmpconnection = new lz.node();
- rtmpconnection._default = this;
+ if (! lz.rtmpconnection._default) {
+ lz.rtmpconnection._default = this;
}
if (this.debug) {
-
this._nc.onStatus = function(info){
this.t._onStatus(info);
}
@@ -68,7 +67,6 @@
_root.Debug.write("---------------> id: ", id);
}
**/
-
}
/** the following code should work now, but it hasn't
@@ -100,11 +98,11 @@
if (this.debug) {
if (this.src == "") {
- Debug.write("no src url defined for", this);
+ if ($debug) Debug.write("no src url defined for", this);
return;
}
if (typeof(src) != "string") {
- Debug.write("src", this.src, "must be a string in", this);
+ if ($debug) Debug.write("src", this.src, "must be a string in", this);
return;
}
}
@@ -118,7 +116,7 @@
this.setAttribute("stage", 1);
if (!ok) {
- Debug.warn("connection failed bad url");
+ if ($debug) Debug.warn("connection failed bad url");
this.setAttribute("status", "disconnected");
this.setAttribute("stage", 0);
return;
@@ -140,7 +138,7 @@
<!--- Handle the onStatus callback from the Flash NetConnection object.
@keywords private -->
<method name="_onStatus" args="info"><![CDATA[
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.write("rtmpconnection", this, "_onStatus", info.code);
}
@@ -201,7 +199,7 @@
this.setAttribute("status", msg);
this.setAttribute("stage", s);
- if (this.debug) {
+ if ($debug && this.debug) {
if (s == 2) {
Debug.write("connected to " + this.src);
} else {
@@ -222,7 +220,7 @@
<!--- Make a remote call to the rtmp server.
TODO: We probably don't want to expose the Flash callback object. -->
<method name="call" args="func, obj, params"><![CDATA[
- if (this.debug) {
+ if ($debug && this.debug) {
Debug.write("call: func, obj, params", func, obj, params);
}
@@ -295,7 +293,7 @@
<!--- Call the remote method, passing the array of params. -->
<method name="call" args="params"><![CDATA[
if (this.funcname == null) {
- Debug.write("No funcname given");
+ if ($debug) Debug.write("No funcname given");
if (this.onerror) {
this.onerror.sendEvent("No funcname given");
}
@@ -322,8 +320,8 @@
}
}
- } else if (params.__proto__ != Array.prototype) {
- Debug.write(this.name, "error: first argument (params) is not an array");
+ } else if (! (params instanceof Array)) {
+ if ($debug) Debug.write(this.name, "error: first argument (params) is not an array");
return -1;
}
var rtmpObject = null;
@@ -331,7 +329,7 @@
rtmpObject = this.parent;
} else if(this.remotecontext instanceof lz.rtmpconnection){
rtmpObject = this.remotecontext;
- } else {
+ } else if ($debug) {
Debug.write("ERROR: no remotecontext availible abort call");
}
More information about the Laszlo-checkins
mailing list