Index: branches/MwEmbedStandAlone/mwEmbed.js |
— | — | @@ -1,6 +1,6 @@ |
2 | | -// Add support for html5 / mwEmbed elements to IE ( comment must come before js code ) |
3 | | -// For discussion and comments, see: http://remysharp.com/2009/01/07/html5-enabling-script/ |
4 | | -/*@cc_on@if(@_jscript_version<9){'video audio source track'.replace(/\w+/g,function(n){document.createElement(n)})}@end@*/ |
| 2 | +// Add support for html5 / mwEmbed elements to browsers that do not support the elements natively |
| 3 | +// For discussion and comments, see: http://ejohn.org/blog/html5-shiv/ |
| 4 | +'video audio source track'.replace(/\w+/g, function(n){ document.createElement(n) }); |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @license |
— | — | @@ -1144,22 +1144,31 @@ |
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | /** |
1148 | | - * Mobile Safari has special properties for html5 video:: |
| 1148 | + * Mobile HTML5 has special properties for html5 video:: |
1149 | 1149 | * |
1150 | | - * NOTE: should be phased out in favor of browser feature detection script |
| 1150 | + * NOTE: should be phased out in favor of browser feature detection where possible |
1151 | 1151 | */ |
1152 | | - mw.isMobileSafari = function() { |
| 1152 | + mw.isMobileHTML5 = function() { |
1153 | 1153 | // check mobile safari foce ( for debug ) |
1154 | | - if( mw.getConfig( 'forceMobileSafari' ) || document.URL.indexOf('forceMobileSafari') != -1 ){ |
| 1154 | + if( mw.getConfig( 'forceMobileHTML5' ) || document.URL.indexOf('forceMobileHTML5') != -1 ){ |
1155 | 1155 | return true; |
1156 | 1156 | } |
1157 | | - if ((navigator.userAgent.indexOf('iPhone') != -1) || |
1158 | | - (navigator.userAgent.indexOf('iPod') != -1) || |
1159 | | - (navigator.userAgent.indexOf('iPad') != -1)) { |
| 1157 | + if (( navigator.userAgent.indexOf('iPhone') != -1) || |
| 1158 | + ( navigator.userAgent.indexOf('iPod') != -1) || |
| 1159 | + ( navigator.userAgent.indexOf('iPad') != -1) || |
| 1160 | + ( mw.isAndroid2() ) |
| 1161 | + ) { |
1160 | 1162 | return true; |
1161 | 1163 | } |
1162 | 1164 | return false; |
1163 | | - } |
| 1165 | + }; |
| 1166 | + // Android 2 has some restrictions vs other mobile platforms |
| 1167 | + mw.isAndroid2 = function(){ |
| 1168 | + if ( navigator.userAgent.indexOf('Android 2.') != -1) { |
| 1169 | + return true; |
| 1170 | + } |
| 1171 | + return false; |
| 1172 | + }; |
1164 | 1173 | |
1165 | 1174 | /** |
1166 | 1175 | * Similar to php isset function checks if the variable exists. Does a safe |
— | — | @@ -1185,7 +1194,7 @@ |
1186 | 1195 | } |
1187 | 1196 | } |
1188 | 1197 | return true; |
1189 | | - } |
| 1198 | + }; |
1190 | 1199 | |
1191 | 1200 | /** |
1192 | 1201 | * Wait for a object to be defined and the call the callback |
— | — | @@ -1268,10 +1277,11 @@ |
1269 | 1278 | |
1270 | 1279 | if ( window.console ) { |
1271 | 1280 | window.console.log( string ); |
1272 | | - } else { |
| 1281 | + } else { |
1273 | 1282 | /** |
1274 | 1283 | * Old IE and non-Firebug debug: ( commented out for now ) |
1275 | | - */ |
| 1284 | + */ |
| 1285 | + |
1276 | 1286 | /*var log_elm = document.getElementById('mv_js_log'); |
1277 | 1287 | if(!log_elm) { |
1278 | 1288 | document.getElementsByTagName("body")[0].innerHTML += '<div ' + |
— | — | @@ -1282,7 +1292,9 @@ |
1283 | 1293 | var log_elm = document.getElementById('mv_js_log'); |
1284 | 1294 | if(log_elm) { |
1285 | 1295 | log_elm.value+=string+"\n"; |
1286 | | - }*/ |
| 1296 | + // scroll to bottom: |
| 1297 | + log_elm.scrollTop = log_elm.scrollHeight; |
| 1298 | + }*/ |
1287 | 1299 | } |
1288 | 1300 | } |
1289 | 1301 | |
— | — | @@ -1390,6 +1402,7 @@ |
1391 | 1403 | if( mw.isset( 'window.jQuery' ) |
1392 | 1404 | && mw.getConfig( 'debug' ) === false |
1393 | 1405 | && typeof $j != 'undefined' |
| 1406 | + && mw.parseUri( url ).protocal != 'file' |
1394 | 1407 | && !isCssFile ) |
1395 | 1408 | { |
1396 | 1409 | $j.getScript( url, myCallback); |
— | — | @@ -1507,18 +1520,13 @@ |
1508 | 1521 | } |
1509 | 1522 | }; |
1510 | 1523 | |
1511 | | - |
1512 | | - // Local mwEmbedPath variable ( for cache of mw.getMwEmbedPath ) |
1513 | | - var mwEmbedPath = null; |
1514 | | - |
| 1524 | + mw.getRelativeMwEmbedPath = function(){ |
| 1525 | + return mw.getMwEmbedPath(true); |
| 1526 | + }; |
1515 | 1527 | /** |
1516 | 1528 | * Get the path to the mwEmbed folder |
1517 | 1529 | */ |
1518 | | - mw.getMwEmbedPath = function() { |
1519 | | - if ( mwEmbedPath ) { |
1520 | | - return mwEmbedPath; |
1521 | | - } |
1522 | | - |
| 1530 | + mw.getMwEmbedPath = function( relativePath ) { |
1523 | 1531 | // Get mwEmbed src: |
1524 | 1532 | var src = mw.getMwEmbedSrc(); |
1525 | 1533 | var mwpath = null; |
— | — | @@ -1539,7 +1547,7 @@ |
1540 | 1548 | if( src.indexOf( 'ResourceLoader.php' ) !== -1 ) { |
1541 | 1549 | mwpath = src.substr( 0, src.indexOf( 'ResourceLoader.php' ) ); |
1542 | 1550 | } |
1543 | | - |
| 1551 | + |
1544 | 1552 | // For static packages mwEmbed packages start with: "mwEmbed-" |
1545 | 1553 | if( src.indexOf( 'mwEmbed-' ) !== -1 && src.indexOf( '-static' ) !== -1 ) { |
1546 | 1554 | mwpath = src.substr( 0, src.indexOf( 'mwEmbed-' ) ); |
— | — | @@ -1552,8 +1560,10 @@ |
1553 | 1561 | } |
1554 | 1562 | |
1555 | 1563 | // Update the cached var with the absolute path: |
1556 | | - mwEmbedPath = mw.absoluteUrl( mwpath ) ; |
1557 | | - return mwEmbedPath; |
| 1564 | + if( !relativePath ){ |
| 1565 | + mwpath = mw.absoluteUrl( mwpath ) ; |
| 1566 | + } |
| 1567 | + return mwpath; |
1558 | 1568 | } |
1559 | 1569 | |
1560 | 1570 | /** |
— | — | @@ -1823,28 +1833,36 @@ |
1824 | 1834 | * from a relative path |
1825 | 1835 | * @return {String} absolute url |
1826 | 1836 | */ |
1827 | | - mw.absoluteUrl = function( src, contextUrl ) { |
| 1837 | +mw.absoluteUrl = function( src, contextUrl ) { |
1828 | 1838 | |
1829 | 1839 | var parsedSrc = mw.parseUri( src ); |
| 1840 | + |
1830 | 1841 | // Source is already absolute return: |
1831 | 1842 | if( parsedSrc.protocol != '') { |
1832 | 1843 | return src; |
1833 | 1844 | } |
1834 | 1845 | |
1835 | 1846 | // Get parent Url location the context URL |
1836 | | - if( contextUrl ) { |
1837 | | - var parsedUrl = mw.parseUri( contextUrl ); |
1838 | | - } else { |
1839 | | - var parsedUrl = mw.parseUri( document.URL ); |
| 1847 | + if( !contextUrl ) { |
| 1848 | + contextUrl = document.URL; |
| 1849 | + } |
| 1850 | + var parsedUrl = mw.parseUri( contextUrl ); |
| 1851 | + |
| 1852 | + // Check for IE local file that does not flip the slashes |
| 1853 | + if( parsedUrl.directory == '' && parsedUrl.protocol == 'file' ){ |
| 1854 | + // pop off the file |
| 1855 | + var fileUrl = contextUrl.split( '\\'); |
| 1856 | + fileUrl.pop(); |
| 1857 | + return fileUrl.join('\\') + '\\' + src; |
1840 | 1858 | } |
1841 | | - |
| 1859 | + |
1842 | 1860 | // Check for leading slash: |
1843 | 1861 | if( src.indexOf( '/' ) === 0 ) { |
1844 | 1862 | return parsedUrl.protocol + '://' + parsedUrl.authority + src; |
1845 | | - }else{ |
| 1863 | + }else{ |
1846 | 1864 | return parsedUrl.protocol + '://' + parsedUrl.authority + parsedUrl.directory + src; |
1847 | 1865 | } |
1848 | | - }; |
| 1866 | + }; |
1849 | 1867 | /** |
1850 | 1868 | * Check if a given source string is likely a url |
1851 | 1869 | * |
— | — | @@ -2164,11 +2182,18 @@ |
2165 | 2183 | } ); |
2166 | 2184 | } |
2167 | 2185 | function addLocalSettings(){ |
2168 | | - mw.log("Load loacal settings") |
2169 | | - mw.load( 'localSettings.js', function(){ |
| 2186 | + var continueCallback = function(){ |
2170 | 2187 | // Set the mwModuleLoaderCheckFlag flag to true |
2171 | 2188 | mwModuleLoaderCheckFlag = true; |
2172 | 2189 | callback(); |
| 2190 | + } |
| 2191 | + if( mw.getConfig( 'LoadLocalSettings') != true ){ |
| 2192 | + continueCallback(); |
| 2193 | + return; |
| 2194 | + } |
| 2195 | + mw.log("Load loacal settings") |
| 2196 | + mw.load( 'localSettings.js', function(){ |
| 2197 | + continueCallback(); |
2173 | 2198 | }) |
2174 | 2199 | } |
2175 | 2200 | |
Index: branches/MwEmbedStandAlone/ResourceLoader.php |
— | — | @@ -160,14 +160,12 @@ |
161 | 161 | wfRestoreWarnings(); |
162 | 162 | } |
163 | 163 | |
164 | | - // Add the required core mwEmbed style sheets removed for now |
165 | | - // because when creating stand alone packages js package with css |
| 164 | + // Add the required core mwEmbed style sheets |
| 165 | + // removed for now because when creating stand alone packages js package with css |
166 | 166 | // the paths get messed up. |
167 | | - /* |
168 | | - if( !isset( $this->namedFileList[ 'mw.style.mwCommon' ] ) ) { |
| 167 | + /*if( !isset( $this->namedFileList[ 'mw.style.mwCommon' ] ) ) { |
169 | 168 | $this->output .= $this->getResourceText( 'mw.style.mwCommon' ); |
170 | | - } |
171 | | - */ |
| 169 | + }*/ |
172 | 170 | |
173 | 171 | // Output "special" IE comment tag to support "special" mwEmbed tags. |
174 | 172 | $this->notMinifiedTopOutput .='/*@cc_on@if(@_jscript_version<9){\'video audio source itext playlist\'.replace(/\w+/g,function(n){document.createElement(n)})}@end@*/'."\n"; |
Index: branches/MwEmbedStandAlone/includes/noMediaWikiConfig.php |
— | — | @@ -151,6 +151,9 @@ |
152 | 152 | if( $wgLoadedMsgKeysFlag ) { |
153 | 153 | return true; |
154 | 154 | } |
| 155 | + if( !$wgMessageCache ){ |
| 156 | + $wgMessageCache = array(); |
| 157 | + } |
155 | 158 | foreach( $wgExtensionMessagesFiles as $msgFile ){ |
156 | 159 | if( !is_file( $msgFile ) ) { |
157 | 160 | throw new MWException( "Missing msgFile: " . htmlspecialchars( $msgFile ) . "\n" ); |
Index: branches/MwEmbedStandAlone/modules/Playlist/tests/Player_MediaRss.html |
— | — | @@ -14,8 +14,8 @@ |
15 | 15 | |
16 | 16 | <script type="text/javascript"> |
17 | 17 | // For testing safari in chrome / |
18 | | - if( document.URL.indexOf('forceMobileSafari') != -1 ){ |
19 | | - mw.setConfig( 'forceMobileSafari' , true ); |
| 18 | + if( document.URL.indexOf('forceMobileHTML5') != -1 ){ |
| 19 | + mw.setConfig( 'forceMobileHTML5' , true ); |
20 | 20 | } |
21 | 21 | |
22 | 22 | mw.ready( function(){ |
Index: branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js |
— | — | @@ -257,7 +257,7 @@ |
258 | 258 | $videoList.show() |
259 | 259 | // show the video list and apply the swipe binding |
260 | 260 | $j( _this.target ).find('.media-rss-video-list-wrapper').fadeIn(); |
261 | | - if( mw.isMobileSafari() ){ |
| 261 | + if( mw.isMobileHTML5() ){ |
262 | 262 | // iScroll is buggy with current version of iPad / iPhone use scroll buttons instead |
263 | 263 | /* |
264 | 264 | document.addEventListener('touchmove', function(e){ e.preventDefault(); }); |
— | — | @@ -434,7 +434,7 @@ |
435 | 435 | // ( mobile safari can't javascript start the video ) |
436 | 436 | // see: http://developer.apple.com/iphone/search/search.php?simp=1&num=10&Search=html5+autoplay |
437 | 437 | var addVideoPlayerToDom = true; |
438 | | - if( mw.isMobileSafari() ){ |
| 438 | + if( mw.isMobileHTML5() ){ |
439 | 439 | // Check for a current video: |
440 | 440 | var $inDomVideo = $j( _this.target + ' .media-rss-video-player video' ); |
441 | 441 | if( $inDomVideo.length == 0 ){ |
Index: branches/MwEmbedStandAlone/modules/TimedText/mw.TimedText.js |
— | — | @@ -11,36 +11,7 @@ |
12 | 12 | * |
13 | 13 | */ |
14 | 14 | |
15 | | -mw.addMessages( { |
16 | | - "mwe-timedtext-back-btn" : "Back", |
17 | | - "mwe-timedtext-choose-text" : "Chose text", |
18 | | - "mwe-timedtext-add-timed-text" : "Add timed text", |
19 | | - "mwe-timedtext-loading-text-edit" : "Loading timed text editor", |
20 | | - |
21 | | - "mwe-timedtext-search" : "Search clip", |
22 | | - |
23 | | - "mwe-timedtext-layout" : "Layout", |
24 | | - "mwe-timedtext-layout-ontop" : "Ontop of video", |
25 | | - "mwe-timedtext-layout-below": "Below video", |
26 | | - "mwe-timedtext-layout-off" : "Hide subtitles", |
27 | | - |
28 | | - "mwe-timedtext-loading-text" : "Loading text ...", |
29 | | - |
30 | | - "mwe-timedtext-key-language": "$1, $2", |
31 | | - |
32 | | - "mwe-timedtext-textcat-cc" : "Captions", |
33 | | - "mwe-timedtext-textcat-sub" : "Subtitles", |
34 | | - "mwe-timedtext-textcat-tad" : "Audio description", |
35 | | - "mwe-timedtext-textcat-ktv" : "Karaoke", |
36 | | - "mwe-timedtext-textcat-tik" : "Ticker text", |
37 | | - "mwe-timedtext-textcat-ar" : "Active regions", |
38 | | - "mwe-timedtext-textcat-nb" : "Annotation", |
39 | | - "mwe-timedtext-textcat-meta" : "Timed metadata", |
40 | | - "mwe-timedtext-textcat-trx" : "Transcript", |
41 | | - "mwe-timedtext-textcat-lrc" : "Lyrics", |
42 | | - "mwe-timedtext-textcat-lin" : "Linguistic markup", |
43 | | - "mwe-timedtext-textcat-cue" : "Cue points" |
44 | | -} ); |
| 15 | +mw.includeAllModuleMessages(); |
45 | 16 | |
46 | 17 | // Bind to mw ( for uncluttered global namespace ) |
47 | 18 | ( function( $ ) { |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js |
— | — | @@ -166,15 +166,17 @@ |
167 | 167 | |
168 | 168 | // Set up the embed video player class request: (include the skin js as well) |
169 | 169 | var dependencyRequest = [ |
| 170 | + [ |
| 171 | + 'mw.EmbedPlayer' |
| 172 | + ], |
170 | 173 | [ |
171 | | - '$j.ui', |
172 | | - 'mw.EmbedPlayer', |
173 | | - 'mw.PlayerControlBuilder', |
| 174 | + 'mw.PlayerControlBuilder', |
174 | 175 | '$j.fn.hoverIntent', |
175 | 176 | 'mw.style.EmbedPlayer', |
176 | 177 | '$j.cookie', |
177 | 178 | // Add JSON lib if browsers does not define "JSON" natively |
178 | 179 | 'JSON', |
| 180 | + '$j.ui', |
179 | 181 | '$j.widget' |
180 | 182 | ], |
181 | 183 | [ |
— | — | @@ -189,7 +191,7 @@ |
190 | 192 | // Pass every tag being rewritten through the update request function |
191 | 193 | $j( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).each( function() { |
192 | 194 | var playerElement = this; |
193 | | - mw.embedPlayerUpdateLibraryRequest( playerElement, dependencyRequest[ 0 ] ) |
| 195 | + mw.embedPlayerUpdateLibraryRequest( playerElement, dependencyRequest[ 1 ] ) |
194 | 196 | } ); |
195 | 197 | |
196 | 198 | // Add PNG fix code needed: |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_Sources.html |
— | — | @@ -17,4 +17,4 @@ |
18 | 18 | |
19 | 19 | |
20 | 20 | </body> |
21 | | -</html> |
\ No newline at end of file |
| 21 | +</html> |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -11,68 +11,7 @@ |
12 | 12 | * Add the messages text: |
13 | 13 | */ |
14 | 14 | |
15 | | -mw.addMessages( { |
16 | | - "mwe-embedplayer-loading_plugin" : "Loading plugin ...", |
17 | | - "mwe-embedplayer-select_playback" : "Set playback preference", |
18 | | - "mwe-embedplayer-link_back" : "Link back", |
19 | | - "mwe-embedplayer-error_swap_vid" : "Error: mwEmbed was unable to swap the video tag for the mwEmbed interface", |
20 | | - "mwe-embedplayer-add_to_end_of_sequence" : "Add to end of sequence", |
21 | | - "mwe-embedplayer-missing_video_stream" : "The video file for this stream is missing", |
22 | | - "mwe-embedplayer-play_clip" : "Play clip", |
23 | | - "mwe-embedplayer-pause_clip" : "Pause clip", |
24 | | - "mwe-embedplayer-volume_control" : "Volume control", |
25 | | - "mwe-embedplayer-player_options" : "Player options", |
26 | | - "mwe-embedplayer-timed_text" : "Timed text", |
27 | | - "mwe-embedplayer-player_fullscreen" : "Fullscreen", |
28 | | - "mwe-embedplayer-next_clip_msg" : "Play next clip", |
29 | | - "mwe-embedplayer-prev_clip_msg" : "Play previous clip", |
30 | | - "mwe-embedplayer-current_clip_msg" : "Continue playing this clip", |
31 | | - "mwe-embedplayer-seek_to" : "Seek $1", |
32 | | - "mwe-embedplayer-paused" : "paused", |
33 | | - "mwe-embedplayer-download_segment" : "Download selection:", |
34 | | - "mwe-embedplayer-download_full" : "Download full video file:", |
35 | | - "mwe-embedplayer-download_right_click" : "To download, right click and select <i>Save link as...<\/i>", |
36 | | - "mwe-embedplayer-download_clip" : "Download video", |
37 | | - "mwe-embedplayer-download_text" : "Download timed text", |
38 | | - "mwe-embedplayer-download" : "Download", |
39 | | - "mwe-embedplayer-share" : "Share", |
40 | | - "mwe-embedplayer-about-library" : "About kaltura player", |
41 | | - "mwe-embedplayer-about-library-desc" : "Kaltura's HTML5 Media Library enables you to take advantage of the html5 <video> and <audio> tags today with a consistent player interface across all major browsers. <br> <br> [$1 More about the kaltura player library]", |
42 | | - "mwe-embedplayer-credits" : "Credits", |
43 | | - "mwe-embedplayer-clip_linkback" : "Clip source page", |
44 | | - "mwe-embedplayer-choose_player" : "Choose video player", |
45 | | - "mwe-embedplayer-no-player" : "No player available for $1", |
46 | | - "mwe-embedplayer-share_this_video" : "Share this video", |
47 | | - "mwe-embedplayer-video_credits" : "Video credits", |
48 | | - "mwe-embedplayer-kaltura-platform-title" : "Kaltura open source video platform", |
49 | | - "mwe-embedplayer-menu_btn" : "Menu", |
50 | | - "mwe-embedplayer-close_btn" : "Close", |
51 | | - "mwe-embedplayer-ogg-player-vlc-player" : "VLC player", |
52 | | - "mwe-embedplayer-ogg-player-oggNative" : "HTML5 Ogg player", |
53 | | - "mwe-embedplayer-ogg-player-h264Native" : "HTML5 H.264 player", |
54 | | - "mwe-embedplayer-ogg-player-oggPlugin" : "Generic Ogg plugin", |
55 | | - "mwe-embedplayer-ogg-player-quicktime-mozilla" : "QuickTime plugin", |
56 | | - "mwe-embedplayer-ogg-player-quicktime-activex" : "QuickTime ActiveX", |
57 | | - "mwe-embedplayer-ogg-player-cortado" : "Java Cortado", |
58 | | - "mwe-embedplayer-ogg-player-flowplayer" : "Flowplayer", |
59 | | - "mwe-embedplayer-ogg-player-kplayer" : "Kaltura player", |
60 | | - "mwe-embedplayer-ogg-player-selected" : "(selected)", |
61 | | - "mwe-embedplayer-generic_missing_plugin" : "You browser does not appear to support the following playback type: <b>$1<\/b><br \/>Visit the <a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Media_help\">Playback methods<\/a> page to download a player.<br \/>", |
62 | | - "mwe-embedplayer-missing-source" : "No source video was found", |
63 | | - "mwe-embedplayer-for_best_experience" : "For a better video playback experience we recommend the <b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">latest Firefox<\/a>.<\/b>", |
64 | | - "mwe-embedplayer-do_not_warn_again" : "Dismiss for now.", |
65 | | - "mwe-embedplayer-playerSelect" : "Players", |
66 | | - "mwe-embedplayer-read_before_embed" : "<a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read this<\/a> before embedding.", |
67 | | - "mwe-embedplayer-embed_site_or_blog" : "Embed on a page", |
68 | | - "mwe-embedplayer-related_videos" : "Related videos", |
69 | | - "mwe-embedplayer-seeking" : "seeking", |
70 | | - "mwe-embedplayer-buffering" : "buffering", |
71 | | - "mwe-embedplayer-copy-code" : "Copy code", |
72 | | - "mwe-embedplayer-video-h264" : "H.264 video", |
73 | | - "mwe-embedplayer-video-flv" : "Flash video", |
74 | | - "mwe-embedplayer-video-ogg" : "Ogg video", |
75 | | - "mwe-embedplayer-video-audio" : "Ogg audio" |
76 | | -} ); |
| 15 | +mw.includeAllModuleMessages(); |
77 | 16 | |
78 | 17 | /* |
79 | 18 | * The default video attributes supported by embedPlayer |
— | — | @@ -335,7 +274,8 @@ |
336 | 275 | } |
337 | 276 | var addedToPlayerManager = false; |
338 | 277 | // Make sure we have user preference setup ( for setting preferences on video selection ) |
339 | | - mw.setupUserConfig( function() { |
| 278 | + mw.setupUserConfig( function() { |
| 279 | + mw.log("EmbedPlayer:: found: " + $j( playerSelect ).length + ' players '); |
340 | 280 | // Add each selected element to the player manager: |
341 | 281 | $j( playerSelect ).each( function( index, playerElement) { |
342 | 282 | // Make sure the video tag was not generated by our library: |
— | — | @@ -1153,7 +1093,7 @@ |
1154 | 1094 | /** |
1155 | 1095 | * Selects the default source via cookie preference, default marked, or by id order |
1156 | 1096 | */ |
1157 | | - autoSelectSource: function() { |
| 1097 | + autoSelectSource: function() { |
1158 | 1098 | mw.log( 'EmbedPlayer::mediaElement::autoSelectSource:' + this.id); |
1159 | 1099 | // Select the default source |
1160 | 1100 | var playableSources = this.getPlayableSources(); |
— | — | @@ -1163,7 +1103,7 @@ |
1164 | 1104 | for ( var source = 0; source < playableSources.length; source++ ) { |
1165 | 1105 | var mimeType = playableSources[source].mimeType; |
1166 | 1106 | if ( mw.EmbedTypes.players.preference[ 'format_preference' ] == mimeType ) { |
1167 | | - mw.log( 'set via preference: ' + playableSources[source].mimeType ); |
| 1107 | + mw.log( 'Set via preference: ' + playableSources[source].mimeType ); |
1168 | 1108 | this.selectedSource = playableSources[source]; |
1169 | 1109 | return true; |
1170 | 1110 | } |
— | — | @@ -1172,17 +1112,18 @@ |
1173 | 1113 | // Set via marked default: |
1174 | 1114 | for ( var source = 0; source < playableSources.length; source++ ) { |
1175 | 1115 | if ( playableSources[ source ].markedDefault ) { |
1176 | | - mw.log( 'set via marked default: ' + playableSources[source].markedDefault ); |
| 1116 | + mw.log( 'Set via marked default: ' + playableSources[source].markedDefault ); |
1177 | 1117 | this.selectedSource = playableSources[source]; |
1178 | 1118 | return true; |
1179 | 1119 | } |
1180 | 1120 | } |
1181 | 1121 | |
1182 | | - // Set native client for flash |
| 1122 | + // Prefer native playback |
1183 | 1123 | for ( var source = 0; source < playableSources.length; source++ ) { |
1184 | 1124 | var mimeType = playableSources[source].mimeType; |
1185 | 1125 | var player = mw.EmbedTypes.players.defaultPlayer( mimeType ); |
1186 | | - if ( this.isOgg( mimeType ) && player && player.library == 'Native' ) { |
| 1126 | + if ( player && player.library == 'Native' ) { |
| 1127 | + mw.log('Set native playback'); |
1187 | 1128 | this.selectedSource = playableSources[ source ]; |
1188 | 1129 | return true; |
1189 | 1130 | } |
— | — | @@ -1199,7 +1140,8 @@ |
1200 | 1141 | || |
1201 | 1142 | player.library == 'Kplayer' |
1202 | 1143 | ) |
1203 | | - ) { |
| 1144 | + ) { |
| 1145 | + mw.log('Set h264 via native or flash fallback'); |
1204 | 1146 | this.selectedSource = playableSources[ source ]; |
1205 | 1147 | return true; |
1206 | 1148 | } |
— | — | @@ -2396,7 +2338,7 @@ |
2397 | 2339 | * @returns boolean true if the mwEmbed player interface should be used |
2398 | 2340 | * false if the mwEmbed player interface should not be used |
2399 | 2341 | */ |
2400 | | - shouldUseNativeControls: function() { |
| 2342 | + shouldUseNativeControls: function() { |
2401 | 2343 | if( this.usenativecontrols === true ){ |
2402 | 2344 | return true; |
2403 | 2345 | } |
— | — | @@ -2405,7 +2347,7 @@ |
2406 | 2348 | return true; |
2407 | 2349 | } |
2408 | 2350 | if( mw.getConfig('EmbedPlayer.NativeControlsMobileSafari' ) && |
2409 | | - mw.isMobileSafari() |
| 2351 | + mw.isMobileHTML5() |
2410 | 2352 | ){ |
2411 | 2353 | return true; |
2412 | 2354 | } |
— | — | @@ -2430,9 +2372,9 @@ |
2431 | 2373 | |
2432 | 2374 | |
2433 | 2375 | // Check if we need to refresh mobile safari |
2434 | | - var mobileSafairNeedsRefresh = false; |
| 2376 | + var mobileSafariNeedsRefresh = false; |
2435 | 2377 | |
2436 | | - // Unhide the original video element |
| 2378 | + // Unhide the original video element if not part of a playerThemer embed |
2437 | 2379 | if( !$j( '#' + this.pid ).hasClass('PlayerThemer') ){ |
2438 | 2380 | $j( '#' + this.pid ) |
2439 | 2381 | .css( { |
— | — | @@ -2441,12 +2383,12 @@ |
2442 | 2384 | .show() |
2443 | 2385 | .attr('controls', 'true'); |
2444 | 2386 | |
2445 | | - mobileSafairNeedsRefresh = true; |
| 2387 | + mobileSafariNeedsRefresh = true; |
2446 | 2388 | } |
2447 | 2389 | |
2448 | 2390 | // iPad does not handle video tag update for attributes like "controls" |
2449 | 2391 | // so we have to do a full replace ( if controls are not included initially ) |
2450 | | - if( mw.isMobileSafari() && mobileSafairNeedsRefresh ) { |
| 2392 | + if( mw.isMobileHTML5() && mobileSafariNeedsRefresh ) { |
2451 | 2393 | var source = this.mediaElement.getSources( 'video/h264' )[0]; |
2452 | 2394 | if( source && ! source.src ){ |
2453 | 2395 | mw.log( 'Error: should have caught no playable sources for mobile safari earlier' ); |
— | — | @@ -2465,20 +2407,43 @@ |
2466 | 2408 | var cssStyle = { |
2467 | 2409 | 'width' : _this.width, |
2468 | 2410 | 'height' : _this.height |
2469 | | - }; |
| 2411 | + }; |
2470 | 2412 | $j( '#' + this.pid ).replaceWith( |
2471 | 2413 | _this.getNativePlayerHtml( videoAttribues, cssStyle ) |
2472 | 2414 | ) |
2473 | 2415 | // Bind native events: |
2474 | 2416 | this.applyMediaElementBindings(); |
2475 | 2417 | } |
| 2418 | + // Android only can play with a special play button ( no native controls in the dom , and no auto-play ) |
| 2419 | + // and only with 'native display' |
| 2420 | + if( mw.isAndroid2() ){ |
| 2421 | + $j( '#' + _this.pid ).siblings('.play-btn-large').remove(); |
| 2422 | + $j( '#' + _this.pid ).after( |
| 2423 | + $j('<div />') |
| 2424 | + .css({ |
| 2425 | + 'position' : 'relative', |
| 2426 | + 'top' : -1 * ( .5 * _this.getPlayerHeight() ) - 52, |
| 2427 | + 'left' : ( .5 * _this.getPlayerWidth() ) - 75 |
| 2428 | + }) |
| 2429 | + .attr( { |
| 2430 | + 'title' : gM( 'mwe-embedplayer-play_clip' ), |
| 2431 | + 'class' : "ui-state-default play-btn-large" |
| 2432 | + } ) |
| 2433 | + .click( function() { |
| 2434 | + _this.play(); |
| 2435 | + // no need to hide the play button since android plays fullscreen |
| 2436 | + } ) |
| 2437 | + ) |
| 2438 | + } |
2476 | 2439 | return ; |
2477 | 2440 | }, |
2478 | 2441 | /** |
2479 | 2442 | * Should be set via native embed support |
2480 | 2443 | */ |
2481 | 2444 | getNativePlayerHtml: function(){ |
2482 | | - return $j('<div />' ).html( 'Error: Trying to get native html5 player without native support for codec' ); |
| 2445 | + return $j('<div />' ) |
| 2446 | + .css( 'width', this.getWidth() ) |
| 2447 | + .html( 'Error: Trying to get native html5 player without native support for codec' ); |
2483 | 2448 | }, |
2484 | 2449 | /** |
2485 | 2450 | * Should be set via native embed support |
— | — | @@ -3467,7 +3432,7 @@ |
3468 | 3433 | * @param {String} mimeType Mime type for the associated player stream |
3469 | 3434 | */ |
3470 | 3435 | setPlayerPreference : function( playerId, mimeType ) { |
3471 | | - var selectedPlayer = null; |
| 3436 | + var selectedPlayer = null; |
3472 | 3437 | for ( var i = 0; i < this.players.length; i++ ) { |
3473 | 3438 | if ( this.players[i].id == playerId ) { |
3474 | 3439 | selectedPlayer = this.players[i]; |
— | — | @@ -3597,12 +3562,16 @@ |
3598 | 3563 | } |
3599 | 3564 | |
3600 | 3565 | // Test for h264: |
3601 | | - if ( dummyvid.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"' ) ) { |
| 3566 | + if ( dummyvid.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"' ) ) { |
3602 | 3567 | this.players.addPlayer( h264NativePlayer ); |
3603 | 3568 | } |
| 3569 | + // For now if Android assume we support h264Native (FIXME test on real devices ) |
| 3570 | + if ( mw.isAndroid2() ){ |
| 3571 | + this.players.addPlayer( h264NativePlayer ); |
| 3572 | + } |
3604 | 3573 | |
3605 | 3574 | // Test for ogg |
3606 | | - if ( dummyvid.canPlayType( "video/ogg;codecs=\"theora,vorbis\"" ) ) { |
| 3575 | + if ( dummyvid.canPlayType( 'video/ogg; codecs="theora,vorbis"' ) ) { |
3607 | 3576 | this.players.addPlayer( oggNativePlayer ); |
3608 | 3577 | // older versions of safari do not support canPlayType, |
3609 | 3578 | // but xiph qt registers mimetype via quicktime plugin |
— | — | @@ -3613,7 +3582,7 @@ |
3614 | 3583 | } catch ( e ) { |
3615 | 3584 | mw.log( 'could not run canPlayType ' + e ); |
3616 | 3585 | } |
3617 | | - } |
| 3586 | + } |
3618 | 3587 | |
3619 | 3588 | // "navigator" plugins |
3620 | 3589 | if ( navigator.mimeTypes && navigator.mimeTypes.length > 0 ) { |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js |
— | — | @@ -2,10 +2,6 @@ |
3 | 3 | * Skin js allows you to override contrlBuilder html/class output |
4 | 4 | */ |
5 | 5 | |
6 | | -mw.addMessages( { |
7 | | - "mwe-embedplayer-credit-title" : "Title: $1" |
8 | | -} ); |
9 | | - |
10 | 6 | mw.PlayerSkinKskin = { |
11 | 7 | |
12 | 8 | // The parent class for all kskin css: |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js |
— | — | @@ -984,10 +984,10 @@ |
985 | 985 | * |
986 | 986 | * @param {String} overlayContent content to be displayed |
987 | 987 | */ |
988 | | - displayOverlay: function( overlayContent ) { |
| 988 | + displayMenuOverlay: function( overlayContent ) { |
989 | 989 | var _this = this; |
990 | 990 | var embedPlayer = this.embedPlayer; |
991 | | - mw.log( 'displayOverlay::' ); |
| 991 | + mw.log( 'displayMenuOverlay::' ); |
992 | 992 | // set the overlay display flag to true: |
993 | 993 | this.displayOptionsMenuFlag = true; |
994 | 994 | mw.log(" set displayOptionsMenuFlag:: " + this.displayOptionsMenuFlag); |
— | — | @@ -1069,11 +1069,9 @@ |
1070 | 1070 | $overlayShadow |
1071 | 1071 | ) |
1072 | 1072 | .find( '.overlay-win' ) |
1073 | | - .fadeIn( "slow" ); |
| 1073 | + .fadeIn( "slow" ); |
1074 | 1074 | |
1075 | | - |
1076 | | - // trigger menu overlay display |
1077 | | - alert('triger displayMenuOverlay'); |
| 1075 | + // trigger menu overlay display |
1078 | 1076 | $j(embedPlayer).trigger( 'displayMenuOverlay' ); |
1079 | 1077 | |
1080 | 1078 | return false; // onclick action return false |
— | — | @@ -1223,8 +1221,8 @@ |
1224 | 1222 | .click( function() { |
1225 | 1223 | var iparts = $j( this ).attr( 'id' ).replace(/sc_/ , '' ).split( '_' ); |
1226 | 1224 | var sourceId = iparts[0]; |
1227 | | - var default_player_id = iparts[1]; |
1228 | | - mw.log( 'source id: ' + sourceId + ' player id: ' + default_player_id ); |
| 1225 | + var player_id = iparts[1]; |
| 1226 | + mw.log( 'source id: ' + sourceId + ' player id: ' + player_id ); |
1229 | 1227 | |
1230 | 1228 | embedPlayer.controlBuilder.closeMenuOverlay(); |
1231 | 1229 | |
— | — | @@ -1234,10 +1232,11 @@ |
1235 | 1233 | } |
1236 | 1234 | |
1237 | 1235 | embedPlayer.mediaElement.selectSource( sourceId ); |
1238 | | - |
| 1236 | + var playableSources = embedPlayer.mediaElement.getPlayableSources(); |
| 1237 | + |
1239 | 1238 | mw.EmbedTypes.players.setPlayerPreference( |
1240 | | - default_player_id, |
1241 | | - embedPlayer.mediaElement.sources[ sourceId ].getMIMEType() |
| 1239 | + player_id, |
| 1240 | + playableSources[ sourceId ].getMIMEType() |
1242 | 1241 | ); |
1243 | 1242 | |
1244 | 1243 | // Issue a stop |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mvpcf/mw.style.PlayerSkinMvpcf.css |
— | — | @@ -49,11 +49,6 @@ |
50 | 50 | position:relative; |
51 | 51 | } |
52 | 52 | |
53 | | -.controls a{ |
54 | | - display: block; |
55 | | - height: 100%; |
56 | | - width: 100%; |
57 | | -} |
58 | 53 | .mv-player .volume_icon { |
59 | 54 | float: right; |
60 | 55 | display: inline; |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | updateFeatureSupport: function(){ |
48 | 48 | // iWhatever devices appear to have a broken |
49 | 49 | // dom overlay implementation of video atm. (hopefully iphone OS 4 fixes this ) |
50 | | - if( mw.isMobileSafari() ) { |
| 50 | + if( mw.isMobileHTML5() ) { |
51 | 51 | this.supports.overlays = false; |
52 | 52 | } |
53 | 53 | }, |
— | — | @@ -173,12 +173,12 @@ |
174 | 174 | // Bind events to local js methods: |
175 | 175 | vid.addEventListener( 'canplaythrogh', function() { $j( _this ).trigger('canplaythrough'); }, true); |
176 | 176 | vid.addEventListener( 'loadedmetadata', function() { _this.onloadedmetadata() }, true); |
177 | | - vid.addEventListener( 'progress', function( e ) { _this.onprogress( e ); }, true); |
| 177 | + vid.addEventListener( 'progress', function( e ) { if( _this.onprogress ) { _this.onprogress( e ); } }, true); |
178 | 178 | vid.addEventListener( 'ended', function() { _this.onended() }, true); |
179 | 179 | vid.addEventListener( 'seeking', function() { _this.onSeeking() }, true); |
180 | 180 | vid.addEventListener( 'seeked', function() { _this.onSeeked() }, true); |
181 | 181 | |
182 | | - vid.addEventListener( 'pause', function() { _this.onPaused() }, true ); |
| 182 | + vid.addEventListener( 'pause', function() { if( _this.onPaused ) { _this.onPaused() } }, true ); |
183 | 183 | vid.addEventListener( 'play', function(){ _this.onPlay() }, true ); |
184 | 184 | vid.addEventListener( 'volumechange', function(){ _this.onVolumeChange() } , true ); |
185 | 185 | }, |
— | — | @@ -364,6 +364,15 @@ |
365 | 365 | this.monitor(); |
366 | 366 | } |
367 | 367 | }, |
| 368 | + /** |
| 369 | + * Stop the player ( end all listeners ) |
| 370 | + */ |
| 371 | + stop:function(){ |
| 372 | + if( this.playerElement ){ |
| 373 | + $j( this.playerElement ).unbind(); |
| 374 | + } |
| 375 | + this.parent_stop(); |
| 376 | + }, |
368 | 377 | |
369 | 378 | /** |
370 | 379 | * Toggle the Mute |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerKplayer.js |
— | — | @@ -31,13 +31,20 @@ |
32 | 32 | * Write the Embed html to the target |
33 | 33 | */ |
34 | 34 | doEmbedHTML : function () { |
35 | | - var _this = this; |
36 | | - var playerPath = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/kaltura-player'; |
| 35 | + var _this = this; |
37 | 36 | |
38 | 37 | mw.log("kPlayer:: embed src::" + _this.getSrc() ); |
39 | 38 | var flashvars = {}; |
40 | 39 | flashvars.autoPlay = "true"; |
| 40 | + var playerPath = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/kaltura-player'; |
41 | 41 | flashvars.entryId = mw.absoluteUrl( _this.getSrc() ); |
| 42 | + |
| 43 | + // Use a relative url if the protocal is file:// |
| 44 | + if( mw.parseUri( document.URL).protocol == 'file' ) { |
| 45 | + playerPath = mw.getRelativeMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/kaltura-player'; |
| 46 | + flashvars.entryId = _this.getSrc(); |
| 47 | + } |
| 48 | + |
42 | 49 | flashvars.debugMode = "true"; |
43 | 50 | flashvars.fileSystemMode = "true"; |
44 | 51 | flashvars.widgetId = "_7463"; |
— | — | @@ -208,6 +215,7 @@ |
209 | 216 | doSeek: function( percentage ) { |
210 | 217 | var _this = this; |
211 | 218 | if ( this.supportsURLTimeEncoding() ){ |
| 219 | + |
212 | 220 | // Make sure we could not do a local seek instead: |
213 | 221 | if ( !( percentage < this.bufferedPercent && this.playerElement.duration && !this.didSeekJump )) { |
214 | 222 | // We support URLTimeEncoding call parent seek: |
— | — | @@ -216,10 +224,8 @@ |
217 | 225 | } |
218 | 226 | } |
219 | 227 | |
220 | | - |
221 | 228 | if( this.playerElement ) { |
222 | | - var seekTime = percentage * this.getDuration(); |
223 | | - |
| 229 | + var seekTime = percentage * this.getDuration(); |
224 | 230 | // Issue the seek to the flash player: |
225 | 231 | this.playerElement.sendNotification('doSeek', seekTime); |
226 | 232 | |