r60486 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60485‎ | r60486 | r60487 >
Date:01:28, 30 December 2009
Author:dale
Status:deferred
Tags:
Comment:
* embedPlayer refactoring
* sequencer enhancements
* firefogg render cleanup
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.FirefoggRender.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.PlayList.js (replaced) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.PlayList.new.js (deleted) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/playListEmbed.js (added) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/remotes/RemoteMwTimedText.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/kskin/playerSkin.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/mvpcf/playerSkin.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/tests/Playlist_Render.html (added) (history)
  • /branches/js2-work/phase3/js/mwEmbed/tests/Sequence_Render.html (deleted) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/tests/Sequence_Render.html
@@ -1,68 +0,0 @@
2 -<!doctype html>
3 -<html>
4 -<head>
5 - <title>Seeking Render Example</title>
6 - <script type="text/javascript" src="../mwEmbed.js?debug=true"></script>
7 - <style>
8 - #render_box {
9 - position:absolute;
10 - width:320px;
11 - height:240px;
12 - }
13 -
14 - </style>
15 - <script>
16 -mw.ready(function(){
17 -
18 - $j('#render_player').firefoggRender({
19 - 'render_options':{
20 - "framerate" : 30
21 - },
22 - 'target_startRender':'#buttonStart',
23 - 'target_stopRender': '#buttonStop',
24 - 'target_timeStatus': '#time_status'
25 -
26 - },function( foggRender ){
27 - $j('#loading_text').hide();
28 - if( foggRender.enabled ){
29 - $j('#info_control').show();
30 - }else{
31 - $j('#info_control').html(
32 - foggRender.myFogg.getTargetHtml('target_please_install')
33 - );
34 - if(!($j.browser.mozilla && $j.browser.version >= '1.9.1')) {
35 - $j('#info_control').html(
36 - foggRender.myFogg.getTargetHtml('target_use_latest_fox')
37 - );
38 - }
39 - }
40 - });
41 -
42 -});
43 - </script>
44 -</head>
45 -<body>
46 -<playlist id="render_player" src="media/sample_smil.xml" controls="false" width="320" height="240"></playlist>
47 -
48 -<!-- <video id="render_player"
49 - durationHint="27"
50 - src="http://upload.wikimedia.org/wikipedia/commons/4/41/Panthera_tigris8.ogg"
51 - style="width:320px;height:240px;"
52 - controls="false"
53 - poster="http://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Panthera_tigris8.ogg/mid-Panthera_tigris8.ogg.jpg">
54 -</video>
55 -
56 -
57 -<span id="loading_text" style="position:absolute; top:320px;">
58 -loading render system <blink>...</blink>
59 -</span>
60 -<div id="info_control" style="display:none;">
61 - <button id="buttonStart">Do Render</button>
62 - <button id="buttonStop">Stop</button>
63 - Current Time: <input type="text" id="time_status" value="0.0" />
64 - <span id="status"></span><br>
65 -</div>
66 -
67 -</body>
68 -</html>
Index: branches/js2-work/phase3/js/mwEmbed/tests/Playlist_Render.html
@@ -0,0 +1,71 @@
 2+<!doctype html>
 3+<html>
 4+<head>
 5+ <title>Seeking Render Example</title>
 6+ <script type="text/javascript" src="../mwEmbed.js?debug=true"></script>
 7+ <style>
 8+ #render_box {
 9+ position:absolute;
 10+ width:320px;
 11+ height:240px;
 12+ }
 13+
 14+ </style>
 15+ <script>
 16+mw.ready(function(){
 17+ mw.load('FirefoggRender',function(){
 18+
 19+ var foggRender = $j( '#render_player' ).firefoggRender({
 20+ 'render_options':{
 21+ "framerate" : 30
 22+ },
 23+ 'target_startRender':'#buttonStart',
 24+ 'target_stopRender': '#buttonStop',
 25+ 'target_timeStatus': '#time_status'
 26+ });
 27+
 28+ $j('#loading_text').hide();
 29+ if( foggRender.enabled ){
 30+ $j('#info_control').show();
 31+ }else{
 32+ $j('#info_control').html(
 33+ foggRender.myFogg.getTargetHtml('target_please_install')
 34+ );
 35+ if(!($j.browser.mozilla && $j.browser.version >= '1.9.1')) {
 36+ $j('#info_control').html(
 37+ foggRender.myFogg.getTargetHtml('target_use_latest_fox')
 38+ );
 39+ }
 40+ }
 41+
 42+ });
 43+
 44+});
 45+ </script>
 46+</head>
 47+<body>
 48+<!-- <playlist id="render_player" src="media/sample_smil.xml" controls="false" width="320" height="240"></playlist> -->
 49+
 50+
 51+<video id="render_player"
 52+ durationHint="5"
 53+ src="http://upload.wikimedia.org/wikipedia/commons/4/41/Panthera_tigris8.ogg"
 54+ style="width:320px;height:240px;"
 55+ controls="false"
 56+ poster="http://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Panthera_tigris8.ogg/mid-Panthera_tigris8.ogg.jpg">
 57+</video>
 58+
 59+
 60+<span id="loading_text" style="position:absolute; top:320px;">
 61+loading render system <blink>...</blink>
 62+</span>
 63+<br><br>
 64+<div id="info_control" style="display:none;">
 65+ <button id="buttonStart">Do Render</button>
 66+ <button id="buttonStop">Stop</button>
 67+ Current Time: <input type="text" id="time_status" value="0.0" />
 68+ <span id="status"></span><br>
 69+</div>
 70+
 71+</body>
 72+</html>
Property changes on: branches/js2-work/phase3/js/mwEmbed/tests/Playlist_Render.html
___________________________________________________________________
Name: svn:mergeinfo
173 + /branches/REL1_15/phase3/js2/mwEmbed/example_usage/Sequence_Render.html:51646
/branches/sqlite/js2/mwEmbed/example_usage/Sequence_Render.html:58211-58321
Name: svn:eol-style
274 + native
Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js
@@ -56,19 +56,19 @@
5757 'options_menu': {
5858 'w':0,
5959 'o':function( ctrlObj ) {
60 - var embedObj = ctrlObj.embedObj;
 60+ var embedPlayer = ctrlObj.embedPlayer;
6161
6262 // Setup menu offset ( if player height < getOverlayHeight )
63 - var menuOffset = ( embedObj.getPlayerHeight() < ctrlObj.getOverlayHeight() ) ?
64 - 'top:' + ( embedObj.getPlayerHeight() + ctrlObj.getControlBarHeight() ) + 'px;' : '';
 63+ var menuOffset = ( embedPlayer.getPlayerHeight() < ctrlObj.getOverlayHeight() ) ?
 64+ 'top:' + ( embedPlayer.getPlayerHeight() + ctrlObj.getControlBarHeight() ) + 'px;' : '';
6565
6666 // Special common overflow hack:
6767 // NOTE: should re-factor to just append menu to top body when it does not "fit" in the player
6868 if( menuOffset != '' )
69 - $j( embedObj ).parents( '.thumbinner' ).css( 'overflow', 'visible' );
 69+ $j( embedPlayer ).parents( '.thumbinner' ).css( 'overflow', 'visible' );
7070
7171 var o = '' +
72 - '<div id="blackbg_' + embedObj.id +'" class="k-menu ui-widget-content" ' +
 72+ '<div id="blackbg_' + embedPlayer.id +'" class="k-menu ui-widget-content" ' +
7373 'style="width:' + ctrlObj.getOverlayWidth() + 'px; height:' + ctrlObj.getOverlayHeight() + 'px;' + menuOffset + '">' +
7474 '<ul class="k-menu-bar">';
7575 // Output menu item containers:
@@ -97,25 +97,25 @@
9898 * Get minimal width for interface overlay
9999 */
100100 getOverlayWidth: function(){
101 - return ( this.embedObj.getPlayerWidth() < 200 )? 200 : this.embedObj.getPlayerWidth();
 101+ return ( this.embedPlayer.getPlayerWidth() < 200 )? 200 : this.embedPlayer.getPlayerWidth();
102102 },
103103
104104 /**
105105 * Get minimal height for interface overlay
106106 */
107107 getOverlayHeight: function(){
108 - return ( this.embedObj.getPlayerHeight() < 160 )? 160 : this.embedObj.getPlayerHeight();
 108+ return ( this.embedPlayer.getPlayerHeight() < 160 )? 160 : this.embedPlayer.getPlayerHeight();
109109 },
110110
111111 /**
112112 * Adds the skin Control Bindings
113113 */
114114 addSkinControlBindings: function() {
115 - var embedObj = this.embedObj;
 115+ var embedPlayer = this.embedPlayer;
116116 var _this = this;
117117
118118 // Set up control bar pointer
119 - var $playerTarget = embedObj.$target;
 119+ var $playerTarget = embedPlayer.$interface;
120120
121121 // Options menu display:
122122 $playerTarget.find( '.k-options' )
@@ -123,8 +123,8 @@
124124 .click( function() {
125125 if ( $playerTarget.find( '.k-menu' ).length == 0 ) {
126126 // Stop the player if it does not support overlays:
127 - if ( !embedObj.supports['overlays'] ){
128 - embedObj.stop();
 127+ if ( !embedPlayer.supports['overlays'] ){
 128+ embedPlayer.stop();
129129 }
130130 // Add the menu binding
131131 _this.addMeunBinding();
@@ -154,9 +154,9 @@
155155 */
156156 addMeunBinding: function() {
157157 var _this = this;
158 - var embedObj = this.embedObj;
 158+ var embedPlayer = this.embedPlayer;
159159 // Set local player target pointer:
160 - var $playerTarget = embedObj.$target;
 160+ var $playerTarget = embedPlayer.$interface;
161161
162162 // check if k-menu already exists:
163163 if ( $playerTarget.find( '.k-menu' ).length != 0 )
@@ -197,14 +197,14 @@
198198 * @param {String} menu_itme Menu item key to display
199199 */
200200 showMenuItem:function( menu_item ) {
201 - var embedObj = this.embedObj;
 201+ var embedPlayer = this.embedPlayer;
202202 //handle special k-skin specific display;
203203 if( menu_item == 'credits'){
204204 this.showCredits();
205205 }else{
206 - // Call the base embedObj "show{Item}"
207 - this.embedObj['show' + menu_item.charAt( 0 ).toUpperCase() + menu_item.substring( 1 )](
208 - embedObj.$target.find( '.menu-' + menu_item )
 206+ // Call the base embedPlayer "show{Item}"
 207+ this.embedPlayer['show' + menu_item.charAt( 0 ).toUpperCase() + menu_item.substring( 1 )](
 208+ embedPlayer.$interface.find( '.menu-' + menu_item )
209209 );
210210 }
211211 },
@@ -221,9 +221,9 @@
222222 */
223223 showCredits: function() {
224224 //set up the shortcuts:
225 - embedObj = this.embedObj;
 225+ embedPlayer = this.embedPlayer;
226226 var _this = this;
227 - $target = embedObj.$target.find( '.menu-credits' );
 227+ $target = embedPlayer.$interface.find( '.menu-credits' );
228228
229229 $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' +
230230 '<div class="credits_box ui-corner-all">' +
@@ -243,7 +243,7 @@
244244 );
245245 }
246246
247 - if( !embedObj.wikiTitleKey ){
 247+ if( !embedPlayer.wikiTitleKey ){
248248 $target.find('.credits_box').text(
249249 'Error: no title key to grab credits with'
250250 );
@@ -253,7 +253,7 @@
254254 // Do the api request to populate the credits via the wikiTitleKey ( tied to "commons" )
255255 var request = {
256256 // Normalize the File NS (ie sometimes its present in wikiTitleKey other times not
257 - 'titles' : 'File:' + embedObj.wikiTitleKey.replace(/File:|Image:/, '' ),
 257+ 'titles' : 'File:' + embedPlayer.wikiTitleKey.replace(/File:|Image:/, '' ),
258258 'prop' : 'revisions',
259259 'rvprop' : 'content'
260260 };
@@ -261,7 +261,7 @@
262262 mw.getJSON( mw.commons_api_url, request, function( data ) {
263263 if( !data || !data.query || !data.query.pages ){
264264 $target.find('.credits_box').text(
265 - 'Error: title key: ' + embedObj.wikiTitleKey + ' not found'
 265+ 'Error: title key: ' + embedPlayer.wikiTitleKey + ' not found'
266266 );
267267 return false;
268268 }
@@ -285,11 +285,11 @@
286286 * @parm {String} wikiText Resource wiki text page contents
287287 */
288288 doCreditLineFromWikiText: function ( wikiText ){
289 - var embedObj = this.embedObj;
 289+ var embedPlayer = this.embedPlayer;
290290
291291 // Get the title str
292 - var titleStr = embedObj.wikiTitleKey.replace(/_/g, ' ');
293 - var titleLink = 'http://commons.wikimedia.org/wiki/File:' + embedObj.wikiTitleKey;
 292+ var titleStr = embedPlayer.wikiTitleKey.replace(/_/g, ' ');
 293+ var titleLink = 'http://commons.wikimedia.org/wiki/File:' + embedPlayer.wikiTitleKey;
294294
295295 var imgWidth = ( this.getOverlayWidth() < 250 )? 45 : 90;
296296
@@ -302,10 +302,10 @@
303303 }).html(
304304 $j('<img/>').attr( {
305305 'border': 0,
306 - 'src' : embedObj.thumbnail
 306+ 'src' : embedPlayer.thumbnail
307307 } ).css( {
308308 'width' : imgWidth,
309 - 'height': parseInt( imgWidth * ( embedObj.height / embedObj.width ) )
 309+ 'height': parseInt( imgWidth * ( embedPlayer.height / embedPlayer.width ) )
310310 } )
311311 )
312312 )
Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/playerSkin.css
@@ -2,7 +2,7 @@
33 * K-skin player
44 */
55 .k-player {
6 - color: white;
 6+ color: #FFF;
77 }
88
99 /* large play button */
@@ -95,6 +95,7 @@
9696 top: 0;
9797 width: 8px;
9898 cursor: pointer;
 99+ -moz-border-radius:5px 5px 5px 5px;
99100 }
100101
101102 .k-player .time-disp {
Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js
@@ -6,8 +6,8 @@
77 * ctrlBuilder object
88 * @param the embedPlayer element we are targeting
99 */
10 -var ctrlBuilder = function( embedObj, options ) {
11 - return this.init( embedObj, options );
 10+var ctrlBuilder = function( embedPlayer, options ) {
 11+ return this.init( embedPlayer, options );
1212 };
1313
1414 /*
@@ -31,7 +31,7 @@
3232 // Default control bar height is 29
3333 height: 29,
3434
35 - // Default supported componets is merged with embedObject supported types
 35+ // Default supported components is merged with embedPlayerect supported types
3636 supportedComponets: {
3737 'options':true,
3838 'borders':true
@@ -39,17 +39,17 @@
4040 /**
4141 * Initialization Object for the control builder
4242 *
43 - * @param {Object} embedObj EmbedPlayer interface
 43+ * @param {Object} embedPlayer EmbedPlayer interface
4444 */
45 - init: function( embedObj ) {
 45+ init: function( embedPlayer ) {
4646 var _this = this;
47 - this.embedObj = embedObj;
 47+ this.embedPlayer = embedPlayer;
4848
4949 // Check for skin overrides for ctrlBuilder
50 - if ( window[ embedObj.skinName + 'Config'] ) {
 50+ if ( window[ embedPlayer.skinName + 'Config'] ) {
5151
5252 // Clone as to not override prototype:
53 - var _this = $j.extend( true, { }, this, window[ embedObj.skinName + 'Config'] );
 53+ var _this = $j.extend( true, { }, this, window[ embedPlayer.skinName + 'Config'] );
5454
5555 return _this;
5656 }
@@ -61,34 +61,61 @@
6262 * Get the controls html
6363 * @return {String} html output of controls
6464 */
65 - getControls: function() {
66 - // Set up local pointer to the embedObj
67 - var embedObj = this.embedObj;
68 - // set up local ctrlBuilder
 65+ addControls: function() {
 66+ // Set up local pointer to the embedPlayer
 67+ var embedPlayer = this.embedPlayer;
 68+
 69+ // Set up local ctrlBuilder
6970 var _this = this;
7071
 72+ // Remove any old controls:
 73+ embedPlayer.$interface.find('.control-bar').remove();
 74+
 75+ // Add some space to control_wrap for the controls
 76+ embedPlayer.$interface.css({
 77+ 'height' : parseInt( embedPlayer.height + this.height)
 78+ });
 79+ embedPlayer.$interface.append(
 80+ $j('<div>')
 81+ .addClass( 'ui-state-default ui-widget-header ui-helper-clearfix control-bar' )
 82+ .html(
 83+ this.buildControls()
 84+ )
 85+ );
 86+ // Add hooks once Controls are in DOM
 87+ this.addControlHooks();
 88+ },
 89+
 90+ /**
 91+ * Builds the interface controls
 92+ * @returns the interface html string
 93+ */
 94+ buildControls: function(){
 95+ var _this = this;
7196 mw.log( 'f:controlsBuilder:: opt:' + this.options );
72 - this.id = ( embedObj.pc ) ? embedObj.pc.pp.id:embedObj.id;
73 - this.available_width = embedObj.getPlayerWidth();
 97+ // Set up local pointer to the embedPlayer
 98+ var embedPlayer = this.embedPlayer;
7499
75 - // Make pointer to the embedObj
76 - this.embedObj = embedObj;
 100+ this.available_width = embedPlayer.getPlayerWidth();
 101+
 102+ // Make pointer to the embedPlayer
 103+ this.embedPlayer = embedPlayer;
77104 var _this = this;
78 - this.supportedComponets = $j.extend(this.supportedComponets, embedObj.supports);
 105+ this.supportedComponets = $j.extend(this.supportedComponets, embedPlayer.supports);
79106
80 - //Check for timed text support:
81 - if( embedObj.isTimedTextSupported() ){
 107+ // Check for timed text support:
 108+ if( embedPlayer.isTimedTextSupported() ){
82109 this.supportedComponets['timed_text'] = true;
83110 }
84111
85112 // Append options to body (if not already there)
86 - if ( _this.external_options && $j( '#mv_vid_options_' + this.id ).length == 0 ){
 113+ if ( this.external_options && $j( '#mv_vid_options_' + this.id ).length == 0 ){
87114 $j( 'body' ).append( this.components[ 'options_menu' ].o( this ) );
88115 }
89116
90 - var o = '';
 117+ var s = '';
91118
92 - //Build component output:
 119+ // Build component output:
93120 for ( var i in this.components ) {
94121 // Make sure the given components is supported:
95122 if ( this.supportedComponets[ i ] ) {
@@ -96,27 +123,27 @@
97124 // Special case with playhead don't add unless we have 50px
98125 if ( i == 'play_head' && this.available_width < 50 )
99126 continue;
100 - o += this.components[i].o( this );
 127+ s += this.components[i].o( this );
101128 this.available_width -= this.components[i].w;
102129 } else {
103130 mw.log( 'not enough space for control component:' + i );
104131 }
105132 }
106133 }
107 - return o;
 134+ return s;
108135 },
109136
110137 /**
111138 * Get minimal width for interface overlay
112139 */
113140 getOverlayWidth: function(){
114 - return ( this.embedObj.getPlayerWidth() < 300 )? 300 : this.embedObj.getPlayerWidth();
 141+ return ( this.embedPlayer.getPlayerWidth() < 300 )? 300 : this.embedPlayer.getPlayerWidth();
115142 },
116143 /**
117144 * Get minimal height for interface overlay
118145 */
119146 getOverlayHeight: function(){
120 - return ( this.embedObj.getPlayerHeight() < 200 )? 200 : this.embedObj.getPlayerHeight();
 147+ return ( this.embedPlayer.getPlayerHeight() < 200 )? 200 : this.embedPlayer.getPlayerHeight();
121148 },
122149
123150 /**
@@ -131,36 +158,37 @@
132159 * Adds control hooks once controls are in the DOM
133160 */
134161 addControlHooks:function( ) {
135 - // Set up local pointer to the embedObj
136 - var embedObj = this.embedObj;
137 - var _this = this;
 162+ // Set up local pointer to the embedPlayer
 163+ var embedPlayer = this.embedPlayer;
 164+ var _this = this;
 165+
138166 // Setup target shortcut to control-bar
139 - $target = embedObj.$target;
 167+ $target = embedPlayer.$interface;
140168
141169 // Add play hook:
142170 $target.find( '.play-btn,.play-btn-large' ).unbind().buttonHover().click( function() {
143 - embedObj.play();
 171+ embedPlayer.play();
144172 } );
145173
146174 // Add recommend firefox if we have non-native playback:
147175 if ( _this.doNativeWarningCheck() ) {
148 - $j( '#dc_' + embedObj.id ).hover(
 176+ $j( '#dc_' + embedPlayer.id ).hover(
149177 function() {
150 - if ( $j( '#gnp_' + embedObj.id ).length == 0 ) {
151 - var toppos = ( embedObj.instanceOf == 'mvPlayList' ) ? 25 : 10;
152 - $j( this ).append( '<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
 178+ if ( $j( '#gnp_' + embedPlayer.id ).length == 0 ) {
 179+ var toppos = ( embedPlayer.instanceOf == 'mvPlayList' ) ? 25 : 10;
 180+ $j( this ).append( '<div id="gnp_' + embedPlayer.id + '" class="ui-state-highlight ui-corner-all" ' +
153181 'style="position:absolute;display:none;background:#FFF;top:' + toppos + 'px;left:10px;right:10px;">' +
154182 gM( 'mwe-for_best_experience' ) +
155 - '<br><input id="ffwarn_' + embedObj.id + '" type=\"checkbox\">' +
 183+ '<br><input id="ffwarn_' + embedPlayer.id + '" type=\"checkbox\">' +
156184 gM( 'mwe-do_not_warn_again' ) +
157185 '</div>' );
158 - $j( '#ffwarn_' + embedObj.id ).click( function() {
 186+ $j( '#ffwarn_' + embedPlayer.id ).click( function() {
159187 if ( $j( this ).is( ':checked' ) ) {
160188 // Set up a cookie for 7 days:
161189 $j.cookie( 'show_player_warning', false, { expires: 7 } );
162190 // Set the current instance
163191 mw.setConfig( 'show_player_warning', false );
164 - $j( '#gnp_' + embedObj.id ).fadeOut( 'slow' );
 192+ $j( '#gnp_' + embedPlayer.id ).fadeOut( 'slow' );
165193 } else {
166194 mw.setConfig( 'show_player_warning', true );
167195 $j.cookie( 'show_player_warning', true );
@@ -170,32 +198,32 @@
171199 }
172200 // Only show the warning if cookie and config are true
173201 if ( mw.getConfig( 'show_player_warning' ) === true )
174 - $j( '#gnp_' + embedObj.id ).fadeIn( 'slow' );
 202+ $j( '#gnp_' + embedPlayer.id ).fadeIn( 'slow' );
175203 },
176204 function() {
177 - $j( '#gnp_' + embedObj.id ).fadeOut( 'slow' );
 205+ $j( '#gnp_' + embedPlayer.id ).fadeOut( 'slow' );
178206 }
179207 );
180208 }
181209
182210 if ( $j.browser.msie && $j.browser.version <= 6 ) {
183 - $j( embedObj.id + ' .play-btn-large' ).pngFix();
 211+ $j( embedPlayer.id + ' .play-btn-large' ).pngFix();
184212 }
185213
186214
187215 // Captions binding:
188216 $target.find( '.timed-text' ).unbind().buttonHover().click( function() {
189 - embedObj.showTextInterface();
 217+ embedPlayer.showTextInterface();
190218 } );
191219
192220 // Options binding:
193221 $target.find( '.options-btn' ).unbind().buttonHover().click( function() {
194 - embedObj.doOptionsHTML();
 222+ embedPlayer.doOptionsHTML();
195223 } );
196224
197225 // Fullscreen binding:
198226 $target.find( '.fullscreen-btn' ).unbind().buttonHover().click( function() {
199 - embedObj.fullscreen();
 227+ embedPlayer.fullscreen();
200228 } );
201229
202230 // Playhead binding
@@ -206,42 +234,42 @@
207235 min: 0,
208236 max: 1000,
209237 start: function( event, ui ) {
210 - var id = ( embedObj.pc != null ) ? embedObj.pc.pp.id:embedObj.id;
211 - embedObj.userSlide = true;
 238+ var id = ( embedPlayer.pc != null ) ? embedPlayer.pc.pp.id:embedPlayer.id;
 239+ embedPlayer.userSlide = true;
212240 $j( id + ' .play-btn-large' ).fadeOut( 'fast' );
213241 // If playlist always start at 0
214 - embedObj.start_time_sec = ( embedObj.instanceOf == 'mvPlayList' ) ? 0:
215 - mw.npt2seconds( embedObj.getTimeRange().split( '/' )[0] );
 242+ embedPlayer.start_time_sec = ( embedPlayer.instanceOf == 'mvPlayList' ) ? 0:
 243+ mw.npt2seconds( embedPlayer.getTimeRange().split( '/' )[0] );
216244 },
217245 slide: function( event, ui ) {
218246 var perc = ui.value / 1000;
219 - embedObj.jump_time = mw.seconds2npt( parseFloat( parseFloat( embedObj.getDuration() ) * perc ) + embedObj.start_time_sec );
220 - // mw.log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time);
 247+ embedPlayer.jump_time = mw.seconds2npt( parseFloat( parseFloat( embedPlayer.getDuration() ) * perc ) + embedPlayer.start_time_sec );
 248+ // mw.log('perc:' + perc + ' * ' + embedPlayer.getDuration() + ' jt:'+ this.jump_time);
221249 if ( _this.long_time_disp ) {
222 - embedObj.setStatus( gM( 'mwe-seek_to', embedObj.jump_time ) );
 250+ embedPlayer.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) );
223251 } else {
224 - embedObj.setStatus( embedObj.jump_time );
 252+ embedPlayer.setStatus( embedPlayer.jump_time );
225253 }
226254 // Update the thumbnail / frame
227 - if ( embedObj.isPlaying == false ) {
228 - embedObj.updateThumbPerc( perc );
 255+ if ( embedPlayer.isPlaying == false ) {
 256+ embedPlayer.updateThumbPerc( perc );
229257 }
230258 },
231259 change:function( event, ui ) {
232260 // Only run the onChange event if done by a user slide
233261 // (otherwise it runs times it should not)
234 - if ( embedObj.userSlide ) {
235 - embedObj.userSlide = false;
236 - embedObj.seeking = true;
 262+ if ( embedPlayer.userSlide ) {
 263+ embedPlayer.userSlide = false;
 264+ embedPlayer.seeking = true;
237265 // Stop the monitor timer (if we can)
238 - embedObj.stopMonitor();
 266+ embedPlayer.stopMonitor();
239267
240268 var perc = ui.value / 1000;
241269 // set seek time (in case we have to do a url seek)
242 - embedObj.seek_time_sec = mw.npt2seconds( embedObj.jump_time, true );
243 - mw.log( 'do jump to: ' + embedObj.jump_time + ' perc:' + perc + ' sts:' + embedObj.seek_time_sec );
244 - embedObj.setStatus( gM( 'mwe-seeking' ) );
245 - embedObj.doSeek( perc );
 270+ embedPlayer.seek_time_sec = mw.npt2seconds( embedPlayer.jump_time, true );
 271+ mw.log( 'do jump to: ' + embedPlayer.jump_time + ' perc:' + perc + ' sts:' + embedPlayer.seek_time_sec );
 272+ embedPlayer.setStatus( gM( 'mwe-seeking' ) );
 273+ embedPlayer.doSeek( perc );
246274 }
247275 }
248276 } );
@@ -254,26 +282,26 @@
255283 //(we can probably refactor this with custom buffering highlighter)
256284 $target.find( '.play_head' ).append( this.getBufferHtml() );
257285
258 - var $opt = $j( '#mv_vid_options_' + embedObj.id );
 286+ var $opt = $j( '#mv_vid_options_' + embedPlayer.id );
259287
260288 // videoOptions ... @@todo should be merged with something more like kskin.js:
261289 $opt.find( '.vo_selection' ).click( function() {
262 - embedObj.displayOverlay();
263 - embedObj.showPlayerSelect( embedObj.$target.find( '.videoOptionsComplete' ) );
 290+ embedPlayer.displayOverlay();
 291+ embedPlayer.showPlayerSelect( embedPlayer.$interface.find( '.videoOptionsComplete' ) );
264292 $opt.hide();
265293 return false;
266294 } );
267295
268296 $opt.find( '.vo_download' ).click( function() {
269 - embedObj.displayOverlay();
270 - embedObj.showDownload( embedObj.$target.find( '.videoOptionsComplete' ) );
 297+ embedPlayer.displayOverlay();
 298+ embedPlayer.showDownload( embedPlayer.$interface.find( '.videoOptionsComplete' ) );
271299 $opt.hide();
272300 return false;
273301 } );
274302
275303 $opt.find( '.vo_showcode' ).click( function() {
276 - embedObj.displayOverlay();
277 - embedObj.showShare( embedObj.$target.find( '.videoOptionsComplete' ) );
 304+ embedPlayer.displayOverlay();
 305+ embedPlayer.showShare( embedPlayer.$interface.find( '.videoOptionsComplete' ) );
278306 $opt.hide();
279307 return false;
280308 } );
@@ -286,8 +314,7 @@
287315 },
288316
289317 /**
290 - * Issue a warning to non-native playback systems
291 - * that they could improve the playback experience with a different browser
 318+ * check if a warning should be issued to non-native playback systems
292319 *
293320 * dependent on mediaElement being setup
294321 */
@@ -298,7 +325,7 @@
299326 }
300327
301328 // If the resolution is too small don't display the warning
302 - if( this.embedObj.getPlayerHeight() < 199 )
 329+ if( this.embedPlayer.getPlayerHeight() < 199 )
303330 return false;
304331
305332 // See if we have native support for ogg:
@@ -310,9 +337,9 @@
311338 }
312339
313340 // See if we are using mwEmbed without a ogg source in which case no point in promoting firefox :P
314 - if ( this.embedObj.mediaElement && this.embedObj.mediaElement.sources ) {
 341+ if ( this.embedPlayer.mediaElement && this.embedPlayer.mediaElement.sources ) {
315342 var foundOgg = false;
316 - var playable_sources = this.embedObj.mediaElement.getPlayableSources();
 343+ var playable_sources = this.embedPlayer.mediaElement.getPlayableSources();
317344 for ( var sInx = 0; sInx < playable_sources.length; sInx++ ) {
318345 var mime_type = playable_sources[sInx].mime_type;
319346 if ( mime_type == 'video/ogg' ) {
@@ -330,24 +357,23 @@
331358 * Binds the volume controls
332359 */
333360 doVolumeBinding:function() {
334 - var embedObj = this.embedObj;
335 - var _this = this;
336 - var $target = $j( '#' + embedObj.id ).parent('.control_wrap');
337 - $target.find( '.volume_control' ).unbind().buttonHover().click( function() {
 361+ var embedPlayer = this.embedPlayer;
 362+ var _this = this;
 363+ embedPlayer.$interface.find( '.volume_control' ).unbind().buttonHover().click( function() {
338364 mw.log( 'clicked volume control' );
339 - embedObj.toggleMute();
 365+ embedPlayer.toggleMute();
340366 } );
341367
342368 // Add vertical volume display hover
343369 if ( this.volume_layout == 'vertical' ) {
344370 // Default volume binding:
345371 var hoverOverDelay = false;
346 - var $targetvol = $target.find( '.vol_container' );
347 - $target.find( '.volume_control' ).hover(
 372+ var $targetvol = embedPlayer.$interface.find( '.vol_container' );
 373+ embedPlayer.$interface.find( '.volume_control' ).hover(
348374 function() {
349375 $targetvol.addClass( 'vol_container_top' );
350376 // Set to "below" if playing and embedType != native
351 - if ( embedObj && embedObj.isPlaying && embedObj.isPlaying() && !embedObj.supports['overlays'] ) {
 377+ if ( embedPlayer && embedPlayer.isPlaying && embedPlayer.isPlaying() && !embedPlayer.supports['overlays'] ) {
352378 $targetvol.removeClass( 'vol_container_top' ).addClass( 'vol_container_below' );
353379 }
354380 $targetvol.fadeIn( 'fast' );
@@ -373,24 +399,24 @@
374400 slide: function( event, ui ) {
375401 var perc = ui.value / 100;
376402 // mw.log('update volume:' + perc);
377 - embedObj.updateVolumen( perc );
 403+ embedPlayer.updateVolumen( perc );
378404 },
379405 change:function( event, ui ) {
380406 var perc = ui.value / 100;
381407 if ( perc == 0 ) {
382 - $target.find( '.volume_control span' ).removeClass( 'ui-icon-volume-on' ).addClass( 'ui-icon-volume-off' );
 408+ embedPlayer.$interface.find( '.volume_control span' ).removeClass( 'ui-icon-volume-on' ).addClass( 'ui-icon-volume-off' );
383409 } else {
384 - $target.find( '.volume_control span' ).removeClass( 'ui-icon-volume-off' ).addClass( 'ui-icon-volume-on' );
 410+ embedPlayer.$interface.find( '.volume_control span' ).removeClass( 'ui-icon-volume-off' ).addClass( 'ui-icon-volume-on' );
385411 }
386412 var perc = ui.value / 100;
387 - embedObj.updateVolumen( perc );
 413+ embedPlayer.updateVolumen( perc );
388414 }
389415 }
390416
391417 if ( this.volume_layout == 'vertical' )
392418 sliderConf[ 'orientation' ] = "vertical";
393419
394 - $target.find( '.volume-slider' ).slider( sliderConf );
 420+ embedPlayer.$interface.find( '.volume-slider' ).slider( sliderConf );
395421 },
396422
397423 /**
@@ -399,7 +425,7 @@
400426 getBufferHtml:function() {
401427 return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' +
402428 'ui-state-highlight ui-corner-all ' +
403 - 'mv_buffer" style="width:0px;height:100%;z-index:1;top:0px" />';
 429+ 'mw_buffer" style="width:0px;height:100%;z-index:1;top:0px" />';
404430 },
405431
406432 /**
@@ -417,7 +443,7 @@
418444
419445 /**
420446 * Components Object
421 - * Take in the embedObj and return some html for the given component.
 447+ * Take in the embedPlayer and return some html for the given component.
422448 *
423449 * components can be overwritten by skin javascript
424450 */
@@ -435,8 +461,8 @@
436462 'class' : "ui-state-default play-btn-large"
437463 } )
438464 .css( {
439 - 'left' : ( ( ctrlObj.embedObj.getPlayerWidth() - this.w ) / 2 ),
440 - 'top' : ( ( ctrlObj.embedObj.getPlayerHeight() - this.h ) / 2 )
 465+ 'left' : ( ( ctrlObj.embedPlayer.getPlayerWidth() - this.w ) / 2 ),
 466+ 'top' : ( ( ctrlObj.embedPlayer.getPlayerHeight() - this.h ) / 2 )
441467 } )
442468 .wrap( '<div/>' ).parent().html();
443469 }
@@ -461,7 +487,7 @@
462488 '<p class="short_match vo_showcode"><a href="#"><span>' + gM( 'mwe-share' ) + '</span></a></p>';
463489
464490 // link to the stream page if we are not already there:
465 - if ( ( ctrlObj.embedObj.roe || ctrlObj.embedObj.linkback ) && typeof mv_stream_interface == 'undefined' )
 491+ if ( ( ctrlObj.embedPlayer.roe || ctrlObj.embedPlayer.linkback ) && typeof mv_stream_interface == 'undefined' )
466492 o += '<p class="short_match"><a href="javascript:$j(\'#' + ctrlObj.id + '\').get(0).doLinkBack()"><span><strong>Source Page</strong></span></a></p>';
467493
468494 o += '</div>' +
@@ -550,7 +576,7 @@
551577 'time_display': {
552578 'w':90,
553579 'o':function( ctrlObj ) {
554 - return '<div class="ui-widget time-disp">' + ctrlObj.embedObj.getTimeRange() + '</div>';
 580+ return '<div class="ui-widget time-disp">' + ctrlObj.embedPlayer.getTimeRange() + '</div>';
555581 }
556582 },
557583 /*
@@ -559,7 +585,7 @@
560586 'play_head': {
561587 'w':0, // special case (takes up remaining space)
562588 'o':function( ctrlObj ) {
563 - return '<div class="play_head" style="width: ' + ( ctrlObj.available_width - 35 ) + 'px;"></div>';
 589+ return '<div class="play_head" style="width: ' + ( ctrlObj.available_width - 37 ) + 'px;"></div>';
564590 }
565591 }
566592 }
Index: branches/js2-work/phase3/js/mwEmbed/skins/mvpcf/playerSkin.css
@@ -1,6 +1,12 @@
22 /*
33 * reference player skin
44 */
 5+
 6+/*Video player*/
 7+.mv-player {
 8+ color: #000;
 9+ background: #FFF;
 10+}
511
612 /* large play button: */
713 .mv-player .play-btn-large {
@@ -14,11 +20,6 @@
1521 }/*.ui-state-default */
1622
1723
18 -.mv-player
19 -{
20 - color: #474747;
21 -}
22 -
2324 .mv-player a:link {color: #2060c1; text-decoration: underline;}
2425 .mv-player a:visited {color: #2060c1; text-decoration: underline;}
2526 /*a:visited {color: #75a5e4; text-decoration: underline;}*/ /*Not sure if you want this*/
@@ -37,10 +38,7 @@
3839 .mv-player h6 {font-size: 13px; color: #6c6c6c; padding: 10px 20px 0px 20px; text-transform: uppercase;}
3940
4041
41 -/*Video player*/
42 -.mv-player {
43 - color: white;
44 -}
 42+
4543 .mv-player .video {
4644 display: block;
4745 position: relative;
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js
@@ -220,7 +220,7 @@
221221 var _this = this;
222222 mw.log( "TimedText:bindMenu:" + target );
223223 _this.menuTarget = target;
224 - var $menuButton = this.embedPlayer.$target.find( '.timed-text' );
 224+ var $menuButton = this.embedPlayer.$interface.find( '.timed-text' );
225225
226226 // Else bind and show the menu
227227 // We already have a loader in embedPlayer so the delay of
@@ -458,10 +458,10 @@
459459 // Layout Menu option
460460 _this.getLi( gM( 'mwe-layout' ), 'image' ).append(
461461 _this.getLayoutMenu()
462 - ),
 462+ )
463463
464464 // Search Menu option
465 - _this.getLi( gM('mwe-search'), 'search')
 465+ //_this.getLi( gM('mwe-search'), 'search')
466466 );
467467 }
468468 // Put in the "Make Transcript" link
@@ -627,7 +627,7 @@
628628 * Updates the timed text layout ( should be called when config.layout changes )
629629 */
630630 updateLayout: function(){
631 - var $playerTarget = this.embedPlayer.$target;
 631+ var $playerTarget = this.embedPlayer.$interface;
632632 $playerTarget.find('.itext').remove();
633633 this.refreshDisplay();
634634 },
@@ -656,7 +656,7 @@
657657 this.enabledSources.push( source );
658658 //Set any existing text target to "loading"
659659 if( !source.loaded ) {
660 - var $playerTarget = this.embedPlayer.$target;
 660+ var $playerTarget = this.embedPlayer.$interface;
661661 $playerTarget.find('.itext').text( gM('mwe-loading-text') );
662662 }
663663 // Load the text:
@@ -762,7 +762,7 @@
763763
764764 //mw.log( 'updateTextDisplay: ' + text );
765765
766 - var $playerTarget = this.embedPlayer.$target;
 766+ var $playerTarget = this.embedPlayer.$interface;
767767 var $textTarget = $playerTarget.find( '.itext_' + source.category + ' span' );
768768 // If we are missing the target add it:
769769 if( $textTarget.length == 0){
@@ -795,7 +795,7 @@
796796 addItextDiv: function( category ){
797797 mw.log(" addItextDiv: " + category )
798798 // Get the relative positioned player class from the ctrlBuilder:
799 - var $playerTarget = this.embedPlayer.$target;
 799+ var $playerTarget = this.embedPlayer.$interface;
800800
801801 //Remove any existing itext divs for this player;
802802 $playerTarget.find('.itext_' + category ).remove();
@@ -820,8 +820,8 @@
821821 })
822822 )
823823 );
824 - // Make sure the outer player height is player + ctrlBuilder
825 - $j( '#' + this.embedPlayer.id ).parent('.control_wrap').animate({
 824+ // Resize the interface for layoutMode == 'ontop'
 825+ this.embedPlayer.$interface.animate({
826826 'height': this.embedPlayer.height + this.embedPlayer.ctrlBuilder.height
827827 })
828828 }else if ( layoutMode == 'below'){
@@ -843,8 +843,8 @@
844844 );
845845 var height = 62 + this.embedPlayer.height + this.embedPlayer.ctrlBuilder.height;
846846 mw.log( 'set height:' + height );
847 - // Add 60px to outer player height
848 - $j( '#' + this.embedPlayer.id ).parent('.control_wrap').animate({
 847+ // Resize the interface for layoutMode == 'below'
 848+ this.embedPlayer.$interface.animate({
849849 'height': height
850850 })
851851 mw.log( ' height of ' + this.embedPlayer.id + ' is now: ' + $j( '#' + this.embedPlayer.id ).height() );
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/remotes/RemoteMwTimedText.js
@@ -14,17 +14,28 @@
1515 RemoteMwTimedText = function( options ){
1616 return this.init( options );
1717 }
 18+mw_default_remote_text_options = [
 19+ 'action',
 20+ 'title',
 21+ 'target',
 22+ 'orgBody'
 23+];
1824 RemoteMwTimedText.prototype = {
1925
2026 init: function( options ) {
21 - this.action = ( options.action )? options.action : this.action;
22 - this.title = ( options.title )? options.title : this.title;
23 - this.target = ( options.target )? options.target : this.target;
 27+ for(var i in mw_default_remote_text_options){
 28+ var opt = mw_default_remote_text_options[i]
 29+ if( options[ opt ] ){
 30+ this[ opt ] = options[ opt ];
 31+ }
 32+ }
2433 },
2534 updateUI: function(){
2635 // Check page type
2736 if( this.action == 'view' ){
2837 this.showViewUI();
 38+ }else{
 39+ //restore
2940 }
3041 },
3142 showViewUI: function(){
@@ -132,6 +143,12 @@
133144 }
134145 // (only works for commons right now)
135146 mw.getJSON( request, function( data ) {
 147+ // Check for "page not found"
 148+ if( data.query.pages['-1'] ){
 149+ //restore content:
 150+ $j(_this.target).html( _this.orgBody );
 151+ return ;
 152+ }
136153 // Check for redirect
137154 for ( var i in data.query.pages ) {
138155 var page = data.query.pages[i];
@@ -169,17 +186,4 @@
170187 'height': page.imageinfo[0].height,
171188 };
172189 }
173 -}
174 -
175 -
176 -// Setup config on init: ( remotes drive page actions on init )
177 -mw.ready( function(){
178 - //Setup the remote configuration
179 - var myRemote = new RemoteMwTimedText( {
180 - 'action': wgAction,
181 - 'title' : wgTitle,
182 - 'target': '#bodyContent'
183 - });
184 - // Update the UI
185 - myRemote.updateUI();
186 -} );
\ No newline at end of file
 190+}
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -407,14 +407,13 @@
408408 _this.swapEmbedPlayerElement( element, playlistPlayer );
409409
410410 // Issue the checkPlayerSources call to the new playlist interface:
411 - $j( '#' + playlistPlayer.id ).get(0).checkPlayerSources();
 411+ $j( '#' + playlistPlayer.id ).get(0).showPlayer();
412412 } );
413413 break;
414414 case 'video':
415415 case 'audio':
416416 // By default treat the rewrite request as "video"
417417 default:
418 - var playerInx = _this.playerList.length;
419418 var ranPlayerSwapFlag = false;
420419 // Local callback to runPlayer swap once element has metadata
421420 function runPlayerSwap(){
@@ -424,7 +423,6 @@
425424 ranPlayerSwapFlag = true;
426425 var playerInterface = new mw.EmbedPlayer( element , attributes);
427426 _this.swapEmbedPlayerElement( element, playerInterface );
428 -
429427 // Issue the checkPlayerSources call to the new player interface:
430428 $j( '#' + $j( element ).attr('id') ).get(0).checkPlayerSources();
431429 }
@@ -1204,6 +1202,9 @@
12051203 } else {
12061204 this[attr] = default_video_attributes[attr];
12071205 }
 1206+ // string -> bollean
 1207+ if( this[attr] == "false" ) this[attr] = false;
 1208+ if( this[attr] == "true" ) this[attr] = true;
12081209 }
12091210
12101211 // Set the skin name from the class
@@ -1582,7 +1583,7 @@
15831584 * Seeks to the requested time and issues a callback when ready
15841585 * (should be overwritten by client that supports frame serving)
15851586 */
1586 - setCurrentTime:function( time, callback ) {
 1587+ setCurrentTime: function( time, callback ) {
15871588 mw.log( 'Error: base embed setCurrentTime can not frame serve (override via plugin)' );
15881589 },
15891590
@@ -1590,8 +1591,8 @@
15911592 * Setup the embed player
15921593 * issues a loading request
15931594 */
1594 - setupEmbedPlayer:function() {
1595 - mw.log( 'f:setupEmbedPlayer::' + this.selected_player.id );
 1595+ doEmbedPlayer: function() {
 1596+ mw.log( 'f:doEmbedPlayer::' + this.selected_player.id );
15961597 mw.log( 'thum disp:' + this.thumbnail_disp );
15971598 var _this = this;
15981599
@@ -1604,9 +1605,8 @@
16051606
16061607 // Make sure the player is
16071608 mw.log( 'performing embed for ' + _this.id );
1608 - var embed_code = _this.getEmbedHTML();
16091609 // mw.log('shopuld embed:' + embed_code);
1610 - $j( '#' + _this.id ).html( embed_code );
 1610+ $j( '#' + _this.id ).html( _this.getEmbedHTML() );
16111611 },
16121612
16131613 /**
@@ -1707,13 +1707,13 @@
17081708 //if k-attribution and k-skin show the "credits" screen:
17091709 if( mw.getConfig( 'k_attribution' ) && this.ctrlBuilder.showCredits ){
17101710 // Call a "credit" menu display:
1711 - this.$target.find( '.k-options' ).click();
 1711+ this.$interface.find( '.k-options' ).click();
17121712 this.ctrlBuilder.showCredits();
17131713 return ;
17141714 }
17151715
17161716 $j( '#img_thumb_' + this.id ).css( 'zindex', 1 );
1717 - this.$target.find( '.play-btn-large' ).hide();
 1717+ this.$interface.find( '.play-btn-large' ).hide();
17181718
17191719 // add black background
17201720 $j( '#dc_' + this.id ).append( '<div id="black_back_' + this.id + '" ' +
@@ -1972,24 +1972,16 @@
19731973 },
19741974
19751975 /**
1976 - * Maps the getControls request to the ctrl Builder
1977 - * requires this.ctrlBuilder to be setup
1978 - */
1979 - getControls: function() {
1980 - return this.ctrlBuilder.getControls( this );
1981 - },
1982 -
1983 - /**
19841976 * Show the player
1985 - * NOTE: the player area is double <div> encapsulation will be factored out shortly
 1977+ *
19861978 */
19871979 showPlayer : function () {
19881980 // set-up the local ctrlBuilder instance:
19891981 this.ctrlBuilder = new ctrlBuilder( this );
19901982
19911983 var _this = this;
1992 - //make sure we have control_wrap
1993 - if( $j( this ).parent('.control_wrap').length == 0 ){
 1984+ //make sure we have interface_wrap
 1985+ if( $j( this ).parent('.interface_wrap').length == 0 ){
19941986 // Select "player"
19951987 $j( this )
19961988 // Add interface control class:
@@ -1998,55 +1990,26 @@
19991991 })
20001992 .wrap(
20011993 $j('<div>')
2002 - .addClass('control_wrap ' + this.ctrlBuilder.playerClass)
 1994+ .addClass('interface_wrap ' + this.ctrlBuilder.playerClass)
20031995 .css({
20041996 'width': parseInt( this.width ),
20051997 'height': parseInt( this.height )
20061998 })
20071999 )
20082000 }
 2001+ //Set up local jQuery refrence to "interface_wrap"
 2002+ this.$interface = $j(this).parent('.interface_wrap');
20092003
2010 - // Update Thumbnail html
 2004+ // Update Thumbnail for the "player"
20112005 $j( this ).html(
20122006 this.getThumbnailHTML()
2013 - )
2014 -
 2007+ )
20152008
20162009 // Add controls if enabled:
20172010 if ( this.controls ) {
2018 - mw.log( "embedPlayer:showPlayer::AddControls" );
2019 -
2020 - // Remove any old controls:
2021 - $j( this ).parent('.control_wrap').find('.control-bar').remove();
2022 -
2023 - // Block out some space for controls by encapsulating the top player div
2024 - $j( this ).parent( '.control_wrap' ).css({
2025 - 'height' : parseInt( this.height + this.ctrlBuilder.height)
2026 - });
2027 - $j( this ).after(
2028 - $j('<div>')
2029 - .addClass( 'ui-state-default ui-widget-header ui-helper-clearfix control-bar' )
2030 - .html(
2031 - this.getControls()
2032 - )
2033 - );
2034 - /*html_code += '<div class="" >';
2035 - html_code += ;
2036 - html_code += '</div>';
2037 - */
2038 -
2039 - }
2040 - //Set up local jQuery refrence to "control_wrap"
2041 - this.$target = $j(this).parent('.control_wrap');
2042 -
2043 -
2044 - //html_code += '</div>'; // videoPlayer div close
2045 -
2046 - // mw.log('should set: '+this.id);
2047 -
2048 -
2049 - // Add hooks once Controls are in DOM
2050 - this.ctrlBuilder.addControlHooks();
 2011+ mw.log( "embedPlayer:showPlayer::AddControls" );
 2012+ this.ctrlBuilder.addControls();
 2013+ }
20512014
20522015
20532016 if ( this.autoplay ) {
@@ -2290,7 +2253,7 @@
22912254 * Display the options div
22922255 */
22932256 doOptionsHTML:function() {
2294 - var pos = this.$target.find( '.options-btn' ).offset();
 2257+ var pos = this.$interface.find( '.options-btn' ).offset();
22952258 pos['top'] = pos['top'] + 24;
22962259 pos['left'] = pos['left'] -124;
22972260 // mw.log('pos of options button: t:'+pos['top']+' l:'+ pos['left']);
@@ -2379,7 +2342,7 @@
23802343 $menu.show("fast");
23812344 }
23822345 }else{
2383 - var loc = this.$target.position();
 2346+ var loc = this.$interface.position();
23842347 //Setup the menu:
23852348 var playerHeight = ( parseInt( this.height ) + this.ctrlBuilder.height );
23862349 $j('body').append(
@@ -2445,7 +2408,7 @@
24462409 '<div class="videoOptionsComplete">' +
24472410 '</div>'+
24482411 '</div>';
2449 - this.$target.prepend( div_code );
 2412+ this.$interface.prepend( div_code );
24502413 if ( fade_in )
24512414 $j( '#blackbg_' + this.id ).fadeIn( "slow" );
24522415 else
@@ -2604,7 +2567,7 @@
26052568 // this.innerHTML = this.getPluginMissingHTML();
26062569 $j( '#' + this.id ).html( this.getPluginMissingHTML() );
26072570 } else {
2608 - this.setupEmbedPlayer();
 2571+ this.doEmbedPlayer();
26092572 this.paused = false;
26102573 this.thumbnail_disp = false;
26112574 }
@@ -2614,11 +2577,11 @@
26152578 this.seeking = false;
26162579 }
26172580
2618 - this.$target.find('.play-btn span')
 2581+ this.$interface.find('.play-btn span')
26192582 .removeClass( 'ui-icon-play' )
26202583 .addClass( 'ui-icon-pause' );
26212584
2622 - this.$target.find('.play-btn' )
 2585+ this.$interface.find('.play-btn' )
26232586 .unbind()
26242587 .buttonHover()
26252588 .click( function() {
@@ -2634,7 +2597,7 @@
26352598 * Maps the html5 load request.
26362599 * There is no genneral way to "load" clips so underling plugin-player libs should overide.
26372600 */
2638 - load:function() {
 2601+ load: function() {
26392602 // should be done by child (no base way to pre-buffer video)
26402603 mw.log( 'baseEmbed:load call' );
26412604 },
@@ -2650,13 +2613,14 @@
26512614 var _this = this;
26522615 // mw.log('mwEmbed:do pause');
26532616 // (playing) do pause
2654 - this.paused = true;
 2617+ this.paused = true;
 2618+
26552619 // update the ctrl "paused state"
2656 - this.$target.find('.play-btn span' )
 2620+ this.$interface.find('.play-btn span' )
26572621 .removeClass( 'ui-icon-pause' )
26582622 .addClass( 'ui-icon-play' );
26592623
2660 - this.$target.find('.play-btn' )
 2624+ this.$interface.find('.play-btn' )
26612625 .unbind()
26622626 .buttonHover()
26632627 .click( function() {
@@ -2702,7 +2666,7 @@
27032667 }
27042668
27052669 //Bind play-btn-large play
2706 - this.$target.find( '.play-btn-large' )
 2670+ this.$interface.find( '.play-btn-large' )
27072671 .unbind( 'click' )
27082672 .click( function() {
27092673 _this.play();
@@ -2718,11 +2682,11 @@
27192683 toggleMute:function() {
27202684 if ( this.muted ) {
27212685 this.muted = false;
2722 - this.$target.find( '.volume-slider' ).slider( 'value', 100 );
 2686+ this.$interface.find( '.volume-slider' ).slider( 'value', 100 );
27232687 this.updateVolumen( 1 );
27242688 } else {
27252689 this.muted = true;
2726 - this.$target.find( '.volume-slider' ).slider( 'value', 0 );
 2690+ this.$interface.find( '.volume-slider' ).slider( 'value', 0 );
27272691 this.updateVolumen( 0 );
27282692 }
27292693 mw.log( 'f:toggleMute::' + this.muted );
@@ -2867,7 +2831,7 @@
28682832 */
28692833 updateBufferStatus: function() {
28702834 // Get the buffer target based for playlist vs clip
2871 - $buffer = $j( this ).parent('.control_wrap').find('.mv_buffer');
 2835+ $buffer = this.$interface.find( '.mw_buffer' );
28722836
28732837 // Update the buffer progress bar (if available )
28742838 if ( this.bufferedPercent != 0 ) {
@@ -2889,7 +2853,7 @@
28902854 * @param {Float} perc Value between 0 and 1 for position of playhead
28912855 */
28922856 updatePlayHead: function( perc ) {
2893 - $play_head = $j(this).parent( '.control_wrap' ).find( '.play_head' );
 2857+ $play_head = this.$interface.find( '.play_head' );
28942858 if ( this.controls && $play_head.length != 0 ) {
28952859 var val = parseInt( perc * 1000 );
28962860 $play_head.slider( 'value', val );
@@ -2960,7 +2924,7 @@
29612925 */
29622926 setStatus: function( value ) {
29632927 // update status:
2964 - this.$target.find( '.time-disp' ).html( value );
 2928+ this.$interface.find( '.time-disp' ).html( value );
29652929 },
29662930
29672931
@@ -3130,6 +3094,8 @@
31313095 this.default_players['image/png'] = ['html'];
31323096 this.default_players['image/svg'] = ['html'];
31333097
 3098+
 3099+
31343100 },
31353101
31363102 /**
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js
@@ -38,7 +38,7 @@
3939 },
4040
4141 /**
42 - * Wraps the embed object and returns the output
 42+ * Return the embed code
4343 */
4444 getEmbedHTML : function () {
4545 var _this = this;
@@ -53,7 +53,7 @@
5454 /**
5555 * Get the native embed code
5656 */
57 - getEmbedObj:function() {
 57+ getEmbedObj: function() {
5858 // We want to let mwEmbed handle the controls so notice the absence of control attribute
5959 // controls=false results in controls being displayed:
6060 // http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/016159.html
@@ -70,7 +70,7 @@
7171 /**
7272 * Post element javascript, binds event listeners and starts monitor
7373 */
74 - postEmbedJS:function() {
 74+ postEmbedJS: function() {
7575 var _this = this;
7676 mw.log( "f:native:postEmbedJS:" );
7777 this.getPlayerElement();
@@ -78,9 +78,7 @@
7979
8080 // Setup some bindings:
8181 var vid = $j( this.playerElement ).get(0);
82 - var wtf = function(){
83 - alert("wtf");
84 - }
 82+
8583 // Bind events to local js methods:
8684 vid.addEventListener( 'canplaythrough', function(){ _this.canplaythrough }, true);
8785 vid.addEventListener( 'loadedmetadata', function(){ _this.onloadedmetadata() }, true);
@@ -89,7 +87,7 @@
9088 vid.addEventListener( 'seeking', function(){ _this.onseeking() }, true);
9189 vid.addEventListener( 'seeked', function(){ _this.onseeked() }, true);
9290
93 - // Always load the media:
 91+ // Check for load flag
9492 if ( this.onlyLoadFlag ) {
9593 this.playerElement.load();
9694 } else {
@@ -187,14 +185,14 @@
188186 */
189187 setCurrentTime: function( position , callback ) {
190188 var _this = this;
191 - mw.log( 'native:setCurrentTime::: ' + position + ' : dur: ' + _this.getDuration() );
 189+ //mw.log( 'native:setCurrentTime::: ' + position + ' : dur: ' + _this.getDuration() );
192190 this.getPlayerElement();
193191 if ( !this.playerElement ) {
194192 this.load( function() {
195 - _this.doSeekedCb( position, callback );
 193+ _this.doSeekedCallback( position, callback );
196194 } );
197195 } else {
198 - _this.doSeekedCb( position, callback );
 196+ _this.doSeekedCallback( position, callback );
199197 }
200198 },
201199 /**
@@ -206,8 +204,7 @@
207205 doSeekedCallback : function( position, callback ){
208206 var _this = this;
209207 this.getPlayerElement();
210 - var once = function( event ) {
211 - mw.log("did seek callback");
 208+ var once = function( event ) {
212209 callback();
213210 _this.playerElement.removeEventListener( 'seeked', once, false );
214211 };
@@ -339,7 +336,7 @@
340337 // No vid loaded
341338 mw.log( 'native::load() ... doEmbed' );
342339 this.onlyLoadFlag = true;
343 - this.doEmbedHTML();
 340+ this.doEmbedPlayer();
344341 this.onLoadedCallback = callback;
345342 } else {
346343 // Should not happen offten
@@ -365,7 +362,7 @@
366363 * fired when "seeking"
367364 */
368365 onseeking:function() {
369 - mw.log( "onseeking" );
 366+ //mw.log( "onseeking" );
370367 this.seeking = true;
371368 this.setStatus( gM( 'mwe-seeking' ) );
372369 },
@@ -375,7 +372,7 @@
376373 * fired when done seeking
377374 */
378375 onseeked: function() {
379 - mw.log("onseeked");
 376+ //mw.log("onseeked");
380377 this.seeking = false;
381378 },
382379
@@ -436,7 +433,7 @@
437434 mw.log( 'native on ended called with time:' + this.playerElement.currentTime + ' of total real dur: ' + this.getDuration() + ' attempting to reload src...' );
438435 var doRetry = function() {
439436 _this.urlAppend = 'retry_src=' + _this.grab_try_count;
440 - _this.doEmbedHTML();
 437+ _this.doEmbedPlayer();
441438 _this.grab_try_count++;
442439 }
443440 setTimeout( doRetry, 100 );
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.PlayList.new.js
@@ -1,318 +0,0 @@
2 -/**
3 - * The mw.PlayList object code
4 - *
5 - * @author: Michael Dale mdale@wikimedia.org
6 - * @license GPL2
7 - *
8 - * supports frame by frame rendering of "smil" and other playlist formats
9 - * supports basic drop frame live playback of "smil" and other playlist formats
10 - *
11 - * Extends the "embedPlayer" and represents the playlist as a single video stream
12 - */
13 -
14 -// Bind to mw (for uncluttered global namespace)
15 -( function( $ ) {
16 -
17 -mw.PlayList = function( element ) {
18 - return this.init( element );
19 -};
20 -// set up the mvPlaylist object
21 -mw.PlayList.prototype = {
22 - init: function( element ) {
23 - var myPlayer = new mw.EmbedPlayer( element );
24 - // Inherit "embedPlayer"
25 - for( var i in myPlayer ){
26 - if( this[i] ){
27 - this['parent_' + i] = myPlayer[i];
28 - }else{
29 - this[i] = myPlayer[i];
30 - }
31 - }
32 - },
33 - // Check, parse and load player sources
34 - checkPlayerSources: function(){
35 - var _this = this;
36 - // Get the first xml source (as potential playlist source)
37 - var source = this.mediaElement.getSources( 'text/xml' )[0];
38 - if( !source ){
39 - mw.log("Error: could not load playlist source");
40 - return ;
41 - }
42 - // Setup localpointer
43 - this.source = new mw.PlayListSource( source );
44 -
45 - // Load and parse
46 - this.source.load( function(){
47 - mw.log( 'Loaded source:' + this.source )
48 - // Show player interface:
49 - _this.showPlayer();
50 - });
51 - },
52 - /**
53 - * Get the duration for the playlist
54 - */
55 - getDuration: function(){
56 -
57 - },
58 - /**
59 - * Show the player interface
60 - */
61 - showPlayer: function(){
62 - // Update duration:
63 - _this.getDuration();
64 - // Add playlist title
65 -
66 - // Add
67 - }
68 -
69 -}
70 -
71 -/**
72 - * Extends the base "source" type with playlist source
73 - */
74 -mw.PlayListSource = function( source ){
75 - return this.init( source )
76 -}
77 -mw.PlayListSource.prototype = {
78 - /**
79 - * @constructor
80 - * @param {Object} source Source object to extend
81 - */
82 - init: function( source ){
83 - for(var i in source){
84 - this[i] = source[i];
85 - }
86 - },
87 - /**
88 - * Function to load and parse the source xml
89 - * @param {Function} callback Function called once text source is loaded
90 - */
91 - load: function( callback ){
92 - var _this = this;
93 -
94 - //check if its already loaded:
95 - if( _this.loaded ){
96 - if( callback ){
97 - callback();
98 - }
99 - }
100 - // Try to load src via src attr:
101 - if( this.getSrc() ){
102 - // Issue the direct load request ( if we can )
103 - if ( mw.parseUri( document.URL ).host != mw.parseUri( this.getSrc() ).host ){
104 - mw.log("Error: host mis-match: " + mw.parseUri( document.URL ).host != mw.parseUri( this.getSrc() ).host )
105 - return ;
106 - }
107 - $j.get( this.getSrc(), function( data ){
108 - // set the local data
109 - _this.data = data;
110 - // Set the parser handle
111 - _this.setParserHandle();
112 - // Parse and load dependencies
113 -
114 - // Update the loaded state:
115 - _this.loaded = true;
116 - if( callback ){
117 - callback();
118 - }
119 - }, 'text' );
120 - return ;
121 - }
122 - },
123 -
124 - /**
125 - * Update src parser handler for given loaded data in this.data
126 - */
127 - setParserHandle: function( ) {
128 - mw.log( 'data type of: ' + this.src + ' = ' + typeof ( this.data ) + "\n" + this.data );
129 - this.parseHandle = null;
130 - // if not external use different detection matrix
131 - if ( typeof this.data == 'object' ) {
132 - mw.log( 'object' );
133 - // object assume xml (either xspf or rss)
134 - plElm = this.data.getElementsByTagName( 'playlist' )[0];
135 - if ( plElm ) {
136 - if ( plElm.getAttribute( 'xmlns' ) == 'http://xspf.org/ns/0/' ) {
137 - this.parseHandle = 'xspf';
138 - }
139 - }
140 - // check itunes style rss "items"
141 - rssElm = this.data.getElementsByTagName( 'rss' )[0];
142 - if ( rssElm ) {
143 - if ( rssElm.getAttribute( 'xmlns:itunes' ) == 'http://www.itunes.com/dtds/podcast-1.0.dtd' ) {
144 - this.parseHandle = 'itunes';
145 - }
146 - }
147 - // check for smil tag:
148 - smilElm = this.data.getElementsByTagName( 'smil' )[0];
149 - if ( smilElm ) {
150 - this.parseHandle = 'smil';
151 - }
152 - } else if ( typeof this.data == 'string' ) {
153 - mw.log( 'String' );
154 - // look at the first line:
155 - var first_line = this.data.substring( 0, this.data.indexOf( "\n" ) );
156 - mw.log( 'first line: ' + first_line );
157 - // string
158 - if ( first_line.indexOf( '#EXTM3U' ) != -1 ) {
159 - this.parseHandle = 'm3u';
160 - } else if ( first_line.indexOf( '<smil' ) != -1 ) {
161 - // @@todo parse string
162 - this.parseHandle = 'smil';
163 - }
164 - }
165 - if ( this.parseHandle ) {
166 - mw.log( 'is of type:' + this.srcType );
167 - } else {
168 - // unknown playlist type
169 - mw.log( 'unknown playlist type?' );
170 - }
171 - }
172 -}
173 -
174 -
175 -/*
176 - * m3u parse
177 - */
178 -var m3uPlaylist = {
179 - doParse:function() {
180 - // for each line not # add as clip
181 - var inx = 0;
182 - var _this = this;
183 - // mw.log('data:'+ this.data.toString());
184 - $j.each( this.data.split( "\n" ), function( i, n ) {
185 - // mw.log('on line '+i+' val:'+n+' len:'+n.length);
186 - if ( n.charAt( 0 ) != '#' ) {
187 - if ( n.length > 3 ) {
188 - // @@todo make sure its a valid url
189 - // mw.log('add url: '+i + ' '+ n);
190 - var cur_clip = new mvClip( { type:'srcClip', id:'p_' + _this.id + '_c_' + inx, pp:this_pl, src:n, order:inx } );
191 - // setup the embed object
192 - cur_clip.setUpEmbedObj();
193 - mw.log( 'm3uPlaylist len:' + thisClip.embed.mediaElement.sources.length );
194 - _this.addCliptoTrack( cur_clip );
195 - inx++;
196 - }
197 - }
198 - } );
199 - return true;
200 - }
201 -}
202 -/**
203 - * itunes Playlist parser
204 - */
205 -var itunesPlaylist = {
206 - doParse:function() {
207 - var properties = {
208 - title: 'title',
209 - linkback: 'link',
210 - author: 'itunes:author',
211 - desc: 'description',
212 - date:'pubDate'
213 - };
214 - var tmpElm = null;
215 - for ( i in properties ) {
216 - tmpElm = this.data.getElementsByTagName( properties[i] )[0];
217 - if ( tmpElm ) {
218 - this[i] = tmpElm.childNodes[0].nodeValue;
219 - // mw.log('set '+i+' to '+this[i]);
220 - }
221 - }
222 - // image src is nested in itunes rss:
223 - tmpElm = this.data.getElementsByTagName( 'image' )[0];
224 - if ( tmpElm ) {
225 - imgElm = tmpElm.getElementsByTagName( 'url' )[0];
226 - if ( imgElm ) {
227 - this.img = imgElm.childNodes[0].nodeValue;
228 - }
229 - }
230 - // get the clips:
231 - var clips = this.data.getElementsByTagName( "item" );
232 - properties.src = 'guid';
233 - for ( var i = 0; i < clips.length; i++ ) {
234 - var cur_clip = new mvClip( { type:'srcClip', id:'p_' + this.id + '_c_' + i, pp:this, order:i } );
235 - for ( var j in properties ) {
236 - tmpElm = clips[i].getElementsByTagName( properties[j] )[0];
237 - if ( tmpElm != null ) {
238 - cur_clip[j] = tmpElm.childNodes[0].nodeValue;
239 - // mw.log('set clip property: ' + j+' to '+cur_clip[j]);
240 - }
241 - }
242 - // image is nested
243 - tmpElm = clips[i].getElementsByTagName( 'image' )[0];
244 - if ( tmpElm ) {
245 - imgElm = tmpElm.getElementsByTagName( 'url' )[0];
246 - if ( imgElm ) {
247 - cur_clip.img = imgElm.childNodes[0].nodeValue;
248 - }
249 - }
250 - // set up the embed object now that all the values have been set
251 - cur_clip.setUpEmbedObj();
252 -
253 - // add the current clip to the clip list
254 - this.addCliptoTrack( cur_clip );
255 - }
256 - return true;
257 - }
258 -}
259 -
260 -/*
261 - * xsfp playlist parser:
262 - * http://www.xspf.org/xspf-v1.html
263 - */
264 -var xspfPlaylist = {
265 - doParse:function() {
266 - // mw.log('do xsfp parse: '+ this.data.innerHTML);
267 - var properties = { title:'title', linkback:'info',
268 - author:'creator', desc:'annotation',
269 - poster:'image', date:'date' };
270 - var tmpElm = null;
271 - // get the first instance of any of the meta tags (ok that may be the meta on the first clip)
272 - // mw.log('do loop on properties:' + properties);
273 - for ( i in properties ) {
274 - mw.log( 'on property: ' + i );
275 - tmpElm = this.data.getElementsByTagName( properties[i] )[0];
276 - if ( tmpElm ) {
277 - if ( tmpElm.childNodes[0] ) {
278 - this[i] = tmpElm.childNodes[0].nodeValue;
279 - mw.log( 'set pl property: ' + i + ' to ' + this[i] );
280 - }
281 - }
282 - }
283 - var clips = this.data.getElementsByTagName( "track" );
284 - mw.log( 'found clips:' + clips.length );
285 - // add any clip specific properties
286 - properties.src = 'location';
287 - for ( var i = 0; i < clips.length; i++ ) {
288 - var cur_clip = new mvClip( { id:'p_' + this.id + '_c_' + i, pp:this, order:i } );
289 - // mw.log('cur clip:'+ cur_clip.id);
290 - for ( var j in properties ) {
291 - tmpElm = clips[i].getElementsByTagName( properties[j] )[0];
292 - if ( tmpElm != null ) {
293 - if ( tmpElm.childNodes.length != 0 ) {
294 - cur_clip[j] = tmpElm.childNodes[0].nodeValue;
295 - mw.log( 'set clip property: ' + j + ' to ' + cur_clip[j] );
296 - }
297 - }
298 - }
299 - // add mvClip ref from info link:
300 - if ( cur_clip.linkback ) {
301 - // if mv linkback
302 - mvInx = 'Stream:';
303 - mvclippos = cur_clip.linkback.indexOf( mvInx );
304 - if ( mvclippos !== false ) {
305 - cur_clip.mvclip = cur_clip.linkback.substr( mvclippos + mvInx.length );
306 - }
307 - }
308 - // set up the embed object now that all the values have been set
309 - cur_clip.setUpEmbedObj();
310 - // add the current clip to the clip list
311 - this.addCliptoTrack( cur_clip );
312 - }
313 - // mw.log('done with parse');
314 - return true;
315 - }
316 -}
317 -
318 -
319 -} )( window.mw );
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/loader.js
@@ -6,10 +6,21 @@
77 "mw.Sequencer" : "modules/Sequencer/mw.Sequencer.js",
88 "mw.SeqRemoteSearchDriver" : "modules/Sequencer/mw.SeqRemoteSearchDriver.js",
99 "mw.TimedEffectsEdit" : "modules/Sequencer/mvTimedEffectsEdit.js",
 10+ "mw.FirefoggRender" : "modules/Sequencer/mw.FirefoggRender.js",
1011
1112 "RemoteMwSequencer" : "modules/Sequencer/remotes/RemoteMwSequencer.js"
1213 } );
1314
 15+mw.addModuleLoader( 'FirefoggRender', function( callback) {
 16+ mw.load( [
 17+ 'mw.Firefogg',
 18+ 'mw.FirefoggRender',
 19+ 'mw.BaseUploadInterface'
 20+ ], function(){
 21+ callback( 'FirefoggRender' );
 22+ });
 23+});
 24+
1425 mw.addModuleLoader( 'Sequencer', function( callback ){
1526 //Get sequencer style sheet
1627 mw.getStyleSheet( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skinName' ) + '/mv_sequence.css' );
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.FirefoggRender.js
@@ -1,30 +1,57 @@
22 /*
33 * Handles driving the firefogg render system
44 */
5 -mw.FirefoggRender = function( options ) {
6 - return this.init( options );
7 -};
 5+
 6+/*
 7+* Set the jQuery bindings:
 8+*/
 9+( function( $ ) {
 10+ $.fn.firefoggRender = function( options, callback ) {
 11+ options.player_target = this.selector;
 12+ var myFogg = new mw.FirefoggRender( options );
 13+ return myFogg;
 14+ }
 15+} )( jQuery );
 16+
 17+
818 var default_render_options = {
9 - "videoQuality" : 10,
10 - "framerate" : 30
 19+ "videoQuality" : 8,
 20+ "framerate" : 30
 21+
 22+
1123 }
1224 var default_FirefoggRender_options = {
1325 start_time:0,
1426 // if we should save to disk (if false setup upload stuff below)
1527 save_to_disk:true
 28+
1629 }
 30+mw.FirefoggRender = function( options ) {
 31+ return this.init( options );
 32+};
1733 // Set up the mvPlaylist object
1834 mw.FirefoggRender.prototype = {
19 - // default empty render options:
 35+
 36+ // Default empty render options:
2037 renderOptions: { },
 38+
 39+ // Render time
 40+ render_time: null,
 41+
 42+ // The interval time ( set via requested framerate)
 43+ interval: null,
 44+
 45+ // Continue rendering
2146 continue_rendering:false,
 47+
 48+ // Constructor
2249 init:function( options ) {
2350 var _this = this;
2451
25 - // grab the mvFirefogg object to do basic tests
26 - this.myFogg = new mvFirefogg( {
 52+ // Grab the mvFirefogg object to do basic tests
 53+ this.myFogg = new mw.Firefogg( {
2754 'only_fogg':true
28 - } );
 55+ });
2956
3057 // check for firefogg:
3158 if ( this.myFogg.getFirefogg() ) {
@@ -37,21 +64,19 @@
3865 // set up local fogg pointer:
3966 this.fogg = this.myFogg.fogg;
4067
41 - // setup player instance
42 - this.player = $j( options.player_target ).get( 0 );
43 - this.player_target = options.player_target;
 68+ // setup player instance
 69+ this.player_target = options.player_target;
4470
4571 // Extend the render options with any provided details
4672 if( options['render_options'] )
47 - $j.extend(this.renderOptions, options['render_options']);
 73+ $j.extend(this.renderOptions, default_render_options, options['render_options']);
4874
4975 // If no height width provided use target DOM width/height
5076 if( !this.renderOptions.width && !this.renderOptions.height ){
5177 this.renderOptions.width = $j(this.player_target).width();
52 - this.renderOptions.height = $j(this.player_target).height();
53 - }
 78+ this.renderOptions.height = $j(this.player_target).height();
 79+ }
5480
55 -
5681 // Setup the application options (with defaults)
5782 for ( var i in default_FirefoggRender_options ) {
5883 if ( options[ i ] ) {
@@ -60,6 +85,7 @@
6186 this[ i ] = default_FirefoggRender_options[i];
6287 }
6388 }
 89+
6490 // Should be externally controlled
6591 if ( options.target_startRender ) {
6692 $j( options.target_startRender ).click( function() {
@@ -78,18 +104,28 @@
79105 this.target_timeStatus = options.target_timeStatus;
80106 }
81107 },
82 - startRender:function() {
 108+
 109+ // Start rendering
 110+ startRender: function() {
83111 var _this = this;
84 - var t = this.start_time;
 112+ this.render_time = this.start_time;
85113 // get the interval from renderOptions framerate
86 - var interval = 1 / this.renderOptions.framerate
 114+ this.interval = 1 / this.renderOptions.framerate
87115
88 - // issue a load request on the player:
89 - //this.player.load();
 116+ // Get the player:
 117+ this.player = $j( this.player_target ).get( 0 );
90118
 119+
 120+
 121+ // Set a target file
 122+
91123 // init the Render
92 - this.fogg.initRender( JSON.stringify( _this.renderOptions ), 'foggRender' );
 124+ mw.log( "starting render with: " + JSON.stringify( _this.renderOptions ) );
 125+ this.fogg.initRender( JSON.stringify( _this.renderOptions ), 'foggRender.ogv' );
93126
 127+ $j( this.target_timeStatus ).val( "loading player" );
 128+
 129+
94130 // add audio if we had any:
95131
96132 // request a target (should support rendering to temp location too)
@@ -97,33 +133,45 @@
98134
99135 // set the continue rendering flag to true:
100136 this.continue_rendering = true;
 137+
101138
102 - // internal function to hanndle updates:
103 - var doNextFrame = function() {
104 - $j( _this.target_timeStatus ).val( " on " + ( Math.round( t * 10 ) / 10 ) + " of " +
105 - ( Math.round( _this.player.getDuration() * 10 ) / 10 ) );
106 - _this.player.setCurrentTime( t, function() {
107 - //_this.fogg.addFrame( $j( _this.player_target ).attr( 'id' ) );
108 - t += interval;
109 - if ( t >= _this.player.getDuration() ) {
 139+ // issue a load request on the player:
 140+ this.player.load(function(){
 141+ $j( this.target_timeStatus ).val( "player ready" );
 142+ //now issue the save video as call (to avoid running "expired" code
 143+ _this.fogg.saveVideoAs();
 144+ _this.doNextFrame();
 145+ });
 146+ },
 147+ doNextFrame: function(){
 148+ var _this = this;
 149+ // internal function to handle updates:
 150+ $j( _this.target_timeStatus ).val( " on " + ( Math.round( _this.render_time * 10 ) / 10 ) + " of " +
 151+ ( Math.round( _this.player.getDuration() * 10 ) / 10 ) );
 152+
 153+ _this.player.setCurrentTime( _this.render_time, function() {
 154+ //mw.log( 'addFrame:' + $j( _this.player_target ).attr( 'id' ) );
 155+ _this.fogg.addFrame( $j( _this.player_target ).attr( 'id' ) );
 156+ _this.render_time += _this.interval;
 157+ if ( _this.render_time >= _this.player.getDuration() ) {
 158+ _this.doFinalRender();
 159+ } else {
 160+ if ( _this.continue_rendering ) {
 161+ _this.doNextFrame();
 162+ } else {
 163+ mw.log('render stoped');
 164+ // else quit:
110165 _this.doFinalRender();
111 - } else {
112 - if ( _this.continue_rendering ) {
113 - doNextFrame();
114 - } else {
115 - mw.log('done with render');
116 - // else quit:
117 - //_this.doFinalRender();
118 - }
119166 }
120 - } );
121 - }
122 - doNextFrame();
 167+ }
 168+ } );
123169 },
124170 stopRender:function() {
125171 this.continue_rendering = false;
126172 },
127 - doFinalRender:function() {
 173+ doFinalRender: function() {
 174+ var _this = this;
 175+ mw.log( " do final render: " );
128176 $j( this.target_timeStatus ).val( "doing final render" );
129177 this.fogg.render();
130178 this.updateStatus();
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/playListEmbed.js
@@ -0,0 +1,60 @@
 2+/**
 3+ * The playlistEmbed object code
 4+ * Acts as a playback system for embedPlayer where the src
 5+ * is xml with multiple files
 6+ *
 7+ * Only works with "video" tag browsers
 8+ *
 9+ * @author: Michael Dale mdale@wikimedia.org
 10+ * @license GPL2
 11+ *
 12+ * supports frame by frame rendering of "smil" and other playlist formats
 13+ * supports basic drop frame live playback of "smil" and other playlist formats
 14+ *
 15+ * Extends the "embedPlayer" and represents the playlist as a single video stream
 16+ *
 17+ */
 18+var playListEmbed = {
 19+
 20+ // Instance Name
 21+ instanceOf: 'playListEmbed',
 22+
 23+ // Native player supported feature set
 24+ supports: {
 25+ 'play_head': true,
 26+ 'pause': true,
 27+ 'fullscreen': false,
 28+ 'time_display': true,
 29+ 'volume_control': true,
 30+ 'overlays': true,
 31+ },
 32+
 33+ /**
 34+ * Return the embed code for the first clip in the playlist
 35+ * ( monitor and seek handle clip switching )
 36+ */
 37+ getEmbedHTML : function () {
 38+ var _this = this;
 39+ var embed_code = this.getEmbedObj();
 40+ mw.log( "embed code: " + embed_code )
 41+ setTimeout( function(){
 42+ _this.postEmbedJS();
 43+ }, 150 );
 44+ return embed_code;
 45+ },
 46+
 47+ /**
 48+ * Get the native embed code for clipset at given time and seek
 49+ */
 50+ getEmbedObj:function() {
 51+ // Output Video tag for every clip in next 20s
 52+ var eb = '<video ' +
 53+ 'id="' + this.pid + '" ' +
 54+ 'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' +
 55+ 'width="' + this.width + '" height="' + this.height + '" ' +
 56+ 'src="' + this.getSrc() + '" ' +
 57+ '</video>';
 58+ return eb;
 59+ },
 60+
 61+}
\ No newline at end of file
Property changes on: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/playListEmbed.js
___________________________________________________________________
Name: svn:mergeinfo
162 + /branches/REL1_15/phase3/js2/mwEmbed/libSequencer/mvPlayList.js:51646
/branches/sqlite/js2/mwEmbed/libSequencer/mvPlayList.js:58211-58321
Name: svn:eol-style
263 + native
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.PlayList.js
@@ -36,17 +36,16 @@
3737 } else {
3838 var defaultMetaDataProvider = wgServer + wgScript + '?title=Special:MvExportStream&feed_format=roe&stream_name=';
3939 }
40 -/*
41 - * The playlist Object implements ~most~ of embedPlayer but we don't inherit (other than to use the control builder)
42 - * because pretty much every function has to be changed for the playlist context
43 - */
 40+
4441 mw.PlayList = function( element ) {
4542 return this.init( element );
4643 };
4744 // set up the mvPlaylist object
4845 mw.PlayList.prototype = {
 46+ // Instance Name
4947 instanceOf:'mvPlayList',
50 - pl_duration:null,
 48+
 49+ pl_duration: null,
5150 update_tl_hook:null,
5251 clip_ready_count:0,
5352 cur_clip:null,
@@ -66,14 +65,14 @@
6766 tracks: { },
6867 default_track:null, // the default track to add clips to.
6968 // the layout for the playlist object
70 - pl_layout : {
 69+ layout : {
7170 seq_title:.1,
7271 clip_desc:.63, // displays the clip description
7372 clip_aspect:1.33, // 4/3 video aspect ratio
7473 seq:.25, // display clip thumbnails
7574 seq_thumb:.25, // size for thumbnails (same as seq by default)
7675 seq_nav:0, // for a nav bar at the base (currently disabled)
77 - // some pl_layout info:
 76+ // some layout info:
7877 title_bar_height:17,
7978 control_height:29
8079 },
@@ -88,7 +87,7 @@
8988 'overlays':true,
9089 'playlist_swap_loader':true // if the object supports playlist functions
9190 },
92 - init : function( element ) {
 91+ init: function( element ) {
9392 mw.log( 'mvPlayList:init:' );
9493 this.tracks = { };
9594 this.default_track = null;
@@ -119,8 +118,8 @@
120119
121120 // if controls=false hide the title and the controls:
122121 if ( this.controls === false ) {
123 - this.pl_layout.control_height = 0;
124 - this.pl_layout.title_bar_height = 0;
 122+ this.layout.control_height = 0;
 123+ this.layout.title_bar_height = 0;
125124 } else {
126125 // setup the controlBuilder object:
127126 this.ctrlBuilder = new ctrlBuilder( this );
@@ -196,8 +195,7 @@
197196 for ( var method in plObj ) {
198197 // js parent preservation for local overwritten methods
199198 if ( this[method] )this['parent_' + method] = this[method];
200 - this[method] = plObj[method];
201 - mw.log( 'inherit:' + method );
 199+ this[method] = plObj[method];
202200 }
203201
204202 if ( typeof this.doParse != 'function' ) {
@@ -391,14 +389,19 @@
392390 getClipCount:function() {
393391 return this.default_track.clips.length;
394392 },
395 - // },
396 - // takes in the playlist
397 - // inherits all the properties
398 - // swaps in the playlist object html/interface div
399 - showPlayer:function() {
400 - mw.log( 'mvPlaylist:showPlayer: loading:' + this.loading );
 393+
 394+ /**
 395+ * Checks the playlist player sources and calls "showPlayer" once ready
 396+ */
 397+ checkPlayerSources: function( callback ) {
 398+ var _this = this;
 399+ mw.log( 'pl:checkPlayerSources:: loading:' + this.loading );
401400 if ( this.loading ) {
402 - $j( '#' + this.id ).html( 'loading playlist...' );
 401+ $j( '#' + this.id )
 402+ .html( 'loading playlist...' )
 403+ .css({
 404+ 'color':'#000'
 405+ });
403406 if ( this.loading_external_data ) {
404407 // load the data source chain of functions (to update the innerHTML)
405408 this.getDataSource();
@@ -411,17 +414,29 @@
412415 if ( this.default_track.getClipCount() == 0 ) {
413416 $j( this ).html( 'empty playlist' );
414417 return ;
415 - } else {
416 - this.showPlayer();
 418+ } else {
 419+ callback();
417420 }
418421 }
419422 },
420423 showPlayer:function() {
421 - mw.log( 'mvPlaylist:showPlayer:: track length: ' + this.default_track.getClipCount() );
 424+ mw.log( 'pl:showPlayer:: track length: ' + this.default_track.getClipCount() );
422425 var _this = this;
423 -
424 - //make sure we have control_wrap
425 - if( $j( this ).parent('.control_wrap').length == 0 ){
 426+
 427+ //Check for playlist player sources:
 428+ this.checkPlayerSources(function(){
 429+ _this.buildPlayerUI();
 430+ });
 431+ },
 432+
 433+ /**
 434+ * Build out the player interface ( assumes checkPlayerSources has been run )
 435+ */
 436+ buildPlayerUI: function(){
 437+ var _this = this;
 438+ mw.log('pl:buildPlayer');
 439+ // Make sure we have interface_wrap
 440+ if( $j( this ).parent('.interface_wrap').length == 0 ){
426441 // Select "player"
427442 $j( this )
428443 // Add interface control class:
@@ -430,39 +445,35 @@
431446 })
432447 .wrap(
433448 $j('<div>')
434 - .addClass('control_wrap ' + this.ctrlBuilder.playerClass)
 449+ .addClass( 'interface_wrap ' + this.ctrlBuilder.playerClass )
435450 .css({
436451 'width': parseInt( this.width ),
437452 'height': parseInt( this.height )
438453 })
439454 )
440455 }
441 -
 456+
442457 // Update the target player:
443 - this.$target = $j(this).parent('.control_wrap');
444 - if ( this.controls == true ) {
445 - var cpos = _this.height + _this.pl_layout.title_bar_height;
446 - // give more space if not in sequence:
447 - cpos += ( this.sequencer ) ? 2:5;
448 - // append title:
449 - $j( '#dc_' + _this.id ).append(
450 - '<div style="font-size:13px;border:solid thin;width:' + this.width + 'px;" id="ptitle_' + this.id + '"></div>' +
451 - '<div class="' + this.ctrlBuilder.playerClass + '" style="position:absolute;top:' + cpos + 'px">' +
452 - '<div class="ui-widget-header ui-helper-clearfix control-bar" ' +
453 - 'style="width:' + _this.width + 'px" >' +
454 - _this.getControlsHTML() +
455 - '</div>' +
456 - '</div>'
 458+ this.$interface = $j( this ).parent( '.interface_wrap' );
 459+ this.ctrlBuilder.embedPlayer = this;
 460+
 461+ if ( this.controls == true ) {
 462+ // prepend the title (ontop)
 463+ this.$interface.prepend(
 464+ $j('<div>')
 465+ .css({
 466+ 'font-size':'13px',
 467+ 'border' : 'solid thin',
 468+ 'width' : this.width,
 469+ 'height': this.layout.title_bar_height
 470+
 471+ })
 472+ .attr('id', 'ptitle_' + this.id)
457473 );
458 -
459 - // once the controls are in the DOM add hooks:
460 - this.ctrlBuilder.addControlHooks( );
461 - } else {
462 - // just append the video:
463 - $j( '#dc_' + _this.id ).append(
464 - '<div class="' + this.ctrlBuilder.playerClass + '" style="position:absolute;top:' + ( _this.height + _this.pl_layout.title_bar_height + 4 ) + 'px"></div>'
465 - );
466 - }
 474+ // add the controls:
 475+ this.ctrlBuilder.addControls( );
 476+ }
 477+
467478 this.setupClipDisplay();
468479
469480 // update the title and status bar
@@ -472,16 +483,16 @@
473484 setupClipDisplay:function() {
474485 mw.log( 'mvPlaylist:setupClipDisplay:: clip len:' + this.default_track.clips.length );
475486 var _this = this;
 487+ $j( _this ).html( '' );
476488 $j.each( this.default_track.clips, function( i, clip ) {
477 - var cout = '<div class="clip_container cc_" id="clipDesc_' + clip.id + '" ' +
 489+ var cout = '<div class="clip_container" id="clipDesc_' + clip.id + '" ' +
478490 'style="display:none;position:absolute;text-align: center;width:' + _this.width + 'px;' +
479 - 'height:' + ( _this.height ) + 'px;' +
480 - 'top:' + this.title_bar_height + 'px;left:0px;';
 491+ 'height:' + ( _this.height ) + 'px;';
481492 if ( _this.controls ) {
482493 cout += 'border:solid thin black;';
483494 }
484495 cout += '"></div>';
485 - $j( '#dc_' + _this.id ).append( cout );
 496+ $j( _this ).append( cout );
486497 // update the embed html:
487498 clip.embed.height = _this.height;
488499 clip.embed.width = _this.width;
@@ -565,13 +576,13 @@
566577 },
567578 /*setStatus override (could call the jquery directly) */
568579 setStatus:function( value ) {
569 - $j( '#' + this.id + ' .time-disp' ).text( value );
 580+ this.$interface.find( '.time-disp' ).text( value );
570581 },
571582 updatePlayHead:function( value ) {
572583 // slider is on 1000 scale:
573584 var val = parseInt( value * 1000 );
574585 //mw.log( 'update slider: #' + this.id + ' .play_head to ' + val );
575 - $j( '#' + this.id + ' .play_head' ).slider( 'value', val );
 586+ this.$interface.find( '.play_head' ).slider( 'value', val );
576587 },
577588 getPlayHeadPos: function( prec_done ) {
578589 var _this = this;
@@ -691,7 +702,8 @@
692703 $j( '#clipDesc_' + this.cur_clip.id ).hide();
693704 }
694705 this.activeClipList.add( new_clip );
695 - // do swap:
 706+
 707+ // Do swap:
696708 this.cur_clip = new_clip;
697709 $j( '#clipDesc_' + this.cur_clip.id ).show();
698710
@@ -715,7 +727,7 @@
716728 prev_clip = this.start_clip;
717729 }
718730 // @@todo we could do something fancy like use playlist for sets of clips where supported.
719 - // or in cases where the player nativly supports the playlist format we can just pass it in (ie m3u or xspf)
 731+ // or in cases where the player natively supports the playlist format we can just pass it in ( ie m3u or xspf )
720732 if ( this.cur_clip.embed.supports['playlist_swap_loader'] ) {
721733 // where the plugin supports pre_loading future clips and manage that in javascript
722734 // pause current clip
@@ -744,7 +756,7 @@
745757 var _this = this;
746758 mw.log( 'pl play' );
747759 // hide the playlist play button:
748 - $j( this.id + ' .play-btn-large' ).hide();
 760+ this.$interface.find('.play-btn-large' ).hide();
749761
750762 // un-pause if paused:
751763 if ( this.paused )
@@ -777,6 +789,20 @@
778790 // play cur_clip
779791 this.cur_clip.embed.play();
780792 }
 793+
 794+ // Update interface:
 795+ this.$interface.find('.play-btn span')
 796+ .removeClass( 'ui-icon-play' )
 797+ .addClass( 'ui-icon-pause' );
 798+
 799+ this.$interface.find('.play-btn' )
 800+ .unbind()
 801+ .buttonHover()
 802+ .click( function() {
 803+ _this.pause();
 804+ } )
 805+ .attr( 'title', gM( 'mwe-pause_clip' ) );
 806+
781807 // start up the playlist monitor
782808 this.monitor();
783809 },
@@ -791,6 +817,7 @@
792818 this.cur_clip.embed.toggleMute();
793819 },
794820 pause:function() {
 821+ var _this = this;
795822 // mw.log('f:pause: playlist');
796823 var ct = new Date();
797824 this.pauseTime = this.currentTime;
@@ -801,6 +828,20 @@
802829 $j.each( this.activeClipList.getClipList(), function( inx, clip ) {
803830 clip.embed.pause();
804831 } );
 832+
 833+ // Copied from embedPlayer.pause ( in the refactor this is not needed )
 834+ // update the ctrl "paused state"
 835+ this.$interface.find('.play-btn span' )
 836+ .removeClass( 'ui-icon-pause' )
 837+ .addClass( 'ui-icon-play' );
 838+
 839+ this.$interface.find('.play-btn' )
 840+ .unbind()
 841+ .buttonHover()
 842+ .click( function() {
 843+ _this.play();
 844+ } )
 845+ .attr( 'title', gM( 'mwe-play_clip' ) );
805846 },
806847 // @@todo mute across all child clips:
807848 toggleMute:function() {
@@ -942,15 +983,26 @@
943984 // get controls from current clip (add some playlist specific controls:
944985 return this.ctrlBuilder.getControls( this );
945986 },
946 - // ads colors/dividers between tracks
 987+
 988+ /**
 989+ * Update the buffer status
 990+ */
 991+ updateBufferStatus: function() {
 992+ // Update the buffer status for all current clip
 993+ /*mw.log(' update: '+ this.cur_clip.embed.id + ' to ' + (this.cur_clip.embed.bufferedPercent * 100) );
 994+ if( this.cur_clip.embed && this.cur_clip.embed.bufferedPercent ){
 995+ $j('#cl_status_' + this.cur_clip.embed.id ).find('.mw_buffer').css({
 996+ 'width': ( this.cur_clip.embed.bufferedPercent * 100) + '%'
 997+ })
 998+ }*/
 999+ },
 1000+ // Add colors dividers between tracks
9471001 colorPlayHead: function() {
9481002 var _this = this;
9491003
950 - if ( !_this.mv_seeker_width )
951 - _this.mv_seeker_width = $j( '#' + _this.id + ' .play_head' ).width();
9521004
9531005 if ( !_this.track_len )
954 - _this.track_len = $j( '#' + _this.id + ' .play_head' ).width();
 1006+ _this.track_len = this.$interface.find( '.play_head' ).width();
9551007
9561008 // total duration:
9571009 var pl_duration = _this.getDuration();
@@ -964,7 +1016,6 @@
9651017 var perc = ( clip.getSoloDuration() / pl_duration );
9661018 var pwidth = Math.round( perc * _this.track_len );
9671019 // mw.log('pstatus:c:'+ clip.getDuration() + ' of '+ pl_duration+' %:' + perc + ' width: '+ pwidth + ' of total: ' + _this.track_len);
968 - // var pwidth = Math.round( perc * _this.track_len - (_this.mv_seeker_width*perc) );
9691020
9701021 // add the buffer child indicator:
9711022 var barHtml = '<div id="cl_status_' + clip.embed.id + '" class="cl_status" style="' +
@@ -983,34 +1034,12 @@
9841035
9851036 // background:#DDD +clip.getColor();
9861037
987 - $j( '#' + _this.id + ' .play_head' ).append( barHtml );
 1038+ _this.$interface.find( '.play_head' ).append( barHtml );
9881039
9891040 // mw.log('offset:' + cur_pixle +' width:'+pwidth+' add clip'+ clip.id + ' is '+clip.embed.getDuration() +' = ' + perc +' of ' + _this.track_len);
9901041 cur_pixle += pwidth;
9911042 } );
992 - },
993 - // @@todo currently not really in use
994 - setUpHover:function() {
995 - mw.log( 'Setup Hover' );
996 - // set up hover for prev,next
997 - var th = 50;
998 - var tw = th * this.pl_layout.clip_aspect;
999 - var _this = this;
1000 - $j( '#mv_prev_link_' + _this.id + ',#mv_next_link_' + _this.id ).hover( function() {
1001 - var clip = ( this.id == 'mv_prev_link_' + _this.id ) ? _this.getPrevClip() : _this.getNextClip();
1002 - if ( !clip )
1003 - return mw.log( 'missing clip for Hover' );
1004 - // get the position of #mv_perv|next_link:
1005 - var loc = getAbsolutePos( this.id );
1006 - // mw.log('Hover: x:'+loc.x + ' y:' + loc.y + ' :'+clip.img);
1007 - $j( "body" ).append( '<div id="mv_Athub" style="position:absolute;' +
1008 - 'top:' + loc.y + 'px;left:' + loc.x + 'px;width:' + tw + 'px;height:' + th + 'px;">' +
1009 - '<img style="border:solid 2px ' + clip.getColor() + ';position:absolute;top:0px;left:0px;" width="' + tw + '" height="' + th + '" src="' + clip.img + '"/>' +
1010 - '</div>' );
1011 - }, function() {
1012 - $j( '#mv_Athub' ).remove();
1013 - } );
1014 - },
 1043+ },
10151044 // @@todo we need to move a lot of this track logic like "cur_clip" to the track Obj
10161045 // and have the playlist just drive the tracks.
10171046 getNextClip:function( track ) {
@@ -1074,18 +1103,6 @@
10751104 } );
10761105 }
10771106 },
1078 - // this is pretty outdated:
1079 - getPLControls: function() {
1080 - mw.log( 'getPL cont' );
1081 - return '<a id="mv_prev_link_' + this.id + '" title="Previus Clip" onclick="document.getElementById(\'' + this.id + '\').playPrev();return false;" href="#">' +
1082 - getTransparentPng( { id:'mv_prev_btn_' + this.id, style:'float:left', width:'27', height:'27', border:"0",
1083 - src: mw.getConfig( 'skin_img_path' ) + 'vid_prev_sm.png' } ) +
1084 - '</a>' +
1085 - '<a id="mv_next_link_' + this.id + '" title="Next Clip" onclick="document.getElementById(\'' + this.id + '\').playNext();return false;" href="#">' +
1086 - getTransparentPng( { id:'mv_next_btn_' + this.id, style:'float:left', width:'27', height:'27', border:"0",
1087 - src: mw.getConfig( 'skin_img_path' ) + 'vid_next_sm.png' } ) +
1088 - '</a>';
1089 - },
10901107 run_transition: function( clip_inx, trans_type ) {
10911108 if ( typeof this.default_track.clips[ clip_inx ][ trans_type ] == 'undefined' )
10921109 clearInterval( this.default_track.clips[ clip_inx ].timerId );
@@ -1093,14 +1110,14 @@
10941111 this.default_track.clips[ clip_inx ][ trans_type ].run_transition();
10951112 },
10961113 getPlayerWidth : function(){
1097 - var player = $j( '#dc_' + this.id ).get( 0 );
 1114+ var player = $j( this ).get( 0 );
10981115 if ( typeof player != 'undefined' && player['offsetWidth'] )
10991116 return player.offsetWidth;
11001117 else
11011118 return parseInt( this.width );
11021119 },
11031120 getPlayerHeight : function(){
1104 - var player = $j( '#dc_' + this.id ).get( 0 );
 1121+ var player = $j( this ).get( 0 );
11051122 if ( typeof player != 'undefined' && player['offsetHeight'] )
11061123 return player.offsetHeight;
11071124 else
@@ -1147,9 +1164,11 @@
11481165 this.embed = null;
11491166 // mw.log('setup embed for clip '+ this.id + ':id is a function?');
11501167 // set up the pl_mwEmbed object:
1151 - var init_pl_embed = { id:'e_' + this.id,
1152 - pc:this, // parent clip
1153 - src:this.src
 1168+ var init_pl_embed = {
 1169+ id: 'e_' + this.id,
 1170+ pc: this, // parent clip
 1171+ src: this.src,
 1172+ controls: false
11541173 };
11551174
11561175 this.setBaseEmbedDim( init_pl_embed );
@@ -1211,8 +1230,8 @@
12121231 },
12131232 setBaseEmbedDim:function( o ) {
12141233 if ( !o )o = this;
1215 - // o.height=Math.round(pl_layout.clip_desc*this.pp.height)-2;//give it some padding:
1216 - // o.width=Math.round(o.height*pl_layout.clip_aspect)-2;
 1234+ // o.height=Math.round(layout.clip_desc*this.pp.height)-2;//give it some padding:
 1235+ // o.width=Math.round(o.height*layout.clip_aspect)-2;
12171236 o.height = this.pp.height;
12181237 o.width = this.pp.width;
12191238 },
@@ -1220,8 +1239,8 @@
12211240 // @@todo
12221241 /*getDetail:function(){
12231242 //mw.log('get detail:' + this.pp.title);
1224 - var th=Math.round( this.pl_layout.clip_desc * this.pp.height );
1225 - var tw=Math.round( th * this.pl_layout.clip_aspect );
 1243+ var th=Math.round( this.layout.clip_desc * this.pp.height );
 1244+ var tw=Math.round( th * this.layout.clip_aspect );
12261245
12271246 var twDesc = (this.pp.width-tw)-2;
12281247
@@ -1340,8 +1359,8 @@
13411360 // set up convenience pointer to parent playlist
13421361 var _this = this.pc.pp;
13431362
1344 - var th = Math.round( _this.pl_layout.clip_desc * _this.height );
1345 - var tw = Math.round( th * _this.pl_layout.clip_aspect );
 1363+ var th = Math.round( _this.layout.clip_desc * _this.height );
 1364+ var tw = Math.round( th * _this.layout.clip_aspect );
13461365
13471366 // run the parent stop:
13481367 this.pe_stop();
@@ -1365,9 +1384,6 @@
13661385 // add playlist clips (if plugin supports it)
13671386 if ( this.pc.pp.cur_clip.embed.playlistSupport() )
13681387 this.pc.pp.loadEmbedPlaylist();
1369 - // color playlist points (if play_head present)
1370 - if ( this.pc.pp.disp_play_head )
1371 - this.pc.pp.colorPlayHead();
13721388 // setup hover images (for playhead and next/prev buttons)
13731389 this.pc.pp.setUpHover();
13741390 // call the parent postEmbedJS
@@ -1380,8 +1396,7 @@
13811397 setStatus:function( value ) {
13821398 // status updates handled by playlist obj
13831399 },
1384 - updatePlayHead:function( value ) {
1385 - //mw.log( 'PlMvEmbed:updatePlayHead:' + value );
 1400+ updatePlayHead:function( value ) {
13861401 // updatePlayHead handled by playlist obj
13871402 }
13881403 }
@@ -1526,29 +1541,32 @@
15271542 * SMIL CODE (could be put into another js file / lazy_loaded for improved basic playlist performance / modularity)
15281543 *****************************/
15291544 /*playlist driver extensions to the playlist object*/
1530 -mw.PlayList.prototype.monitor = function() {
1531 - // mw.log('pl:monitor');
 1545+mw.PlayList.prototype.monitor = function() {
 1546+ var _this = this;
15321547 // if paused stop updates
1533 - if ( this.paused ) {
1534 - // clearInterval( this.smil_monitorTimerId );
 1548+ if ( this.paused ) {
15351549 return ;
1536 - }
 1550+ }
 1551+
 1552+ // Update the playlist current time:
 1553+ var clipCurrentTime = ( this.cur_clip.embed.currentTime )? this.cur_clip.embed.currentTime: 0;
 1554+ this.currentTime = this.cur_clip.dur_offset + clipCurrentTime;
 1555+
15371556 // mw.log("pl check: " + this.currentTime + ' > '+this.getDuration());
15381557 // check if we should be done:
15391558 if ( this.currentTime > this.getDuration() )
15401559 this.stop();
 1560+
15411561
1542 - var relative_time = ( this.startOffset ) ? ( this.currentTime - this.startOffset) : this.currentTime;
1543 -
1544 - // Update the playlist current time:
1545 - // Check for a trsnOut from the previus clip to subtract
1546 - this.currentTime = this.cur_clip.dur_offset + relative_time;
1547 -
1548 - // update slider:
 1562+ // Update slider:
15491563 if ( !this.userSlide ) {
15501564 this.setStatus( mw.seconds2npt( this.currentTime ) + '/' + mw.seconds2npt( this.getDuration() ) );
15511565 this.updatePlayHead( this.currentTime / this.getDuration() );
15521566 }
 1567+
 1568+ //Update buffer info
 1569+ this.updateBufferStatus();
 1570+
15531571 // pre-load any future clips:
15541572 this.loadFutureClips();
15551573
@@ -1556,11 +1574,9 @@
15571575 // status updates are handled by children clips ... playlist mostly manages smil actions
15581576 this.doSmilActions();
15591577
1560 - if ( ! this.smil_monitorTimerId ) {
1561 - if ( document.getElementById( this.id ) ) {
1562 - this.smil_monitorTimerId = setInterval( '$j(\'#' + this.id + '\').get(0).monitor()', 250 );
1563 - }
1564 - }
 1578+ setTimeout( function(){
 1579+ _this.monitor();
 1580+ }, 250);
15651581 }
15661582
15671583 // handles the rendering of overlays load of future clips (if necessary)
@@ -1696,7 +1712,7 @@
16971713 //issue a load request:
16981714 other_pClip.embed.load();
16991715 }
1700 - // manualy ad the extra layer to the activeClipList
 1716+ // Manually ad the extra layer to the activeClipList
17011717 tObj.pClip.pp.activeClipList.add( other_pClip );
17021718 tObj.overlay_selector_id = 'clipDesc_' + other_pClip.id;
17031719 } else {
@@ -1732,7 +1748,8 @@
17331749 }
17341750 return overlay_selector_id;
17351751 },
1736 - doUpdate:function( tObj, percent, callback ) {
 1752+
 1753+ doUpdate: function( tObj, percent, callback ) {
17371754 // init the transition if necessary:
17381755 if ( !tObj.overlay_selector_id )
17391756 this.doInitTransition( tObj );
@@ -1750,10 +1767,12 @@
17511768
17521769 this[ 'type' ][ tObj.type ][ tObj.subtype ].u( tObj, percent, callback);
17531770 },
 1771+
17541772 getTransitionIcon:function( type, subtype ) {
17551773 return mw.getMwEmbedPath() + '/skins/common/transition_images/' + type + '_' + subtype + '.png';
17561774 },
1757 - /*
 1775+
 1776+ /**
17581777 * mvTransLib: functional library mapping:
17591778 */
17601779 type: {
@@ -1762,7 +1781,7 @@
17631782 fadeFromColor: {
17641783 'attr' : ['fadeColor'],
17651784 'init' : function( tObj ) {
1766 - // mw.log('f:fadeFromColor: '+tObj.overlay_selector_id +' to color: '+ tObj.fadeColor);
 1785+ mw.log('f:fadeFromColor: '+tObj.overlay_selector_id +' to color: '+ tObj.fadeColor);
17671786 if ( !tObj.fadeColor )
17681787 mw.log( 'missing fadeColor' );
17691788 if ( $j( '#' + tObj.overlay_selector_id ).length == 0 ) {
@@ -1805,7 +1824,8 @@
18061825 }
18071826 }
18081827
1809 -/* object to manage embedding html with smil timings
 1828+/**
 1829+ * Object to manage embedding html with smil timings
18101830 * grabs settings from parent clip
18111831 */
18121832 var transitionObj = function( element ) {
@@ -1823,8 +1843,9 @@
18241844 overlay_selector_id:null,
18251845 pClip:null,
18261846 timerId:null,
1827 - animation_state:0, // can be 0=unset, 1=running, 2=done
1828 - interValCount:0, // inter-intervalCount for animating between time updates
 1847+ animation_state:0, // can be 0=unset, 1=running, 2=done
 1848+ // inter-intervalCount for animating between time updates
 1849+ interValCount:0,
18291850 dur:2, // default duration of 2
18301851 init:function( element ) {
18311852 // load supported attributes:
@@ -1858,16 +1879,15 @@
18591880 }
18601881 return elmObj;
18611882 },
1862 - /*
1863 - * the main animation loop called every MV_ANIMATION_CB_RATE or 34ms ~around 30frames per second~
 1883+
 1884+ /**
 1885+ * Main animation loop called every MV_ANIMATION_CB_RATE or 34ms ~around 30frames per second~
18641886 */
1865 - run_transition:function() {
1866 - // mw.log('f:run_transition:' + this.interValCount);
1867 -
1868 - // update the time from the video if native:
1869 - if ( typeof this.pClip.embed.vid != 'undefined' ) {
1870 - this.interValCount = 0;
1871 - this.pClip.embed.currentTime = this.pClip.embed.vid.currentTime;
 1887+ run_transition: function() {
 1888+ _this = this;
 1889+ // If we have the playerElement update the time per run_transition call
 1890+ if ( this.pClip.embed.playerElement && this.pClip.embed.playerElement.currentTime ) {
 1891+ this.pClip.embed.currentTime = this.pClip.embed.playerElement.currentTime;
18721892 }
18731893
18741894 // }else{
@@ -1885,23 +1905,11 @@
18861906 mvTransLib.doInitTransition( this );
18871907 this.animation_state = 1;
18881908 }
1889 - // set percentage include diffrence of currentTime to prev_curTime
1890 - // ie updated in-between currentTime updates)
1891 -
1892 - if ( this.transAttrType == 'transIn' )
1893 - var percentage = ( this.pClip.embed.currentTime +
1894 - ( ( this.interValCount * MV_ANIMATION_CB_RATE ) / 1000 )
1895 - ) / this.dur ;
 1909+
 1910+ var percentage = this.pClip.embed.currentTime / this.dur;
18961911
1897 - if ( this.transAttrType == 'transOut' )
1898 - var percentage = ( this.pClip.embed.currentTime +
1899 - ( ( this.interValCount * MV_ANIMATION_CB_RATE ) / 1000 )
1900 - - ( this.pClip.dur - this.dur )
1901 - ) / this.dur ;
 1912+ //mw.log('percentage = ct:'+this.pClip.embed.currentTime + ' + ic:'+this.interValCount +' * cb:'+MV_ANIMATION_CB_RATE +' / ' + this.dur + ' = ' + percentage );
19021913
1903 - /*mw.log('percentage = ct:'+this.pClip.embed.currentTime + ' + ic:'+this.interValCount +' * cb:'+MV_ANIMATION_CB_RATE +
1904 - ' / ' + this.dur + ' = ' + percentage );
1905 - */
19061914
19071915 // mw.log('cur percentage of transition: '+percentage);
19081916 // update state based on current time + cur_time_offset (for now just use pClip.embed.currentTime)
@@ -1910,22 +1918,15 @@
19111919 if ( percentage >= 1 ) {
19121920 mw.log( "transition done update with percentage " + percentage );
19131921 this.animation_state = 2;
1914 - clearInterval( this.timerId );
19151922 mvTransLib.doCloseTransition( this )
19161923 return true;
19171924 }
1918 -
1919 - this.interValCount++;
1920 - // setInterval in we are still in running state and user is not using the playhead
1921 - if ( this.animation_state == 1 ) {
1922 - if ( !this.timerId ) {
1923 - this.timerId = setInterval( 'document.getElementById(\'' + this.pClip.pp.id + '\').' +
1924 - 'run_transition(\'' + this.pClip.pp.cur_clip.order + '\',' +
1925 - '\'' + this.transAttrType + '\')',
1926 - MV_ANIMATION_CB_RATE );
1927 - }
1928 - } else {
1929 - clearInterval( this.timerId );
 1925+
 1926+ // run the animation ( animation_state == 1 && not "paused")
 1927+ if( !this.pClip.pp.paused ){
 1928+ setTimeout( function(){
 1929+ _this.run_transition();
 1930+ }, MV_ANIMATION_CB_RATE);
19301931 }
19311932 return true;
19321933 },
@@ -1975,7 +1976,7 @@
19761977 mw.log( 'skipping transition: (missing id) ' + trans_elm );
19771978 }
19781979 } );
1979 - mw.log( 'loaded transitions:' + _this.transitions.length );
 1980+ mw.log( 'loaded transitions:' + _this.transitions );
19801981
19811982 // Add seq (latter we will have support more than one seq tag) / more than one "track"
19821983 var seq_tags = this.data.getElementsByTagName( 'seq' );
@@ -2227,9 +2228,9 @@
22282229 return this.clipList;
22292230 }
22302231 }
2231 - var trackObj = function( iObj ) {
 2232+var trackObj = function( iObj ) {
22322233 return this.init( iObj );
2233 - }
 2234+}
22342235 var supported_track_attr =
22352236 trackObj.prototype = {
22362237 // should be something like "seq" per SMIL spec
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js
@@ -50,13 +50,23 @@
5151 // Timed text display:
5252 if ( wgPageName.indexOf( "TimedText" ) === 0 ) {
5353 if( wgAction == 'view' ){
54 - mwSetPageToLoading();
55 - }
56 - //load the "player" ( includes call to loadMwEmbed )
57 - mwLoadPlayer(function(){
58 - // Now load MediaWiki TimedText Remote:
59 - mw.load( 'RemoteMwTimedText' );
60 - } );
 54+ var orgBody = mwSetPageToLoading();
 55+ //load the "player" ( includes call to loadMwEmbed )
 56+ mwLoadPlayer(function(){
 57+ // Now load MediaWiki TimedText Remote:
 58+ mw.load( 'RemoteMwTimedText',function(){
 59+ //Setup the remote configuration
 60+ var myRemote = new RemoteMwTimedText( {
 61+ 'action': wgAction,
 62+ 'title' : wgTitle,
 63+ 'target': '#bodyContent',
 64+ 'orgBody': orgBody
 65+ });
 66+ // Update the UI
 67+ myRemote.updateUI();
 68+ } );
 69+ } );
 70+ }
6171 }
6272
6373 // Remote Sequencer
@@ -124,8 +134,9 @@
125135 function mwSetPageToLoading(){
126136 importStylesheetURI( mwEmbedHostPath + '/mwEmbed/skins/mvpcf/styles.css?' + mwGetReqArgs() );
127137 var body = document.getElementById('bodyContent');
 138+ var oldBodyHTML = body.innerHTML;
128139 body.innerHTML = '<div class="loading_spinner"></div>';
129 - return ;
 140+ return oldBodyHTML;
130141 }
131142 /**
132143 * Similar to the player loader in /modules/embedPlayer/loader.js

Status & tagging log