[Laszlo-checkins] r12760 - openlaszlo/branches/pagan-deities/lps/components/extensions/av
max@openlaszlo.org
max at openlaszlo.org
Thu Feb 5 16:13:18 PST 2009
Author: max
Date: 2009-02-05 16:13:15 -0800 (Thu, 05 Feb 2009)
New Revision: 12760
Modified:
openlaszlo/branches/pagan-deities/lps/components/extensions/av/mediastream.lzx
Log:
Change 20090204-maxcarlson-I by maxcarlson at Bank.local on 2009-02-04 22:51:36 PST
in /Users/maxcarlson/openlaszlo/pagan-deities
for http://svn.openlaszlo.org/openlaszlo/branches/pagan-deities
Summary: Fix pausing/playback for mediastreams
Bugs Fixed: LPP-7708 - The pause method in the mediastream class is not working fine, LPP-4785 - mediastream not working anymore for red5
Technical Reviewer: hminsky, sallen
QA Reviewer: bkumar at laszlosystems.com
Details: Avoid calling _setPaused() setter when paused is not changing in pause(). In play(), if we're currently paused unpause. Otherwise reset the stream so we can play again. Avoid setting the "mode" attribute twice in a row.Add comment about rtc._nc.call("getLength", this, name); being bogus, avoid using it. Set the property in _setPaused() to avoid null value warnings for the initial call.
Tests: See updated-mediastreamer-test.lzx testcase in LPP-7708. You may need to install an RTMP server and/or adjust the rtmpconnection src and zstream url attributes.
I used wowza media server for testing. You can install the Wowza server from http://www.wowzamedia.com/store.html and start it up.
Next, set up a streaming media server by following the instruction here: http://www.wowzamedia.com/quickstart.html#vod
Create the folder [install-dir]/applications/streamingvideo to serve as the application folder. This will enable you to connect to the server using the rtmp url rtmp://[server-ip-address]/streamingvideo. Next, copy your media files to [install-dir]/content.
Modified: openlaszlo/branches/pagan-deities/lps/components/extensions/av/mediastream.lzx
===================================================================
--- openlaszlo/branches/pagan-deities/lps/components/extensions/av/mediastream.lzx 2009-02-05 20:50:50 UTC (rev 12759)
+++ openlaszlo/branches/pagan-deities/lps/components/extensions/av/mediastream.lzx 2009-02-06 00:13:15 UTC (rev 12760)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2006-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2006-2009 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
@@ -227,7 +227,8 @@
<!--- Works for playback and mimics animator pause() semantics. -->
<method name="pause" args="p"><![CDATA[
//Debug.write("pause", this, "p", p, "p == null", p == null, "this['paused']", this['paused']);
- this.setAttribute("paused", (p == null) ? !this['paused'] : p)
+ var val = (p == null) ? !this['paused'] : p;
+ if (val != this.paused) this.setAttribute("paused", val)
]]>
</method>
@@ -709,15 +710,22 @@
}
if (this._flashstream) {
- this._flashstream.play(false);
- //this._flashstream.close();
+ if (this.paused) {
+ // unpause
+ this.setAttribute('paused', false);
+ return;
+ } else {
+ // clear, reset
+ this._flashstream.play(false);
+ this._flashstream.close();
+ this._flashstream = null;
+ }
}
// Start must be undefined for a live mediastream.
this._basetime = ((start == undefined) || (start < 0)) ? 0 : start;
this.setAttribute("time", 0);
this.setAttribute("progress", 0.0);
- this.setAttribute("mode", "playing");
var isnew = false;
if (!this._flashstream) {
@@ -736,6 +744,7 @@
//Debug.write("_flashstream=", this._flashstream);
/** TODO: when to do this?
+ //this breaks red5 and depends on Flash Media Server - see LPP-4785
// call function in server-side main.asc
var t = this; // Fake a closure.
@@ -908,6 +917,7 @@
This does nothing when you record.
@access private -->
<method name="_setPaused" args="paused"><![CDATA[
+ this['paused'] = paused;
//Debug.write("_setPaused", this, "paused", paused, "mode", this.mode, "progress", this.progress);
if ((this.mode != "playing") || !this._flashstream) {
if (paused) {
@@ -918,7 +928,6 @@
this._flashstream.pause(paused);
//this.setAttribute("paused", paused); // Oops: infinite loop!
- this['paused'] = paused;
if (this['onpaused']) {
this.onpaused.sendEvent(paused);
@@ -1058,12 +1067,15 @@
// rtmp server appends the .flv (so we need to remove it)
var sname = this._namefromurl(this.url);
// call function in server-side main.asc
+ /*
+ //this breaks red5 and depends on Flash Media Server - see LPP-4785
var t = this; // for use in closure
this.onResult = function(streamLength) {
//_root.Debug.write("onresult=", streamLength);
t.setAttribute("totaltime", streamLength || 0);
};
this._nc.call("getLength", this, sname);
+ */
}
]]>
More information about the Laszlo-checkins
mailing list