|
|
|
[
Permlink
| « Hide
]
Max Carlson - 25/May/07 04:24 PM
This is a regression from 3.4
Updated testcase that shows all events firing:
<canvas title="loadperc test" proxied="false" width="100%" height="100%" debug="true"> <view name="audio"> <handler name="oninit"> setSource("http://www.addictech.com/album_mp3s/Skeetaz-Skeeters-Spacebar_Sentiments-SBS007-0001.mp3"); Debug.write("setSource called"); </handler> <handler name="onloadperc" args="l"> Debug.write("loadperc: ",l); </handler> <handler name="onframesloadratio" args="l"> Debug.write("framesloadratio: ",l); </handler> <handler name="onloadratio" args="l"> Debug.write("loadratio: ",l); </handler> <handler name="onload"> Debug.write("onload called"); </handler> </view> </canvas> Author: max
Date: 2007-06-06 21:59:15 -0700 (Wed, 06 Jun 2007) New Revision: 5344 Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs Log: Change 20070606-maxcarlson-b by maxcarlson@plastik on 2007-06-06 19:11:41 PDT in /Users/maxcarlson/openlaszlo/legals-clean for http://svn.openlaszlo.org/openlaszlo/branches/legals Summary: Fix loadperc, loadratio and framesloadratio events in swf New Features: Bugs Fixed: Technical Reviewer: promanik QA Reviewer: jcrowley Doc Reviewer: (pending) Documentation: Release Notes: Details: LzMediaLoader.lzs now fires events directly on the view. Ugly, but since only the swf runtime provides this data, it's also expedient. Tests: Test in Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs =================================================================== --- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs 2007-06-07 03:10:26 UTC (rev 5343) +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs 2007-06-07 04:59:15 UTC (rev 5344) @@ -15,7 +15,7 @@ function initialize( owner , args ) { super.initialize.apply(this, arguments); - this.owner.loadperc = 0; + this.owner.owner.loadperc = 0; this.loadChecker = new LzDelegate( this , "testLoad" ); @@ -194,8 +194,8 @@ if ( headers != null ) o.headers = headers; super.request( o ); - this.owner.setAttribute( "framesloadratio" , 0 ); - this.owner.setAttribute( "loadratio" , 0 ); + this.owner.owner.setAttribute( "framesloadratio" , 0 ); + this.owner.owner.setAttribute( "loadratio" , 0 ); } /** @@ -220,8 +220,8 @@ if ( this.checkonce ){ var lr = this.mc.lmc.getBytesLoaded() / this.mc.lmc.getBytesTotal(); - if (lr != this.owner["loadratio"] && !isNaN(lr)) { - this.owner.setAttribute("loadratio" , lr); + if (lr != this.owner.owner["loadratio"] && !isNaN(lr)) { + this.owner.owner.setAttribute("loadratio" , lr); //reset timeout for media which is streaming this.mc.loadtime = getTimer(); } @@ -241,7 +241,7 @@ var nlp = this.mc.lmc._framesloaded / this.mc.lmc._totalframes; - if ( nlp >= this.owner.loadperc ){ + if ( nlp >= this.owner.owner.loadperc ){ //reset timeout for media which is streaming //Debug.write( "here" , this.mc.lmc._framesloaded , //this.mc.lmc._totalframes ); @@ -250,15 +250,15 @@ var nlp = this.mc.lmc._framesloaded / this.mc.lmc._totalframes; - if ( nlp > this.owner.loadperc ){ + if ( nlp > this.owner.owner.loadperc ){ //reset timeout for media which is streaming this.mc.loadtime = getTimer(); } - this.owner.loadperc = nlp; - this.owner.onloadperc.sendEvent( this.owner.loadperc ); - this.owner.setAttribute( "framesloadratio" , nlp ); - this.owner.setAttribute( "loadratio" , nlp ); + this.owner.owner.loadperc = nlp; + this.owner.owner.onloadperc.sendEvent( this.owner.owner.loadperc ); + this.owner.owner.setAttribute( "framesloadratio" , nlp ); + this.owner.owner.setAttribute( "loadratio" , nlp ); if ( this.mc.lmc._totalframes == this.mc.lmc._framesloaded && this.mc.lmc._currentframe > 0){ if (!this.mc.loaded) this.onloaddone.sendEvent( this ); @@ -286,14 +286,14 @@ var nlp = this.mc.lmc._framesloaded / this.mc.lmc._totalframes; - if ( nlp > this.owner.loadperc ){ + if ( nlp > this.owner.owner.loadperc ){ //reset timeout for media which is streaming this.mc.loadtime = getTimer(); } - this.owner.loadperc = nlp; - this.owner.onloadperc.sendEvent( this.owner.loadperc ); - this.owner.setAttribute( "framesloadratio" , nlp ); + this.owner.owner.loadperc = nlp; + this.owner.owner.onloadperc.sendEvent( this.owner.owner.loadperc ); + this.owner.owner.setAttribute( "framesloadratio" , nlp ); } if ( this.mc.lmc.getBytesTotal() == this.mc.lmc.getBytesLoaded() ){ @@ -318,11 +318,11 @@ */ function unload ( loadobj ){ super.unload( loadobj ); - if ( this.owner.loadratio != 0 ){ - this.owner.loadperc = 0; - this.owner.onloadperc.sendEvent( 0 ); - this.owner.setAttribute( "loadratio" , 0 ); - this.owner.setAttribute( "framesloadratio" , 0 ); + if ( this.owner.owner.loadratio != 0 ){ + this.owner.owner.loadperc = 0; + this.owner.owner.onloadperc.sendEvent( 0 ); + this.owner.owner.setAttribute( "loadratio" , 0 ); + this.owner.owner.setAttribute( "framesloadratio" , 0 ); } this.removeLoadChecker(); _______________________________________________ Laszlo-checkins mailing list Laszlo-checkins@openlaszlo.org http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins (local legals build r5334)
Tested both examples: debug in swf: setSource called onload called debug in dhtml: setSource called DHTML doesn't have APIs to tell us percentage loaded, or to play MP3 audio. Therefore, the results are as expected for DHTML.
SWF should show something like this: framesloadratio: 0 loadratio: 0 setSource called loadratio: 0.0189915763885689 loadratio: 0.028389086339935 loadratio: 0.101578615098536 loadperc: 0.100227790432802 framesloadratio: 0.100227790432802 loadratio: 0.191393824239635 loadperc: 0.19059107358263 framesloadratio: 0.19059107358263 loadratio: 0.401565455808383 loadperc: 0.401149425287356 framesloadratio: 0.401149425287356 loadratio: 0.517222845638195 loadperc: 0.516949152542373 framesloadratio: 0.516949152542373 loadratio: 0.644807993741286 loadperc: 0.644722719141324 framesloadratio: 0.644722719141324 loadratio: 0.727394477206943 loadperc: 0.727243894703457 framesloadratio: 0.727243894703457 loadratio: 0.7675136548457 loadperc: 0.767357980162308 framesloadratio: 0.767357980162308 loadratio: 0.892749009027717 loadperc: 0.892506459948321 framesloadratio: 0.892506459948321 loadratio: 0.9305183927454 loadperc: 0.930342092216163 framesloadratio: 0.930342092216163 loadratio: 0.968287776463083 loadperc: 0.968080038113387 framesloadratio: 0.968080038113387 loadratio: 1 loadperc: 1 framesloadratio: 1 onload called (legals build r5349)
In swf, the following displays and music plays: framesloadratio: 0 loadratio: 0 setSource called loadratio: 0.00254690565122107 loadratio: 0.226813969280553 loadperc: 0.226069246435845 framesloadratio: 0.226069246435845 loadratio: 0.491200210548642 loadperc: 0.490840770314702 framesloadratio: 0.490840770314702 loadratio: 0.528969594266325 loadperc: 0.528565198430004 framesloadratio: 0.528565198430004 loadratio: 0.680228138782205 loadperc: 0.680122116689281 framesloadratio: 0.680122116689281 loadratio: 0.793536289935253 loadperc: 0.793313953488372 framesloadratio: 0.793313953488372 loadratio: 0.906844441088301 loadperc: 0.906639531925719 framesloadratio: 0.906639531925719 loadratio: 1 loadperc: 1 framesloadratio: 1 onload called In dhtml, no music: setSource called This is the correct behavior. mamye42 (5:58:15 PM): Testing 4048 in r5349. I see what you put in the bug for swf and it plays music. DHTML just shows "setSource called" and no music. Is this correct behavior? vjqak (4:59:46 PM): yes. mamye42 (5:58:52 PM): Will DHTML eventually work? vjqak (5:00:29 PM): probably not. well, it does, by embedding swf. see examples/musicdhtml/ mamye42 (5:59:21 PM): ahhh vjqak (5:00:55 PM): dhtml can't play audio without a plugin so... Ben didn't test they were closed before they were ported to 4.0.3
(4.0 branch (4.0.3RC) build r5692) Fixed |
||||||||||||||||||||||||||||||||||||||||||||||||||||