Index: branches/MwEmbedStandAlone/mwEmbed.i18n.php |
— | — | @@ -276,6 +276,10 @@ |
277 | 277 | 'mwe-load-drag-item' => 'Am Lade vu mitgschleipfte Poschte', |
278 | 278 | 'mwe-ok' => 'OK', |
279 | 279 | 'mwe-cancel' => 'Abbräche', |
| 280 | + 'mwe-enable-gadget' => 'D Beta-Version vum Multimedia-Heälferli (mwEmbed) fir alli Syte aktiviere', |
| 281 | + 'mwe-enable-gadget-done' => 'Beta-Version vum Multimedia-Hälferli isch aktiviert wore', |
| 282 | + 'mwe-must-login-gadget' => 'Go s Hälferli aktiviere chenne, muesch di <a target="_new" href="$1">aamälde</a>', |
| 283 | + 'mwe-test-plural' => '{{PLURAL:$1|$1 Tescht|$1 Tescht}} uusgfiert', |
280 | 284 | ); |
281 | 285 | |
282 | 286 | /** Hebrew (עברית) |
— | — | @@ -553,6 +557,14 @@ |
554 | 558 | 'mwe-test-plural' => 'Покренуо/ла сам {{PLURAL:$1|$1 тест|$1 тестова}}', |
555 | 559 | ); |
556 | 560 | |
| 561 | +/** Serbian Latin ekavian (Srpski (latinica)) */ |
| 562 | +$messages['sr-el'] = array( |
| 563 | + 'mwe-loading_txt' => 'Učitavanje ...', |
| 564 | + 'mwe-ok' => 'OK', |
| 565 | + 'mwe-cancel' => 'Poništi', |
| 566 | + 'mwe-test-plural' => 'Pokrenuo/la sam {{PLURAL:$1|$1 test|$1 testova}}', |
| 567 | +); |
| 568 | + |
557 | 569 | /** Swedish (Svenska) |
558 | 570 | * @author Dafer45 |
559 | 571 | * @author GameOn |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js |
— | — | @@ -2,47 +2,95 @@ |
3 | 3 | * The smil body also see: |
4 | 4 | * http://www.w3.org/TR/2008/REC-SMIL3-20081201/smil-structure.html#edef-body |
5 | 5 | */ |
6 | | -mw.SmilBody = function( $body ){ |
7 | | - return this.init( $body ); |
| 6 | +mw.SmilBody = function( smilObject ){ |
| 7 | + return this.init( smilObject ); |
8 | 8 | } |
9 | 9 | |
10 | 10 | mw.SmilBody.prototype = { |
11 | 11 | |
12 | | - // Used to store elements for getElementForTime method |
| 12 | + // Used to store elements for getElementsForTime method |
13 | 13 | elementsInRange: [], |
14 | 14 | |
| 15 | + // Index of auto assigned ids |
| 16 | + idIndex : 0, |
| 17 | + |
15 | 18 | // Constructor: |
16 | 19 | init: function( smilObject ){ |
17 | 20 | this.smil = smilObject; |
18 | 21 | this.$dom = this.smil.getDom().find( 'body' ); |
| 22 | + |
| 23 | + // Assign ids to smil body elements |
| 24 | + this.assignIds( this.$dom ); |
19 | 25 | }, |
20 | 26 | |
21 | 27 | /** |
| 28 | + * Assigns body smil elements id (for content that has a html representation "ref" & "smilText" ) |
| 29 | + * ( enables fast sync between smilDom and htmlDom ) |
| 30 | + */ |
| 31 | + assignIds: function( $node ) { |
| 32 | + var _this = this; |
| 33 | + if( !$node.attr('id') |
| 34 | + && !$node.attr( 'xml:id' ) |
| 35 | + && ( |
| 36 | + _this.getNodeSmilType( $node ) == 'ref' |
| 37 | + || _this.getNodeSmilType( $node ) == 'smilText' |
| 38 | + ) |
| 39 | + ){ |
| 40 | + $node.attr('id', _this.smil.embedPlayer.id + '_ref_' + _this.idIndex ); |
| 41 | + mw.log('SmilBody:: gave: ' + $node.get(0).nodeName + ' id: ' + $node.attr('id') ); |
| 42 | + _this.idIndex++; |
| 43 | + } |
| 44 | + |
| 45 | + // Recurse to all the nodes children |
| 46 | + if( $node.children().length ) { |
| 47 | + $node.children().each( function( inx, childNode ){ |
| 48 | + _this.assignIds( $j( childNode ) ); |
| 49 | + }); |
| 50 | + } |
| 51 | + }, |
| 52 | + |
| 53 | + /** |
| 54 | + * Render the body elements for a given time, use layout engine to draw elements |
| 55 | + */ |
| 56 | + renderTime: function( time ){ |
| 57 | + var _this = this; |
| 58 | + // Get all the draw elements from the body this time: |
| 59 | + var drawElements = this.getElementsForTime( time ); |
| 60 | + mw.log(" got " + drawElements.length + " drawElements" ); |
| 61 | + |
| 62 | + // Render the active elements using the layout engine |
| 63 | + $j.each( drawElements , function(inx, smilElement ) { |
| 64 | + _this.smil.getLayout().drawElement( smilElement, time ); |
| 65 | + } ) |
| 66 | + }, |
| 67 | + |
| 68 | + /** |
22 | 69 | * Gets all the elements for a given time. |
23 | 70 | * |
24 | 71 | */ |
25 | | - getElementForTime: function ( time ) { |
| 72 | + getElementsForTime: function ( time ) { |
26 | 73 | var startOffset = 0; |
27 | | - if( !time ) |
| 74 | + if( !time ) { |
28 | 75 | time =0; |
| 76 | + } |
29 | 77 | // Empty out the requested element set: |
30 | 78 | this.elementsInRange = []; |
31 | | - this.getElementForTimeRecurse( this.$dom, time, startOffset); |
| 79 | + this.getElementsForTimeRecurse( this.$dom, time, startOffset); |
32 | 80 | return this.elementsInRange; |
33 | 81 | }, |
34 | 82 | |
35 | 83 | /** |
36 | | - * getElementForTimeRecurse |
| 84 | + * getElementsForTimeRecurse |
37 | 85 | * @param {Object} $node NOde to recursively search for elements in the given time range |
38 | 86 | */ |
39 | | - getElementForTimeRecurse: function( $node, time, startOffset){ |
| 87 | + getElementsForTimeRecurse: function( $node, time, startOffset){ |
40 | 88 | // Setup local pointers: |
41 | 89 | var nodeDuration = this.getNodeDuration( $node ); |
42 | 90 | var nodeType = this.getNodeSmilType( $node ); |
43 | 91 | var nodeParentType = this.getNodeSmilType( $node.parent() ); |
44 | 92 | var _this = this; |
45 | 93 | |
46 | | - mw.log( "getElementForTimeRecurse::" + |
| 94 | + mw.log( "getElementsForTimeRecurse::" + |
47 | 95 | ' time: ' + time + |
48 | 96 | ' nodeName: ' + $j( $node ).get(0).nodeName + |
49 | 97 | ' nodeType: ' + nodeType + |
— | — | @@ -67,7 +115,7 @@ |
68 | 116 | if( $node.children().length ) { |
69 | 117 | $node.children().each( function( inx, childNode ){ |
70 | 118 | mw.log(" recurse:: startOffset:" + nodeType + ' start offset:' + startOffset ); |
71 | | - var childDur = _this.getElementForTimeRecurse( $j( childNode ), time, startOffset); |
| 119 | + var childDur = _this.getElementsForTimeRecurse( $j( childNode ), time, startOffset); |
72 | 120 | // If element parent is a 'seq' increment startOffset: |
73 | 121 | if( nodeType == 'seq' ) { |
74 | 122 | mw.log(" Parent Seq:: add child dur: " + childDur ); |
— | — | @@ -77,15 +125,14 @@ |
78 | 126 | } |
79 | 127 | } |
80 | 128 | |
81 | | - // If the nodeType is "ref" find the its associated transformations |
82 | | - // add to this.elementsInRange array |
| 129 | + // If the nodeType is "ref" add to this.elementsInRange array |
83 | 130 | if( nodeType == 'ref' || nodeType == 'smilText' ) { |
84 | 131 | // Ref type get the |
85 | 132 | this.elementsInRange.push( $node ); |
86 | 133 | mw.log("Add ref to elementsInRange:: " + nodeType + " length:" + this.elementsInRange.length); |
87 | 134 | } |
88 | 135 | |
89 | | - // Return the node Duration for startOffset updates |
| 136 | + // Return the node Duration for tracking startOffset |
90 | 137 | return this.getNodeDuration( $node ); |
91 | 138 | }, |
92 | 139 | |
— | — | @@ -93,7 +140,7 @@ |
94 | 141 | * Returns the smil body duration |
95 | 142 | * ( wraps getDurationRecurse to get top level duration ) |
96 | 143 | */ |
97 | | - getDuration: function(){ |
| 144 | + getDuration: function(){ |
98 | 145 | this.duration = this.getNodeDuration( this.$dom ); |
99 | 146 | mw.log("smilBody:: getDuration: " + this.duration ); |
100 | 147 | return this.duration; |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js |
— | — | @@ -22,60 +22,61 @@ |
23 | 23 | // Reset the htmlDOM cache |
24 | 24 | this.$rootLayout = null; |
25 | 25 | }, |
| 26 | + |
| 27 | + /** |
| 28 | + * get Html DOM |
| 29 | + */ |
| 30 | + getHtml: function(){ |
| 31 | + var _this = this; |
| 32 | + |
| 33 | + // Setup target Size: |
| 34 | + this.targetWidth = this.smil.embedPlayer.getWidth(); |
| 35 | + this.targetHeight = this.smil.embedPlayer.getHeight(); |
26 | 36 | |
27 | | - getHtmlDOM: function( size , time, callback ){ |
| 37 | + mw.log("SmilLayout:: getHtml:: " + this.targetWidth ); |
| 38 | + |
| 39 | + return this.getRootLayout(); |
| 40 | + }, |
| 41 | + |
| 42 | + getRootLayout: function(){ |
28 | 43 | var _this = this; |
29 | | - mw.log("SmilLayout:: getHtmlDOM:: " + size.width + ' time: ' + time ); |
30 | | - // Setup target Size: |
31 | | - this.targetWidth = size.width; |
32 | | - this.targetHeight = size.height; |
33 | | - |
34 | | - if( !time ) { |
35 | | - time = 0; |
| 44 | + mw.log( "SmilLayout::getRootLayout:" ); |
| 45 | + if( !this.$rootLayout ){ |
| 46 | + this.$rootLayout = $j('<div />' ) |
| 47 | + .attr('rel', 'root-layout' ) |
| 48 | + .css( { |
| 49 | + 'position': 'absolute', |
| 50 | + 'width' : '100%', |
| 51 | + 'height' : '100%' |
| 52 | + }); |
| 53 | + |
| 54 | + // Update the root layout css |
| 55 | + this.$rootLayout.css( _this.getRootLayoutCss() ) |
| 56 | + // Update the root layout html |
| 57 | + this.$rootLayout.html( _this.getRootLayoutHtml() ); |
36 | 58 | } |
37 | | - |
38 | | - // Get the root layout HTML and append the html regions |
39 | | - this |
40 | | - .getRootLayoutHtml() |
41 | | - .appendHtmlRegions() |
42 | | - |
43 | | - // Get all the draw elements from the body this time: |
44 | | - var drawElements = this.smil.getBody().getElementForTime( time ); |
45 | | - |
46 | | - mw.log(" got " + drawElements.length + " drawElements" ); |
47 | | - |
48 | | - |
49 | | - // Reset the media loaded flag |
50 | | - if( _this.mediaLoadingCount != 0 ) { |
51 | | - mw.log( "Error: media still loading, possible stacking seeking requests?" ); |
52 | | - _this.mediaLoadingCount = 0; |
53 | | - } |
54 | | - |
55 | | - // Set the media loaded callback |
56 | | - if( callback ) { |
57 | | - _this.mediaLoadedCallback = callback; |
58 | | - } |
59 | | - |
60 | | - // Draw layout |
61 | | - $j.each( drawElements , function(inx, smilElement ) { |
62 | | - _this.drawElement( smilElement, time ); |
63 | | - } ) |
64 | | - |
65 | | - |
66 | | - return this.$rootLayout; |
| 59 | + return this.$rootLayout; |
67 | 60 | }, |
68 | | - |
69 | | - // Draw the element |
70 | | - drawElement: function( smilElement, time ) { |
| 61 | + |
| 62 | + /** |
| 63 | + * drawElement smilElement |
| 64 | + */ |
| 65 | + drawElement: function( smilElement, time ) { |
71 | 66 | var _this = this; |
72 | 67 | var regionId = $j( smilElement ).attr( 'region'); |
73 | | - var nodeName = $j( smilElement ).get(0).nodeName ; |
| 68 | + var nodeName = $j( smilElement ).get(0).nodeName ; |
| 69 | + |
74 | 70 | mw.log("Draw: " + nodeName + ' into ' + regionId ); |
| 71 | + var $regionTarget = this.$rootLayout.find( '#' + regionId ); |
75 | 72 | // Check for region target in $rootLayout |
76 | | - if( this.$rootLayout.find( '#' + regionId ).length == 0 ) { |
| 73 | + if( $regionTarget.length == 0 ) { |
77 | 74 | mw.log( "Error Could not find region:" + regionId + " for " + nodeName); |
78 | 75 | return ; |
79 | 76 | } |
| 77 | + // Check that the element does not already exist |
| 78 | + if( $j( smilElement ).attr('id') && $regionTarget.find( '#' + $j( smilElement ).attr('id') ) ){ |
| 79 | + mw.log( "Error:: SmilLayout draw element that is already present: " + $j( smilElement ).attr('id') ); |
| 80 | + } |
80 | 81 | |
81 | 82 | // Append the transformed Smil to its target region |
82 | 83 | this.$rootLayout.find( '#' + regionId ).append( |
— | — | @@ -85,6 +86,7 @@ |
86 | 87 | |
87 | 88 | /** |
88 | 89 | * Get the transformed smil element in html format |
| 90 | + * @param |
89 | 91 | */ |
90 | 92 | getSmilElementHtml: function ( smilElement, time ) { |
91 | 93 | var nodeName = $j( smilElement ).get(0).nodeName ; |
— | — | @@ -99,10 +101,34 @@ |
100 | 102 | } |
101 | 103 | mw.log( "Error: Could not find smil layout transform for element type: " + nodeName ); |
102 | 104 | return $j('<span />') |
103 | | - .text( 'Error: unkown type:' + nodeName ); |
| 105 | + .text( 'Error: unknown type:' + nodeName ); |
104 | 106 | }, |
105 | 107 | |
106 | 108 | /** |
| 109 | + * Updates all the active elements for a given time |
| 110 | + * @param time the requested time to be updated. |
| 111 | + * @param deltaTarget if a delta target is supplied we add a css animation transform for that delta |
| 112 | + */ |
| 113 | + updateSmilTime: function( time, deltaTarget ){ |
| 114 | + // for every active element tranform per time request |
| 115 | + |
| 116 | + // |
| 117 | + }, |
| 118 | + |
| 119 | + /** |
| 120 | + * Update SmilBuffer |
| 121 | + * updates the buffer percentage for the entire clip set |
| 122 | + * ( mw.SmilBuffer ) |
| 123 | + */ |
| 124 | + |
| 125 | + /** |
| 126 | + * buffered callback |
| 127 | + * utility function to run a callback once a given buffer time |
| 128 | + * has been reached. |
| 129 | + * ( mw.SmilBuffer ) |
| 130 | + */ |
| 131 | + |
| 132 | + /** |
107 | 133 | * Get a text element per given time |
108 | 134 | * xxx we need to use "relativeTime" |
109 | 135 | */ |
— | — | @@ -218,7 +244,7 @@ |
219 | 245 | }, |
220 | 246 | |
221 | 247 | /** |
222 | | - * Parse pan zoom attribute string |
| 248 | + * Parse pan zoom attribute string |
223 | 249 | * @param panZoomString |
224 | 250 | */ |
225 | 251 | parsePanZoom: function( panZoomString ){ |
— | — | @@ -238,10 +264,11 @@ |
239 | 265 | /** |
240 | 266 | * Add all the regions to the root layout |
241 | 267 | */ |
242 | | - appendHtmlRegions: function(){ |
243 | | - var _this = this; |
| 268 | + getRootLayoutHtml: function(){ |
| 269 | + var _this = this; |
| 270 | + var $layoutContainer = $j( '<div />' ); |
244 | 271 | this.$dom.find( 'region' ).each( function( inx, regionElement ) { |
245 | | - _this.$rootLayout.append( |
| 272 | + $layoutContainer.append( |
246 | 273 | $j( '<div />' ) |
247 | 274 | .attr('rel', 'region' ) |
248 | 275 | .css( 'position', 'absolute' ) |
— | — | @@ -255,22 +282,14 @@ |
256 | 283 | ) |
257 | 284 | ); |
258 | 285 | }); |
259 | | - return this; |
| 286 | + return $layoutContainer.children(); |
260 | 287 | }, |
261 | 288 | |
262 | 289 | /** |
263 | 290 | * Get the root layout object with updated html properties |
264 | 291 | */ |
265 | | - getRootLayoutHtml: function(){ |
266 | | - // Set the in |
267 | | - this.$rootLayout = $j('<div />' ) |
268 | | - .attr('rel', 'root-layout' ) |
269 | | - .css( { |
270 | | - 'position': 'absolute', |
271 | | - 'width' : '100%', |
272 | | - 'height' : '100%' |
273 | | - }); |
274 | | - |
| 292 | + getRootLayoutCss: function( ){ |
| 293 | + |
275 | 294 | if( this.$dom.find( 'root-layout').length ) { |
276 | 295 | if( this.$dom.find( 'root-layout').length > 1 ) { |
277 | 296 | mw.log( "Error document should only contain one root-layout element" ); |
— | — | @@ -292,10 +311,10 @@ |
293 | 312 | $j.extend( rootLayoutCss, this.transformSizeToTarget() ); |
294 | 313 | |
295 | 314 | // Update the layout css |
296 | | - this.$rootLayout.css( rootLayoutCss ); |
| 315 | + return rootLayoutCss; |
297 | 316 | } |
298 | | - |
299 | | - return this; |
| 317 | + mw.log("Error: SmilLayout, could not find root-layout element " ) ; |
| 318 | + return {}; |
300 | 319 | }, |
301 | 320 | |
302 | 321 | /** |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/loader.js |
— | — | @@ -8,6 +8,7 @@ |
9 | 9 | "mw.Smil" : "mw.Smil.js", |
10 | 10 | "mw.SmilLayout" : "mw.SmilLayout.js", |
11 | 11 | "mw.SmilBody" : "mw.SmilBody.js", |
| 12 | + "mw.SmilBuffer" : "mw.SmilBuffer.js", |
12 | 13 | |
13 | 14 | "mw.EmbedPlayerSmil" : "mw.EmbedPlayerSmil.js" |
14 | 15 | } ); |
— | — | @@ -20,6 +21,7 @@ |
21 | 22 | "mw.Smil", |
22 | 23 | "mw.SmilLayout", |
23 | 24 | "mw.SmilBody", |
| 25 | + "mw.SmilBuffer", |
24 | 26 | "mw.EmbedPlayerSmil" |
25 | 27 | ]; |
26 | 28 | |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js |
— | — | @@ -21,9 +21,6 @@ |
22 | 22 | return this.init( options ); |
23 | 23 | } |
24 | 24 | mw.Smil.prototype = { |
25 | | - |
26 | | - // If smil is being loaded lazy init |
27 | | - loadingSmil: null , |
28 | 25 | |
29 | 26 | // Store the mw.SmilLayout object |
30 | 27 | layout : null, |
— | — | @@ -31,16 +28,22 @@ |
32 | 29 | // Stores the mw.SmilBody object |
33 | 30 | body : null, |
34 | 31 | |
| 32 | + // Handles buffer information display elements |
| 33 | + buffer: null, |
| 34 | + |
35 | 35 | // Stores the smil document for this object ( for relative image paths ) |
36 | 36 | smilUrl: null, |
37 | 37 | |
| 38 | + // The abstract emebed player parent |
| 39 | + embedPlayer: null, |
38 | 40 | |
39 | 41 | /** |
40 | 42 | * Constructor |
41 | | - * @param {Object} options Set of options for the smil interface |
| 43 | + * @param {Object} embedPlayer Refrence to the embedPlayer driving the smil object |
42 | 44 | */ |
43 | | - init: function( options ) { |
44 | | - |
| 45 | + init: function( embedPlayer ) { |
| 46 | + mw.log(" Smil:: init with player: " + embedPlayer.id ); |
| 47 | + this.embedPlayer = embedPlayer; |
45 | 48 | }, |
46 | 49 | |
47 | 50 | /** |
— | — | @@ -51,12 +54,10 @@ |
52 | 55 | loadFromUrl: function( url , callback ) { |
53 | 56 | var _this = this; |
54 | 57 | this.smilUrl = url; |
55 | | - mw.log( 'Smil: loadFromUrl : ' + url ); |
56 | | - // Set the loading flag to true: |
57 | | - this.loadingSmil = true; |
| 58 | + mw.log( 'Smil::loadFromUrl : ' + url ); |
58 | 59 | |
59 | 60 | // Try for direct load ( api cross domain loading is handled outside of SmilInterface |
60 | | - $j.get( url, function( data ) { |
| 61 | + $j.get( url, function( data ) { |
61 | 62 | _this.loadFromString( data ); |
62 | 63 | // XXX check success or failure |
63 | 64 | callback(); |
— | — | @@ -71,6 +72,8 @@ |
72 | 73 | // Load the parsed string into the local "dom" |
73 | 74 | this.$dom = $j( smilXmlString ); |
74 | 75 | |
| 76 | + mw.log( "Smil::loadFromString: loaded smil dom: " + this.$dom ); |
| 77 | + |
75 | 78 | // Clear out the layout |
76 | 79 | this.layout = null; |
77 | 80 | |
— | — | @@ -79,6 +82,9 @@ |
80 | 83 | |
81 | 84 | // Clear out the top level duration |
82 | 85 | this.duration = null; |
| 86 | + |
| 87 | + // Clear out the "buffer" object |
| 88 | + this.buffer = null; |
83 | 89 | }, |
84 | 90 | |
85 | 91 | /** |
— | — | @@ -101,11 +107,34 @@ |
102 | 108 | */ |
103 | 109 | getHtmlDOM: function ( size, time, callback ){ |
104 | 110 | mw.log("getHtmlDOM:: " + size.width + ' time: ' + time); |
105 | | - |
| 111 | + |
106 | 112 | // Have the layout object return the layout HTML DOM |
107 | 113 | return this.getLayout().getHtmlDOM( size, time ); |
108 | 114 | }, |
109 | 115 | |
| 116 | + renderTime: function( time, callback ) { |
| 117 | + // Get the render target: |
| 118 | + var $renderTarget = this.embedPlayer.getRenderTarget(); |
| 119 | + |
| 120 | + // Add the core layout ( not time based ) |
| 121 | + $renderTarget.append( |
| 122 | + this.getLayout().getHtml() |
| 123 | + ) |
| 124 | + |
| 125 | + // Update the render target with bodyElements for the requested time |
| 126 | + this.getBody().renderTime( time ); |
| 127 | + |
| 128 | + // Wait until buffer is ready |
| 129 | + this.checkBufferTimeReady( time, callback ); |
| 130 | + }, |
| 131 | + |
| 132 | + getBuffer: function(){ |
| 133 | + if( ! this.buffer ) { |
| 134 | + this.buffer = new mw.SmilBuffer( this ) ; |
| 135 | + } |
| 136 | + return this.buffer; |
| 137 | + }, |
| 138 | + |
110 | 139 | /** |
111 | 140 | * Function called continuously to keep sync smil "in sync" |
112 | 141 | */ |
— | — | @@ -136,7 +165,7 @@ |
137 | 166 | /** |
138 | 167 | * Get the duration form the |
139 | 168 | */ |
140 | | - getDuration: function(){ |
| 169 | + getDuration: function(){ |
141 | 170 | // return 0 while we don't have the $dom loaded |
142 | 171 | if( !this.$dom ){ |
143 | 172 | return 0; |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilHooks.js |
— | — | @@ -31,14 +31,13 @@ |
32 | 32 | |
33 | 33 | // Setup the "embedCode" binding to swap in an updated url |
34 | 34 | $j( embedPlayer ).bind( 'checkPlayerSourcesEvent', function( event, callback ) { |
35 | | - mw.log(" smil enter checkPlayerSources"); |
| 35 | + mw.log( " smil enter checkPlayerSources" ); |
36 | 36 | // Get the first smil source: |
37 | | - mw.log(" SOURCE IS: " + embedPlayer.mediaElement.getSources( 'application/smil' )[0].getSrc() ); |
38 | | - embedPlayer.smil = new mw.Smil(); |
| 37 | + mw.log( "Source is: " + embedPlayer.mediaElement.getSources( 'application/smil' )[0].getSrc() ); |
| 38 | + embedPlayer.smil = new mw.Smil( embedPlayer ); |
39 | 39 | |
40 | 40 | // Load the smil url as part of "source check" |
41 | 41 | embedPlayer.smil.loadFromUrl( embedPlayer.mediaElement.getSources( 'application/smil' )[0].getSrc(), function(){ |
42 | | - mw.log(" DONE LOAING SMIL FROM UDL"); |
43 | 42 | callback(); |
44 | 43 | }); |
45 | 44 | } ); |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js |
— | — | @@ -11,6 +11,9 @@ |
12 | 12 | // Instance Name |
13 | 13 | instanceOf: 'Smil', |
14 | 14 | |
| 15 | + // The jQuery target location to render smil html |
| 16 | + $renderTarget: null, |
| 17 | + |
15 | 18 | // Player supported feature set |
16 | 19 | supports: { |
17 | 20 | 'playHead' : true, |
— | — | @@ -27,37 +30,54 @@ |
28 | 31 | */ |
29 | 32 | doEmbedPlayer: function() { |
30 | 33 | var _this = this; |
31 | | - // Set "loading" here: |
32 | | - $j( this ).html( |
33 | | - $j( '<div />') |
34 | | - .attr('id', 'smilCanvas_' + this.id ) |
35 | | - .css( { |
36 | | - 'width' : '100%', |
37 | | - 'height' : '100%', |
38 | | - 'position' : 'relative' |
39 | | - }) |
40 | | - ); |
41 | | - |
42 | | - // Update the embed player |
| 34 | + mw.log("EmbedPlayerSmil::doEmbedPlayer: " + this.id ) ; |
| 35 | + |
| 36 | + // Set "loading" spinner here) |
| 37 | + |
| 38 | + // Update the embed player by rending time zero: |
43 | 39 | this.getSmil( function( smil ){ |
44 | | - // XXX might want to move this into mw.SMIL |
45 | | - $j( _this ).html( |
46 | | - smil.getHtmlDOM( { |
47 | | - 'width': _this.getWidth(), |
48 | | - 'height': _this.getHeight() |
49 | | - } ) |
50 | | - ) |
51 | | - }); |
| 40 | + mw.log("EmbedPlayer:: smil loaded " ); |
| 41 | + // Render the first frame |
| 42 | + smil.renderTime( 0, function(){ |
| 43 | + mw.log("EmbedPlayerSmil::doEmbedPlayer:: render callback ready " ); |
| 44 | + } ); |
| 45 | + }); |
52 | 46 | }, |
53 | 47 | |
54 | 48 | /** |
| 49 | + * Return the render target for output of smil html |
| 50 | + */ |
| 51 | + getRenderTarget: function(){ |
| 52 | + if( !this.$renderTarget ){ |
| 53 | + if( $j('#smilCanvas_' + this.id ).length === 0 ) { |
| 54 | + // if no render target exist create one: |
| 55 | + $j( this ).html( |
| 56 | + $j( '<div />') |
| 57 | + .attr('id', 'smilCanvas_' + this.id ) |
| 58 | + .css( { |
| 59 | + 'width' : '100%', |
| 60 | + 'height' : '100%', |
| 61 | + 'position' : 'relative' |
| 62 | + }) |
| 63 | + ); |
| 64 | + } |
| 65 | + this.$renderTarget = $j('#smilCanvas_' + this.id ); |
| 66 | + } |
| 67 | + return this.$renderTarget; |
| 68 | + |
| 69 | + }, |
| 70 | + |
| 71 | + play: function(){ |
| 72 | + mw.log("EmbedPlayerSmil::play (not yet supported)" ); |
| 73 | + }, |
| 74 | + /** |
55 | 75 | * Get the smil object. If the smil object does not exist create one with the source url: |
56 | 76 | * @param callback |
57 | 77 | */ |
58 | 78 | getSmil: function( callback ){ |
59 | 79 | if( !this.smil ) { |
60 | 80 | // Create the Smil engine object |
61 | | - this.smil = new mw.Smil(); |
| 81 | + this.smil = new mw.Smil( this ); |
62 | 82 | |
63 | 83 | // Load the smil |
64 | 84 | this.smil.loadFromUrl( this.getSrc(), function(){ |
— | — | @@ -71,9 +91,11 @@ |
72 | 92 | /** |
73 | 93 | * Get the duration of smil document. |
74 | 94 | */ |
75 | | - getDuration: function(){ |
| 95 | + getDuration: function(){ |
76 | 96 | if( this.smil ){ |
77 | 97 | return this.smil.getDuration(); |
| 98 | + } else { |
| 99 | + return this.parent_getDuration(); |
78 | 100 | } |
79 | 101 | }, |
80 | 102 | |
— | — | @@ -94,7 +116,7 @@ |
95 | 117 | this.parent_updateThumbnailHTML(); |
96 | 118 | return ; |
97 | 119 | } |
98 | | - // If no thumb could be generated use the first frame of smil: |
| 120 | + // If no thumb could be found use the first frame of smil: |
99 | 121 | this.doEmbedPlayer(); |
100 | 122 | }, |
101 | 123 | |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js |
— | — | @@ -0,0 +1,28 @@ |
| 2 | +/** |
| 3 | +* Hanndles buffer information for the smilObject |
| 4 | +*/ |
| 5 | + |
| 6 | +mw.SmilBuffer = function( smilObject ){ |
| 7 | + return this.init( smilObject ); |
| 8 | +} |
| 9 | + |
| 10 | +mw.SmilBuffer.prototype = { |
| 11 | + // Constructor: |
| 12 | + init: function( smilObject ) { |
| 13 | + this.smil = smilObject; |
| 14 | + }, |
| 15 | + |
| 16 | + /** |
| 17 | + * Runs a callback once the buffer time is ready. |
| 18 | + */ |
| 19 | + bufferTimeReady: function( time, callback ) { |
| 20 | + // Get active body elements |
| 21 | + var activeElements = this.smil.getBody().getElementsForTime( time ); |
| 22 | + // Check load status per temporal offset |
| 23 | + |
| 24 | + // setTimeout to call self untill ready |
| 25 | + |
| 26 | + // temp hack ( assume ready ): |
| 27 | + callback(); |
| 28 | + } |
| 29 | +} |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 30 | + native |
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | |
80 | 80 | mw.log( 'SwarmTransport:: lookup torrent url: ' + mw.getConfig( 'SwarmTransport.torrentLookupUrl' ) ); |
81 | 81 | // Setup function to run in context based on callback result |
82 | | - $j.getJSON( |
| 82 | + $j.getJSON( |
83 | 83 | mw.getConfig( 'SwarmTransport.torrentLookupUrl' ) + '?jsonp=?', |
84 | 84 | torrentLookupRequest, |
85 | 85 | function( data ){ |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -1707,7 +1707,8 @@ |
1708 | 1708 | |
1709 | 1709 | // Load the selected player |
1710 | 1710 | this.selectedPlayer.load( function() { |
1711 | | - mw.log( _this.selectedPlayer.library + " player loaded for " + _this.id ); |
| 1711 | + mw.log( 'EmbedPlayer:: ' + _this.selectedPlayer.library + " player loaded for " + _this.id ); |
| 1712 | + |
1712 | 1713 | // Get embed library player Interface |
1713 | 1714 | var playerInterface = mw[ 'EmbedPlayer' + _this.selectedPlayer.library ]; |
1714 | 1715 | |
— | — | @@ -1716,13 +1717,15 @@ |
1717 | 1718 | _this['parent_' + method] = _this[method]; |
1718 | 1719 | } |
1719 | 1720 | _this[ method ] = playerInterface[method]; |
1720 | | - } |
| 1721 | + } |
| 1722 | + |
1721 | 1723 | // Update feature support |
1722 | 1724 | _this.updateFeatureSupport(); |
1723 | 1725 | |
1724 | 1726 | _this.getDuration(); |
| 1727 | + |
1725 | 1728 | _this.showPlayer(); |
1726 | | - // Call the global player mannager to inform this video interface is 100% ready: |
| 1729 | + // Call the global player manager to inform this video interface is ready: |
1727 | 1730 | mw.playerManager.playerReady( _this ); |
1728 | 1731 | |
1729 | 1732 | // Run the callback if provided |
— | — | @@ -1977,7 +1980,7 @@ |
1978 | 1981 | * Show the player |
1979 | 1982 | */ |
1980 | 1983 | showPlayer : function () { |
1981 | | - mw.log( 'Show player: ' + this.id ); |
| 1984 | + mw.log( 'EmbedPlayer:: Show player: ' + this.id ); |
1982 | 1985 | var _this = this; |
1983 | 1986 | // Set-up the local controlBuilder instance: |
1984 | 1987 | this.controlBuilder = new mw.PlayerControlBuilder( this ); |