[Laszlo-checkins] r13618 - in openlaszlo/trunk: lps/components/av lps/components/extensions/av test/video

sallen@openlaszlo.org sallen at openlaszlo.org
Mon Apr 6 12:20:35 PDT 2009


Author: sallen
Date: 2009-04-06 12:20:33 -0700 (Mon, 06 Apr 2009)
New Revision: 13618

Modified:
   openlaszlo/trunk/lps/components/av/videoplayer.lzx
   openlaszlo/trunk/lps/components/extensions/av/mediastream.lzx
   openlaszlo/trunk/test/video/test-stream-video-rtmp-sep.lzx
   openlaszlo/trunk/test/video/test-stream-video-sep.lzx
Log:
Change 20090406-sallen-V by sallen at sallen-mac.local on 2009-04-06 12:16:52 PDT
    in /Users/sarah/src/svn/openlaszlo/trunk-review
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: make it so you can set the 'url' of a mediastream more than once 

New Features: n/a

Bugs Fixed:
LPP-2522  Video: setUrl only works once

Technical Reviewer: max
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation: 
* setting mediastream 'url' attribue now works as expected
* videoplayer: small improvement to reference, and fixed typo

Release Notes:

Details: when you change the URL, I think it should show the first frame of the video if showFrame is set, but this points to the starttime API being in the wrong place.  So, I fixed this bug and opened a separate JIRA issue about starttime: LPP-7994

Tests:
added set url tests to test-stream-video-sep.lzx and test-stream-video-rtmp-sep.lzx



Modified: openlaszlo/trunk/lps/components/av/videoplayer.lzx
===================================================================
--- openlaszlo/trunk/lps/components/av/videoplayer.lzx	2009-04-06 17:39:09 UTC (rev 13617)
+++ openlaszlo/trunk/lps/components/av/videoplayer.lzx	2009-04-06 19:20:33 UTC (rev 13618)
@@ -103,8 +103,9 @@
         <!--- color of the progress bar -->
         <attribute name="progressColor" value="0x00ff00"/>
  
-        <!--- starts playing audio/video from the giving URL,
-              which may be http or rtmp -->
+        <!--- starts playing audio/video from the given URL,
+              which may be http or rtmp.  If you want to 
+              play the current url, use this.stream.play() -->
         <method name="playVideo" args="url, type"><![CDATA[
             var ms = 
                 this.vscreen.ms;

Modified: openlaszlo/trunk/lps/components/extensions/av/mediastream.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/av/mediastream.lzx	2009-04-06 17:39:09 UTC (rev 13617)
+++ openlaszlo/trunk/lps/components/extensions/av/mediastream.lzx	2009-04-06 19:20:33 UTC (rev 13618)
@@ -300,7 +300,17 @@
      <!--- Event sent when mode is changed.
      -->
      <event name="onmode"/>
-   
+ 
+    <!--- reset the internal flash stream 
+         @keywords private -->
+    <method name="_resetStream">
+        if (this._flashstream != null) {
+            this._flashstream.play(false);
+            this._flashstream.close();
+            this._flashstream = null;
+        }
+    </method> 
+    
     <!--- play -->
     <method name="play" args="start='either', pause=false, 
                                    length='end', reset=true"> <![CDATA[
@@ -369,9 +379,7 @@
                 return;
             } else {
                 // clear, reset
-                this._flashstream.play(false);
-                this._flashstream.close();
-                this._flashstream = null;
+                this._resetStream();
             }
         }
 
@@ -419,7 +427,7 @@
         //Debug.write("pause=", pause);
         
         if (pause) {
-            Debug.write("mediastream play PAUSE",  this, "start", start, "pause", pause, "length", length, "reset", reset);
+            //Debug.write("mediastream play PAUSE",  this, "start", start, "pause", pause, "length", length, "reset", reset);
             //seems like overkill, but all of the following seemed to be
             //required
             this._flashstream.play(sname, start, length, reset);
@@ -500,7 +508,8 @@
             }
         }
         */
-    
+        if (!this._flashstream) return;
+
         var time = 0;
         var progress = 1.0;
         if ($as3) {
@@ -1287,7 +1296,6 @@
         this._updateUrl();
 
         if (this.url != "") { // changing the url
-            // TODO: if another URL is playing, maybe clear it?
             this._handleAutoplay();
         }
 
@@ -1301,6 +1309,9 @@
     <!--- @keywords private -->
     <method name="_updateUrl"> <![CDATA[
         // Debug.write("   _updateUrl", this, this.type, this.url, "isinited", this.isinited);
+        
+        this._resetStream();
+
         this._findnc();
 
         if ((this.type == "rtmp") &&

Modified: openlaszlo/trunk/test/video/test-stream-video-rtmp-sep.lzx
===================================================================
--- openlaszlo/trunk/test/video/test-stream-video-rtmp-sep.lzx	2009-04-06 17:39:09 UTC (rev 13617)
+++ openlaszlo/trunk/test/video/test-stream-video-rtmp-sep.lzx	2009-04-06 19:20:33 UTC (rev 13618)
@@ -9,12 +9,11 @@
         src="rtmp://localhost/test/instance1"
     />
 
-    <simplelayout/>
+<simplelayout axis="x" inset="5" spacing="10"/>
+
+<view layout="inset:10;spacing:2">
     <rtmpstatus/>
-    <text>You should see 'TEST CASE: onstart' and 'TEST CASE: onstop' events
-    in the debugger (not working LPP-7955)</text>
-    <text>s.playing should be true when video is in motion, 
-          false when you click pause or the video ends</text>
+
     <videoview id="v" debug="true" stream="${s}" />
 
     <mediastream id ="s" debug="true" 
@@ -42,5 +41,29 @@
     <text resize="true" text="${'totaltime: ' + s.totaltime}" />
     <text resize="true" text="${'s.playing = ' + s.playing}" />
 
+    <text width="350" multiline="true">
+    You should see 'TEST CASE: onstart' and 'TEST CASE: onstop' events
+    in the debugger (not working LPP-7955)<br/>
+    s.playing should be true when video is in motion, 
+    false when you click pause or the video ends</text>
+</view>
+
+<view layout="inset:10;spacing:5">
+<edittext id="t1" width="400">temp</edittext>
+<button text="set URL">
+    <handler name="onclick">
+        s.setAttribute('url',t1.text); 
+    </handler>
+</button>
+<edittext id="t2" width="400">good-dog</edittext>
+<button text="set URL">
+    <handler name="onclick">
+        s.setAttribute('url',t2.text); 
+    </handler>
+</button>
+</view>
+
+
+
 </canvas>
 

Modified: openlaszlo/trunk/test/video/test-stream-video-sep.lzx
===================================================================
--- openlaszlo/trunk/test/video/test-stream-video-sep.lzx	2009-04-06 17:39:09 UTC (rev 13617)
+++ openlaszlo/trunk/test/video/test-stream-video-sep.lzx	2009-04-06 19:20:33 UTC (rev 13618)
@@ -1,19 +1,19 @@
 <!-- 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 ************************************************** -->
 
 <canvas>
 
-    <simplelayout inset="10" spacing="5"/>
+<simplelayout axis="x" inset="10" spacing="10"/>
 
-    <constantlayout axis="x" value="10"/>
 
-    <videoview id="v" 
+<view layout="inset:10;spacing:5">
+    <videoview id="v" debug="true" 
         stream="$once{s}"
     />
 
-    <mediastream id="s" 
+    <mediastream id="s" debug="true"
         url="http:videos/good-dog.flv"
     />
 
@@ -37,12 +37,27 @@
         text="${'totaltime: ' + s.totaltime}"
     />
 
-    <text width="300" multiline="true">
+    <text width="300" multiline="true"> 
 Note: Total time is only defined for FLV's delivered over http
 if they have "metaData" defined, and we don't know the stream
-length until it starts playing.
+length until it starts playing.  
     </text>
+</view>
 
+<view layout="inset:10;spacing:5">
+<edittext id="t1" width="600">http://www.archive.org/download/JudgeMediaTestVideoFile_0/video.flv</edittext>
+<button text="set URL">
+    <handler name="onclick">
+        s.setAttribute('url',t1.text); 
+    </handler>
+</button>
+<edittext id="t2" width="600">http:videos/good-dog.flv</edittext>
+<button text="set URL">
+    <handler name="onclick">
+        s.setAttribute('url',t2.text); 
+    </handler>
+</button>
+</view>
 
 </canvas>
 



More information about the Laszlo-checkins mailing list