r68538 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68537‎ | r68538 | r68539 >
Date:01:07, 25 June 2010
Author:dale
Status:deferred
Tags:
Comment:
* improved smil playback with animations between monitor points
* register the callback time.
Modified paths:
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoTransition.html (added) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoTransitionSmil.xml (added) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/panzoom/Fruits-4s.smil.xml (modified) (history)
  • /branches/MwEmbedStandAlone/tests/media/sequence_transition_smil.xml (deleted) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/tests/media/sequence_transition_smil.xml
@@ -1,65 +0,0 @@
2 -<?xml version="1.0" encoding="UTF-8"?>
3 -<smil baseProfile="Language" version="3.0" xmlns="http://www.w3.org/ns/SMIL">
4 - <head>
5 - <meta name="title" content="Simple Crossfading Example"/>
6 -
7 - <transition id="fromGreen"
8 - type="fade"
9 - subtype="fadeFromColor"
10 - fadeColor="#87CF87"
11 - dur="4s"/>
12 -
13 - <transition id="toGreen"
14 - type="fade"
15 - subtype="fadeToColor"
16 - fadeColor="#87CF87"
17 - dur="4s"/>
18 -
19 - <transition id="xFade"
20 - type="fade"
21 - subtype="crossfade"
22 - dur="4s"/>
23 -
24 - </head>
25 - <body>
26 - <seq>
27 - <ref type="text/html" dur="8" uri="Template:My_Video_Intro_Text"><![CDATA[
28 -<h3> <span class="mw-headline" id="cat">cat</span></h3>
29 -<div class="thumb tright"><div class="thumbinner" style="width:102px;"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/dc/Nos_kota.jpg/120px-Nos_kota.jpg"></div></div>
30 -<div style="color:gray"> MY Date: 21 January, 2010 00:45</div>
31 -
32 -]]><param name="videoTitle">cat</param><param name="MyDate">{{CURRENTDAY}} {{CURRENTMONTHNAME}}, {{CURRENTYEAR}} {{CURRENTTIME}}</param></ref>
33 -
34 -
35 - <video src="http://upload.wikimedia.org/wikipedia/commons/d/d3/Okapia_johnstoni5.ogg"
36 - region="video_region"
37 - transIn="fromGreen"
38 - transOut="xFade"
39 - type="video/ogg"
40 - fill="transition"
41 - durationHint="15"
42 - dur="9s"
43 - poster="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Okapia_johnstoni5.ogg/mid-Okapia_johnstoni5.ogg.jpg"
44 - />
45 -
46 - <video src="http://upload.wikimedia.org/wikipedia/commons/0/0d/B-36_bomber.ogg"
47 - region="video_region"
48 - fill="transition"
49 - dur="10s"
50 - durationHint="70"
51 - type="video/ogg"
52 - poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg"
53 - />
54 -
55 - <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/USS_Bunker_Hill_hit_by_two_Kamikazes.jpg/400px-USS_Bunker_Hill_hit_by_two_Kamikazes.jpg"
56 - region="video_region"
57 - dur="5s"
58 - type="image/jpeg"
59 - />
60 -
61 - </seq>
62 -
63 - </body>
64 -</smil>
65 -
66 -
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
@@ -35,7 +35,7 @@
3636 _this.getNodeSmilType( $node ) == 'ref'
3737 || _this.getNodeSmilType( $node ) == 'smilText'
3838 )
39 - ){
 39+ ){
4040 $node.attr('id', _this.smil.embedPlayer.id + '_ref_' + _this.idIndex );
4141 mw.log('SmilBody:: gave: ' + $node.get(0).nodeName + ' id: ' + $node.attr('id') );
4242 _this.idIndex++;
@@ -52,23 +52,23 @@
5353 /**
5454 * Render the body elements for a given time, use layout engine to draw elements
5555 */
56 - renderTime: function( time ){
 56+ renderTime: function( time, deltaTime ){
5757 var _this = this;
5858 // Get all the draw elements from the body this time:
5959 var elementList = this.getElementsForTime( time );
60 - mw.log("SmilBody::renderTime: draw " + elementList.length + " elementList" );
 60+ //mw.log("SmilBody::renderTime: draw " + elementList.length + " elementList" );
6161
6262 $j.each( elementList , function( inx, smilElement ) {
6363 // xxx need to
6464 // var relativeTime = time - smilElement.parentTimeOffset;
65 - var relativeTime = time - $j( smilElement ) .data ( 'parentStartOffset' );
 65+ var relativeTime = time - $j( smilElement ).data ( 'parentStartOffset' );
6666
6767 // Render the active elements using the layout engine
6868 _this.smil.getLayout().drawElement( smilElement, relativeTime );
6969
70 - // Transform the elements per animate engine
71 - _this.smil.getAnimate().transformElement( smilElement, relativeTime );
72 - } )
 70+ // Transform the elements per animate engine
 71+ _this.smil.getAnimate().animateTransform( smilElement, relativeTime, deltaTime );
 72+ } );
7373 },
7474
7575 /**
@@ -139,7 +139,7 @@
140140 // If the nodeType is "ref" add to this.elementsInRange array
141141 if( nodeType == 'ref' || nodeType == 'smilText' ) {
142142 // Add the parent startOffset
143 - $node.data('parentStartOffset', startOffset );
 143+ $node.data( 'parentStartOffset', startOffset );
144144 // Ref type get the
145145 this.elementsInRange.push( $node );
146146 //mw.log("Add ref to elementsInRange:: " + nodeType + " length:" + this.elementsInRange.length);
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
@@ -71,7 +71,7 @@
7272 var regionId = $j( smilElement ).attr( 'region');
7373 var nodeName = $j( smilElement ).get(0).nodeName ;
7474
75 - mw.log( "SmilLayout::drawElement: " + nodeName + '.' + $j( smilElement ).attr('id' ) + ' into ' + regionId );
 75+ //mw.log( "SmilLayout::drawElement: " + nodeName + '.' + $j( smilElement ).attr('id' ) + ' into ' + regionId );
7676 var $regionTarget = this.$rootLayout.find( '#' + regionId );
7777
7878 // Check for region target in $rootLayout
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
@@ -10,17 +10,115 @@
1111 // Constructor:
1212 init: function( smilObject ){
1313 this.smil = smilObject;
 14+
 15+ // xxx possible option?
 16+ this.framerate = mw.getConfig( 'SmilPlayer.framerate' );
 17+
 18+ this.callbackRate = 1000 / this.framerate;
 19+ this.animateInterval = [];
1420 },
1521
 22+ /**
 23+ * Animate a smil transform per supplied time.
 24+ */
 25+ animateTransform: function( smilElement, animateTime, deltaTime ){
 26+ var _this = this;
 27+
 28+ // If deltaTime is zero, then we should just transformElement directly:
 29+ if( !deltaTime || deltaTime === 0 ){
 30+ _this.transformElement( smilElement, animateTime );
 31+ return ;
 32+ }
 33+
 34+ // Check if the current smilElement has any transforms to be done
 35+ if( ! this.checkForTransformUpdate( smilElement, animateTime, deltaTime ) ){
 36+ // xxx no animate loop needed for element: smilElement
 37+ return ;
 38+ }
 39+
 40+ // We have a delta spawn an short animateInterval
 41+
 42+ // Clear any old animation loop ( can be caused by overlapping play requests or slow animation )
 43+ clearInterval( this.animateInterval[ this.smil.getAssetId( smilElement ) ] );
 44+
 45+ // Start a new animation interval
 46+ var animationStartTime = new Date().getTime();
 47+ var animateTimeDelta = 0;
 48+
 49+ this.animateInterval[ this.smil.getAssetId( smilElement ) ] =
 50+ setInterval(
 51+ function(){
 52+ var timeElapsed = new Date().getTime() - animationStartTime;
 53+ // Set the animate Time delta
 54+ animateTimeDelta += _this.callbackRate;
 55+
 56+ if( animateTimeDelta > deltaTime || timeElapsed > deltaTime ){
 57+ // Stop animating:
 58+ clearInterval( _this.animateInterval[ _this.smil.getAssetId( smilElement ) ] );
 59+ return ;
 60+ }
 61+
 62+ if( Math.abs( timeElapsed - animateTimeDelta ) > 100 ){
 63+ mw.log( "Error more than 100ms lag within animateTransform loop: te:" + timeElapsed +
 64+ ' td:' + animateTimeDelta + ' diff: ' + Math.abs( timeElapsed - animateTimeDelta ) );
 65+ }
 66+
 67+ // Do the transform request:
 68+ _this.transformElement( smilElement, animateTime + ( animateTimeDelta/1000 ) );
 69+ },
 70+ this.callbackRate
 71+ );
 72+ },
 73+
 74+ /**
 75+ * Quickly check if a given smil element needs to be updated for a given time delta
 76+ */
 77+ checkForTransformUpdate: function( smilElement, animateTime, deltaTime ){
 78+ // Get the node type:
 79+ var nodeName = $j( smilElement ).get(0).nodeName;
 80+
 81+ // NOTE: our img node check sort of avoids deltaTime check but its assumed to not matter much
 82+ // since any our supported keyframe granularity will be equal to deltaTime ie 1/4 a second.
 83+ if( nodeName.toLowerCase() == 'img' ){
 84+ // Confirm a child animate is in-range
 85+ if( $j( smilElement ).find( 'animate' ).length ) {
 86+ // Check if there are animate elements in range:
 87+ if( this.getSmilAnimateInRange( smilElement, animateTime) ){
 88+ return true;
 89+ }
 90+ }
 91+ }
 92+
 93+ // Check if we need to do a smilText clear:
 94+ if( nodeName.toLowerCase() == 'smiltext' ){
 95+ var el = $j( smilElement ).get(0);
 96+ for ( var i=0; i < el.childNodes.length; i++ ) {
 97+ var node = el.childNodes[i];
 98+ // Check for text Node type:
 99+ if( node.nodeName == 'clear' ) {
 100+ var clearTime = this.smil.parseTime( $j( node ).attr( 'begin') );
 101+ //mw.log( ' ct: ' + clearTime + ' >= ' + animateTime + ' , ' + deltaTime );
 102+ if( clearTime >= animateTime && clearTime <= ( animateTime + deltaTime ) ) {
 103+ return true;
 104+ }
 105+ }
 106+ }
 107+ }
 108+ //mw.log( 'checkForTransformUpdate::' + nodeName +' ' + animateTime );
 109+
 110+ return false;
 111+ },
 112+
 113+
16114 /**
17115 * Transform a smil element for a requested time.
18116 *
19117 * @param {Element} smilElement Element to be transformed
20 - * @param {float} animateTime The relative time to be transfored.
 118+ * @param {float} animateTime The relative time to be transformed.
21119 */
22120 transformElement: function( smilElement, animateTime ) {
23121 var nodeName = $j( smilElement ).get(0).nodeName ;
24 - mw.log("transformForTime: " + nodeName );
 122+ //mw.log("transformForTime: " + nodeName + ' t:' + animateTime );
25123 switch( nodeName.toLowerCase() ){
26124 case 'smiltext':
27125 return this.transformTextForTime( smilElement, animateTime);
@@ -32,92 +130,113 @@
33131 },
34132
35133 transformTextForTime: function( textElement, animateTime ) {
 134+ //mw.log("transformTextForTime:: " + animateTime );
 135+
36136 if( $j( textElement ).children().length == 0 ){
37137 // no text transform children
38138 return ;
39 - }
40 -
 139+ }
41140 // xxx Note: we could have text transforms in the future:
42141 var textCss = this.smil.getLayout().transformSmilCss( textElement );
 142+
 143+ // Set initial textValue:
 144+ var textValue ='';
43145
44 - var bucketText = '';
45 - var textBuckets = [];
46 - var clearInx = 0;
47 - var el = $j( textElement ).get(0);
 146+ var el = $j( textElement ).get(0);
48147 for ( var i=0; i < el.childNodes.length; i++ ) {
49148 var node = el.childNodes[i];
50149 // Check for text Node type:
51150 if( node.nodeType == 3 ) {
52 - bucketText += node.nodeValue;
53 - } else if( node.nodeName == 'clear'){
54 - var clearTime = this.smil.parseTime( $j( node ).attr( 'begin') );
55 - // append bucket
56 - textBuckets.push( {
57 - 'text' : bucketText,
58 - 'clearTime' : clearTime
59 - } );
 151+ textValue += node.nodeValue;
 152+ } else if( node.nodeName == 'clear' ){
 153+ var clearTime = this.smil.parseTime( $j( node ).attr( 'begin') );
 154+ if( clearTime > animateTime ){
 155+ break;
 156+ }
60157 // Clear the bucket text collection
61 - bucketText ='';
 158+ textValue = '';
62159 }
63 - }
64 -
65 - var textValue ='';
66 - // Get the text node in range given time:
67 - for( var i =0; i < textBuckets.length ; i++){
68 - var bucket = textBuckets[i];
69 - if( animateTime < bucket.clearTime ){
70 - textValue = bucket.text;
71 - break;
72 - }
73 - }
 160+ }
 161+
74162 // Update the text value target
75163 // xxx need to profile update vs check value
76164 $j( '#' + this.smil.getAssetId( textElement ) )
77 - .html(
78 - $j('<span />')
79 - // Add the text value
80 - .text( textValue )
81 - .css( textCss )
82 - )
 165+ .html(
 166+ $j('<span />')
 167+ // Add the text value
 168+ .text( textValue )
 169+ .css( textCss )
 170+ )
83171 },
84172
85173 transformImageForTime: function( smilImgElement, animateTime ) {
86174 var _this = this;
 175+ //mw.log( "transformImageForTime:: animateTime:" + animateTime );
 176+
87177 if( $j( smilImgElement ).children().length == 0 ){
88 - // no image transform children
 178+ // No image transform children
89179 return ;
90180 }
 181+
 182+ var animateInRange = _this.getSmilAnimateInRange( smilImgElement, animateTime, function( animateElement ){
 183+ //mw.log('animateInRange callback::' + $j( animateElement ).attr( 'attributeName' ) );
 184+ switch( $j( animateElement ).attr( 'attributeName' ) ) {
 185+ case 'panZoom':
 186+ // Get the pan zoom css for "this" time
 187+ _this.transformPanZoom ( smilImgElement, animateElement, animateTime );
 188+ break;
 189+ default:
 190+ mw.log("Error unrecognized Animation attributName: " +
 191+ $j( animateElement ).attr( 'attributeName' ) );
 192+ }
 193+ });
 194+ // No animate elements in range, make sure we transform to previus or to initial state if time is zero
 195+ if( !animateInRange ) {
 196+ if( animateTime == 0 ) {
 197+ // just a hack for now ( should read from previus animation or from source attribute
 198+ //this.updateElementLayout( smilImgElement, { 'top':1,'left':1,'width':1, 'height':1 } );
 199+ var $target = $j( '#' + this.smil.getAssetId( smilImgElement ));
 200+ $target.css({ 'top':'0px','left':'0px','width':'100%', 'height':'100%' } );
 201+ }
 202+ // xxx should check for transform to previus
 203+ }
 204+ },
 205+
 206+ /**
 207+ * Calls a callback with Smil Animate In Range for a requested time
 208+ *
 209+ * @param {Element} smilImgElement The smil element to search for child animate
 210+ * @param {float} animateTime The target animation time
 211+ * @param {function=} callback Optional function to call with elements in range.
 212+ * return @bollean true if animate elements are in range false if none found
 213+ */
 214+ getSmilAnimateInRange: function( smilImgElement, animateTime, callback ){
 215+ var _this = this;
 216+ var animateInRange = false;
91217 // Get transform elements in range
92218 $j( smilImgElement ).find( 'animate' ).each( function( inx, animateElement ){
93219 var begin = _this.smil.parseTime( $j( animateElement ).attr( 'begin') );
94220 var duration = _this.smil.parseTime( $j( animateElement ).attr( 'dur') );
95 - //mw.log( "b:" + begin +" < " + animateTime + " && b+d: " + ( begin + duration ) + " > " + animateTime );
 221+ //mw.log( "getSmilAnimateInRange:: b:" + begin +" < " + animateTime + " && b+d: " + ( begin + duration ) + " > " + animateTime );
96222
97223 // Check if the animate element is in range
98224 var cssTransform = {};
99225 if( begin <= animateTime && ( begin + duration ) >= animateTime ) {
100 - // Get the transform type:
101 - switch( $j( animateElement ).attr('attributeName') ){
102 - case 'panZoom':
103 - // Get the pan zoom css for "this" time
104 - _this.transformPanZoom ( smilImgElement, animateElement, animateTime );
105 - break;
106 - default:
107 - mw.log("Error unrecognized Annimation attributName: " +
108 - $j( animateElement ).attr('attributeName') );
109 -
110 - }
111 - //mw.log("b:transformImageForTime: " + $j( animateElement ).attr( 'values' ) );
112 - //$j( smilImgElement ).css( cssTransform );
113 - }
114 -
 226+ animateInRange = true;
 227+ if( callback ) {
 228+ callback( animateElement );
 229+ }
 230+ }
115231 });
 232+ return animateInRange;
116233 },
 234+
117235 /**
118 - * get the css layout transforms for a panzoom transform type
 236+ * Get the css layout transforms for a panzoom transform type
119237 *
120238 * http://www.w3.org/TR/SMIL/smil-extended-media-object.html#q32
121 - *
 239+ *
 240+ *
122241 */
123242 transformPanZoom: function( smilImgElement, animateElement, animateTime ){
124243 var begin = this.smil.parseTime( $j( animateElement ).attr( 'begin') );
@@ -131,6 +250,8 @@
132251
133252 // Get the target interpreted value
134253 var targetValue = this.getInterpolatePointsValue( animatePoints, relativeAnimationTime, duration );
 254+
 255+ //mw.log( "SmilAnimate::transformPanZoom: source points: " + $j( animateElement ).attr('values') + " target:" + targetValue.join(',') );
135256
136257 // Let Top Width Height
137258 // translate values into % values
@@ -164,7 +285,8 @@
165286 // xxx need to refactor move to "smilLayout"
166287 updateElementLayout: function( smilElement, percentValues ){
167288
168 - mw.log("updateElementLayout::" + percentValues.top + ' ' + percentValues.left + ' ' + percentValues.width + ' ' + percentValues.height );
 289+ //mw.log("updateElementLayout::" + percentValues.top + ' ' + percentValues.left + ' ' + percentValues.width + ' ' + percentValues.height );
 290+
169291 // get a pointer to the html target:
170292 var $target = $j( '#' + this.smil.getAssetId( smilElement ));
171293
@@ -209,7 +331,6 @@
210332 'top' : (-1 * percentValues['top'])*100 + '%',
211333 'left' : (-1 * percentValues['left'])*100 + '%',
212334 } );
213 -
214335 },
215336
216337 /**
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/loader.js
@@ -4,6 +4,12 @@
55 // Wrap in mw to not pollute global namespace
66 ( function( mw ) {
77
 8+ mw.setDefaultConfig( {
 9+ // The framerate for the smil player
 10+ 'SmilPlayer.framerate': 30
 11+ } );
 12+
 13+
814 mw.addResourcePaths( {
915 "mw.SmilHooks" : "mw.SmilHooks.js",
1016
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
@@ -119,6 +119,17 @@
120120 },
121121
122122 /**
 123+ * We use animateTime instead of a tight framerate loop
 124+ * so that we can optimize with css transformations
 125+ *
 126+ * ( Very similar to renderTime but no callback and we pass a timeDelta
 127+ */
 128+ animateTime: function( time, timeDelta ){
 129+ //mw.log("Smil::animateTime: " + time + ' delta: ' + timeDelta );
 130+ this.getBody().renderTime( time, timeDelta );
 131+ },
 132+
 133+ /**
123134 * Get the smil buffer object
124135 */
125136 getBuffer: function(){
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/panzoom/Fruits-4s.smil.xml
@@ -23,11 +23,14 @@
2424 panZoom="0,0,100%,100%" region="image_region" src="fruitStand.jpg">
2525
2626 <animate attributeName="panZoom" begin="2.0"
27 - dur="1.5s" fill="freeze" values="-1,4,99%,99%;511,509,47%,14%"/>
 27+ dur="1.5s" fill="freeze" values="-1,4,99%,99%;511,509,47%,14%"/>
 28+
2829 <animate attributeName="panZoom" begin="5.0"
2930 dur="1.5s" fill="freeze" values="511,509,47%,14%;418,-3,34%,13%"/>
 31+
3032 <animate attributeName="panZoom" begin="9.0"
31 - dur="1.5s" fill="freeze" values="418,-3,34%,13%;9,1115,41%,20%"/>
 33+ dur="1.5s" fill="freeze" values="418,-3,34%,13%;9,1115,41%,20%"/>
 34+
3235 <animate attributeName="panZoom" begin="13.0"
3336 dur="1.5s" fill="freeze" values="9,1115,41%,20%;573,2073,64%,17%"/>
3437 <animate attributeName="panZoom" begin="16.0"
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoTransition.html
@@ -0,0 +1,44 @@
 2+<!doctype html>
 3+<html>
 4+<head>
 5+ <title>Pan Zoom Example</title>
 6+ <script type="text/javascript" src="../../../mwEmbed.js?debug=true"></script>
 7+ <!-- <script type="text/javascript" src="../../ResourceLoader.php?class=window.jQuery,mwEmbed&debug=true"></script> -->
 8+ <script type="text/javascript">
 9+ mw.setConfig( 'EmbedPlayer.OverlayControls', false );
 10+ mw.ready(function(){
 11+ $j( "#seekInputTime" ).blur( function(){
 12+ var smilVid = $j('#panzoom').get(0);
 13+ $j('#seekInProgress').show();
 14+ smilVid.setCurrentTime( parseFloat( $j(this).val() ), function(){
 15+ $j('#seekInProgress').hide();
 16+ });
 17+ });
 18+ });
 19+ </script>
 20+</head>
 21+<body>
 22+<h3>Sample playlist pan-zoom animation</h3>
 23+<table>
 24+<tr>
 25+<td>
 26+
 27+<video id="panzoom" type="application/smil" src="panzoom/Fruits-4s.smil.xml" width="400" height="400"></video>
 28+<p></p>seek to <input id="seekInputTime" size="4" value = "10"></input><span id="seekInProgress" style="display: none"> Seeking<blink>...</blink></span>
 29+</td>
 30+<td valign="top">
 31+Sample playlist code:
 32+<div style="clear:both"></div>
 33+<textarea style="width:500px;">
 34+<video id="panzoom" type="application/smil" src="panzoom/Fruits-4s.smil.xml" width="400" height="300"></video>
 35+</textarea>
 36+<div style="clear:both"></div>
 37+
 38+SMIL Source:
 39+<div style="clear:both"></div>
 40+<iframe style="width:500px;height:300px" src="panzoom/Fruits-4s.smil.xml"></iframe>
 41+</td>
 42+</tr>
 43+</table>
 44+</body>
 45+</html>
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoTransitionSmil.xml
@@ -0,0 +1,65 @@
 2+<?xml version="1.0" encoding="UTF-8"?>
 3+<smil baseProfile="Language" version="3.0" xmlns="http://www.w3.org/ns/SMIL">
 4+ <head>
 5+ <meta name="title" content="Simple Crossfading Example"/>
 6+
 7+ <transition id="fromGreen"
 8+ type="fade"
 9+ subtype="fadeFromColor"
 10+ fadeColor="#87CF87"
 11+ dur="4s"/>
 12+
 13+ <transition id="toGreen"
 14+ type="fade"
 15+ subtype="fadeToColor"
 16+ fadeColor="#87CF87"
 17+ dur="4s"/>
 18+
 19+ <transition id="xFade"
 20+ type="fade"
 21+ subtype="crossfade"
 22+ dur="4s"/>
 23+
 24+ </head>
 25+ <body>
 26+ <seq>
 27+ <ref type="text/html" dur="8" uri="Template:My_Video_Intro_Text"><![CDATA[
 28+<h3> <span class="mw-headline" id="cat">cat</span></h3>
 29+<div class="thumb tright"><div class="thumbinner" style="width:102px;"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/dc/Nos_kota.jpg/120px-Nos_kota.jpg"></div></div>
 30+<div style="color:gray"> MY Date: 21 January, 2010 00:45</div>
 31+
 32+]]><param name="videoTitle">cat</param><param name="MyDate">{{CURRENTDAY}} {{CURRENTMONTHNAME}}, {{CURRENTYEAR}} {{CURRENTTIME}}</param></ref>
 33+
 34+
 35+ <video src="http://upload.wikimedia.org/wikipedia/commons/d/d3/Okapia_johnstoni5.ogg"
 36+ region="video_region"
 37+ transIn="fromGreen"
 38+ transOut="xFade"
 39+ type="video/ogg"
 40+ fill="transition"
 41+ durationHint="15"
 42+ dur="9s"
 43+ poster="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Okapia_johnstoni5.ogg/mid-Okapia_johnstoni5.ogg.jpg"
 44+ />
 45+
 46+ <video src="http://upload.wikimedia.org/wikipedia/commons/0/0d/B-36_bomber.ogg"
 47+ region="video_region"
 48+ fill="transition"
 49+ dur="10s"
 50+ durationHint="70"
 51+ type="video/ogg"
 52+ poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg"
 53+ />
 54+
 55+ <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/USS_Bunker_Hill_hit_by_two_Kamikazes.jpg/400px-USS_Bunker_Hill_hit_by_two_Kamikazes.jpg"
 56+ region="video_region"
 57+ dur="5s"
 58+ type="image/jpeg"
 59+ />
 60+
 61+ </seq>
 62+
 63+ </body>
 64+</smil>
 65+
 66+
Property changes on: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoTransitionSmil.xml
___________________________________________________________________
Name: svn:mergeinfo
167 + /branches/REL1_15/phase3/js2/mwEmbed/example_usage/media/sample_smil.xml:51646
/branches/sqlite/js2/mwEmbed/example_usage/media/sample_smil.xml:58211-58321
Name: svn:eol-style
268 + native
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
@@ -48,19 +48,26 @@
4949 * @param {function} callback Function to be called once currentTime is loaded and displayed
5050 */
5151 setCurrentTime: function( time, callback ) {
52 - mw.log('EmbedPlayerSmil::setCurrentTime: ' + time );
 52+ mw.log('EmbedPlayerSmil::setCurrentTime: ' + time );
5353 // Set "loading" spinner here)
5454 $j( this ).append(
5555 $j( '<div />')
5656 .attr('id', 'loadingSpinner_' + this.id )
5757 .loadingSpinner()
5858 );
 59+ // Start seek
 60+ this.controlBuilder.onSeek();
 61+ this.smilPlayTime = time;
5962 var _this = this;
6063 this.getSmil( function( smil ){
6164 smil.renderTime( time, function(){
62 - mw.log("renderTime callback");
 65+ mw.log( "setCurrentTime:: renderTime callback" );
6366 $j('#loadingSpinner_' + _this.id ).remove();
64 - callback();
 67+
 68+ _this.monitor();
 69+ if( callback ){
 70+ callback();
 71+ }
6572 } );
6673 });
6774 },
@@ -71,7 +78,7 @@
7279 getRenderTarget: function(){
7380 if( !this.$renderTarget ){
7481 if( $j('#smilCanvas_' + this.id ).length === 0 ) {
75 - // if no render target exist create one:
 82+ // If no render target exist create one:
7683 $j( this ).html(
7784 $j( '<div />')
7885 .attr('id', 'smilCanvas_' + this.id )
@@ -93,9 +100,8 @@
94101 this.parent_play();
95102
96103 // Set start clock time:
97 - this.clockStartTime = new Date().getTime();
 104+ this.clockStartTime = new Date().getTime();
98105
99 -
100106 this.getSmil( function( smil ){
101107 this.smil = smil;
102108 })
@@ -106,6 +112,7 @@
107113 stop: function(){
108114 this.smilPlayTime = 0;
109115 this.smilPauseTime = 0;
 116+ this.setCurrentTime( 0 );
110117 this.parent_stop();
111118 },
112119
@@ -125,6 +132,7 @@
126133 getPlayerElementTime: function() {
127134 return this.smilPlayTime;
128135 },
 136+
129137
130138 /**
131139 * Monitor function render a given time
@@ -133,14 +141,13 @@
134142 // Update the smilPlayTime
135143 if( !this.isPaused() ){
136144 this.smilPlayTime = this.smilPauseTime + ( ( new Date().getTime() - this.clockStartTime ) / 1000 );
 145+
 146+ // xxx check buffer to see if we need to pause playback
 147+
 148+ // Issue an animate time request with monitorDelta
 149+ this.smil.animateTime( this.smilPlayTime, this.monitorRate );
137150 }
138 -
139 - // Animate to time
140 - smil.renderTime( this.smilPlayTime, function(){
141 - // callback for render
142 -
143 - // xxx if too much time has gone by potentaill flag
144 - });
 151+
145152 this.parent_monitor();
146153 },
147154
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
@@ -64,7 +64,10 @@
6565 "EmbedPlayer.ShareEmbedMode" : 'object',
6666
6767 // Default player skin name
68 - "EmbedPlayer.SkinName" : "mvpcf"
 68+ "EmbedPlayer.SkinName" : "mvpcf",
 69+
 70+ // Number of milliseconds between interface updates
 71+ 'EmbedPlayer.MonitorRate' : 250
6972 } );
7073
7174 // Add class file paths
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -1370,8 +1370,11 @@
13711371 if ( !this.skinName ) {
13721372 this.skinName = mw.getConfig( 'EmbedPlayer.SkinName' );
13731373 }
1374 -
13751374
 1375+ if( !this.monitorRate ){
 1376+ this.monitorRate = mw.getConfig( 'EmbedPlayer.MonitorRate' );
 1377+ }
 1378+
13761379 // Make sure startOffset is cast as an float:
13771380 if ( this.startOffset && this.startOffset.split( ':' ).length >= 2 ) {
13781381 this.startOffset = parseFloat( mw.npt2seconds( this.startOffset ) );
@@ -2895,7 +2898,7 @@
28962899 }
28972900
28982901 //mw.log( 'Monitor:: ' + this.currentTime + ' duration: ' + ( parseInt( this.getDuration() ) + 1 ) + ' is seek: ' + this.seeking );
2899 - if ( this.currentTime && this.currentTime > 0 && this.duration ) {
 2902+ if ( this.currentTime >= 0 && this.duration ) {
29002903 if ( !this.userSlide && !this.seeking ) {
29012904 if ( parseInt( this.startOffset ) != 0 ) {
29022905 // If start offset include that calculation
@@ -2945,7 +2948,7 @@
29462949 if( !this.monitorInterval ){
29472950 this.monitorInterval = setInterval( function(){
29482951 _this.monitor();
2949 - }, 250 )
 2952+ }, this.monitorRate )
29502953 }
29512954 } else {
29522955 // If stoped "stop" monitor:
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
@@ -635,7 +635,7 @@
636636 return false;
637637 }
638638 // If the config is false
639 - if( mw.getConfig( 'EmbedPlayer.OverlayControls' ) === false){
 639+ if( mw.getConfig( 'EmbedPlayer.OverlayControls' ) == false){
640640 return false;
641641 }
642642

Status & tagging log