Index: branches/MwEmbedStandAlone/mwEmbedFrame.php |
— | — | @@ -6,10 +6,6 @@ |
7 | 7 | * |
8 | 8 | * This enables sharing mwEmbed player without js includes ie: |
9 | 9 | * |
10 | | - * <object data="mwEmbedFrame.php?apiTitleKey=MyFile.ogg" > </object> |
11 | | - * |
12 | | - * or |
13 | | - * |
14 | 10 | * <iframe src="mwEmbedFrame.php?src={SRC URL}&poster={POSTER URL}&width={WIDTH}etc"> </iframe> |
15 | 11 | */ |
16 | 12 | |
— | — | @@ -26,31 +22,20 @@ |
27 | 23 | /** |
28 | 24 | * Variables set by the Frame request: |
29 | 25 | */ |
30 | | - // The default width of the embedFrame |
31 | | - var $width = null; |
| 26 | + var $playerAttributes = array( |
| 27 | + 'apiTitleKey', |
| 28 | + 'apiProvider', |
| 29 | + 'durationHint', |
| 30 | + 'poster', |
| 31 | + 'kEntryId', |
| 32 | + 'kWidgetId' , |
| 33 | + 'skin' |
| 34 | + ); |
32 | 35 | |
33 | | - // The default height of the embedFrame |
34 | | - var $height = null; |
35 | | - |
36 | | - // The apiTitleKey used for mediaWiki asset lookup |
37 | | - var $apiTitleKey = null; |
38 | | - |
39 | | - // The entryId used for kaltura media asset lookup |
40 | | - var $entryId = null; |
41 | | - |
42 | | - // The player skin ( can be mvpcf or kskin ) |
43 | | - var $skin = null; |
44 | | - |
45 | | - // The duration of the media asset. |
46 | | - var $durationHint = null; |
47 | | - |
48 | 36 | // When used in direct source mode the source asset. |
49 | 37 | // NOTE: can be an array of sources in cases of "many" sources set |
50 | 38 | var $sources = array(); |
51 | 39 | |
52 | | - // Poster src url for video embed |
53 | | - var $poster = null; |
54 | | - |
55 | 40 | function __construct(){ |
56 | 41 | //parse input: |
57 | 42 | $this->parseRequest(); |
— | — | @@ -61,19 +46,15 @@ |
62 | 47 | } |
63 | 48 | |
64 | 49 | // Parse the embedFrame request and sanitize input |
65 | | - private function parseRequest(){ |
66 | | - // Check for apiTitleKey request |
67 | | - if( isset($_GET['apiTitleKey'])){ |
68 | | - $this->apiTitleKey = htmlspecialchars( $_GET['apiTitleKey'] ); |
| 50 | + private function parseRequest(){ |
| 51 | + // Check for attributes |
| 52 | + foreach( $this->playerAttributes as $attributeKey){ |
| 53 | + if( isset( $_GET[ $attributeKey ] ) ){ |
| 54 | + $this->$attributeKey = htmlspecialchars( $_GET[$attributeKey] ); |
| 55 | + } |
69 | 56 | } |
70 | | - |
71 | | - if( isset($_GET['apiProvider'])){ |
72 | | - $this->apiProvider = htmlspecialchars( $_GET['apiProvider'] ); |
73 | | - } |
74 | | - |
75 | | - if( isset( $_GET['poster'] ) ){ |
76 | | - $this->poster = htmlspecialchars( $_GET['poster'] ); |
77 | | - } |
| 57 | + |
| 58 | + // Process the special "src" attribute |
78 | 59 | if( isset( $_GET['src'] ) ){ |
79 | 60 | if( is_array( $_GET['src'] ) ){ |
80 | 61 | foreach($_GET['src'] as $src ){ |
— | — | @@ -83,45 +64,15 @@ |
84 | 65 | $this->sources = array( htmlspecialchars( $_GET['src'] ) ); |
85 | 66 | } |
86 | 67 | } |
87 | | - if( isset($_GET['skin'])){ |
88 | | - $this->skin = htmlspecialchars( $_GET['skin'] ); |
89 | | - } |
90 | | - |
91 | | - if( isset($_GET['width'])){ |
92 | | - $this->width = (int)$_GET['width']; |
93 | | - } |
94 | | - if( isset( $_GET['height'] ) ){ |
95 | | - $this->height = (int)$_GET['height']; |
96 | | - } |
97 | | - if( isset( $_GET['durationHint'] ) ){ |
98 | | - $this->durationHint = $_GET['durationHint']; |
99 | | - } |
| 68 | + |
100 | 69 | } |
101 | 70 | private function getVideoTag(){ |
102 | | - $o = '<video '; |
103 | | - // Output attributes |
104 | | - if( $this->apiTitleKey ){ |
105 | | - $o.= 'apiTitleKey="' . htmlspecialchars( $this->apiTitleKey ) . '" '; |
| 71 | + // Add default video tag with 100% width / height |
| 72 | + // ( parent embed is responsible for setting the iframe size ) |
| 73 | + $o = '<video style="width:100%;height:100%"'; |
| 74 | + foreach( $this->playerAttributes as $attributeKey){ |
| 75 | + $o.= ' ' . $attributeKey . '="' . htmlspecialchars( $this->$attributeKey ) . '"'; |
106 | 76 | } |
107 | | - if( $this->apiProvider ){ |
108 | | - $o.= 'apiProvider="' . htmlspecialchars( $this->apiProvider ) . '" '; |
109 | | - } |
110 | | - if( $this->poster ){ |
111 | | - $o.= 'poster="' . htmlspecialchars( $this->poster ) . '" '; |
112 | | - } |
113 | | - if( $this->skin ){ |
114 | | - $o.= 'class="' . htmlspecialchars( $this->skin ) . '" '; |
115 | | - } |
116 | | - if( $this->width || $this->height){ |
117 | | - $o.= 'style="'; |
118 | | - if( $this->width ){ |
119 | | - $o.= 'width:' . htmlspecialchars( $this->width ) . 'px;'; |
120 | | - } |
121 | | - if( $this->height ){ |
122 | | - $o.= 'height:' . htmlspecialchars( $this->height ) . 'px;'; |
123 | | - } |
124 | | - $o.= '" '; |
125 | | - } |
126 | 77 | //Close the video attributes |
127 | 78 | $o.='>'; |
128 | 79 | // Output each source |
— | — | @@ -134,6 +85,24 @@ |
135 | 86 | return $o; |
136 | 87 | } |
137 | 88 | private function outputEmbedFrame( ){ |
| 89 | + // Setup the embed string based on attribute set: |
| 90 | + $embedResourceList = 'window.jQuery,mwEmbed,mw.style.mwCommon,$j.fn.menu,mw.style.jquerymenu,mw.EmbedPlayer,mw.EmbedPlayerNative,mw.EmbedPlayerJava,mw.PlayerControlBuilder,$j.fn.hoverIntent,mw.style.EmbedPlayer,$j.cookie,$j.ui,mw.style.ui_redmond,$j.widget,$j.ui.mouse,mw.PlayerSkinKskin,mw.style.PlayerSkinKskin,mw.TimedText,mw.style.TimedText,$j.ui.slider'; |
| 91 | + |
| 92 | + if( $this->kEntryId ){ |
| 93 | + $embedResourceList.= ',' . implode(',', array( |
| 94 | + 'KalturaClientBase', |
| 95 | + 'KalturaClient', |
| 96 | + 'KalturaAccessControlService', |
| 97 | + 'KalturaAccessControlOrderBy', |
| 98 | + 'KalturaAccessControl', |
| 99 | + 'MD5', |
| 100 | + 'mw.KWidgetSupport', |
| 101 | + 'mw.KAnalytics', |
| 102 | + 'mw.KDPMapping', |
| 103 | + 'mw.MobilePlayerTimeline', |
| 104 | + 'mw.KAds' |
| 105 | + ) ); |
| 106 | + } |
138 | 107 | ?> |
139 | 108 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
140 | 109 | <html xmlns="http://www.w3.org/1999/xhtml"> |
— | — | @@ -148,7 +117,7 @@ |
149 | 118 | margin-bottom: 0px; |
150 | 119 | } |
151 | 120 | </style> |
152 | | - <script type="text/javascript" src="ResourceLoader.php?class=window.jQuery,mwEmbed,mw.style.mwCommon,$j.fn.menu,mw.style.jquerymenu,mw.EmbedPlayer,mw.EmbedPlayerNative,mw.EmbedPlayerJava,mw.PlayerControlBuilder,$j.fn.hoverIntent,mw.style.EmbedPlayer,$j.cookie,$j.ui,mw.style.ui_redmond,$j.widget,$j.ui.mouse,mw.PlayerSkinKskin,mw.style.PlayerSkinKskin,mw.TimedText,mw.style.TimedText,$j.ui.slider"></script> |
| 121 | + <script type="text/javascript" src="ResourceLoader.php?class=<?php echo $embedResourceList?>"></script> |
153 | 122 | <script type="text/javascript"> |
154 | 123 | //Set some iframe embed config: |
155 | 124 | |
Index: branches/MwEmbedStandAlone/components/mw.Language.js |
— | — | @@ -15,7 +15,6 @@ |
16 | 16 | * Setup the lang object |
17 | 17 | */ |
18 | 18 | var messageCache = { }; |
19 | | - var gRuleSet = { }; |
20 | 19 | |
21 | 20 | /** |
22 | 21 | * mw.addMessages function |
— | — | @@ -298,7 +297,7 @@ |
299 | 298 | mw.addTemplateTransform ( { |
300 | 299 | 'PLURAL' : mw.Language.procPLURAL, |
301 | 300 | 'GENDER' : mw.Language.procGENDER |
302 | | - } ) |
| 301 | + } ); |
303 | 302 | |
304 | 303 | mw.Language.doneSetup = true; |
305 | 304 | } |
— | — | @@ -344,11 +343,7 @@ |
345 | 344 | * [arg] The argument sent to the template |
346 | 345 | * [params] The template parameters |
347 | 346 | */ |
348 | | - mw.Language.procPLURAL = function( templateObject ) { |
349 | | - // Setup shortcuts |
350 | | - // ( gRuleSet is loaded from script-loader to contains local ruleset ) |
351 | | - var rs = gRuleSet[ 'PLURAL' ]; |
352 | | - |
| 347 | + mw.Language.procPLURAL = function( templateObject ) { |
353 | 348 | if( templateObject.arg && templateObject.param && mw.Language.convertPlural) { |
354 | 349 | // Check if we have forms to replace |
355 | 350 | if ( templateObject.param.length == 0 ) { |
Index: branches/MwEmbedStandAlone/components/mw.Parser.js |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | |
49 | 49 | var defaultParserOptions = { |
50 | 50 | 'templateParCount' : 2 |
51 | | - } |
| 51 | + }; |
52 | 52 | |
53 | 53 | this.options = $j.extend( defaultParserOptions, parserOptions); |
54 | 54 | }, |
Index: branches/MwEmbedStandAlone/modules/MiroSubs/mw.MiroSubsConfig.js |
— | — | @@ -242,7 +242,6 @@ |
243 | 243 | var _this = this; |
244 | 244 | var playerTimedText = this.embedPlayer.timedText; |
245 | 245 | |
246 | | - var letters = 'abcdefghijklmnopqrstuvwxyz'; |
247 | 246 | playerTimedText.setupTextSources( function(){ |
248 | 247 | var miroJsonSubs = []; |
249 | 248 | // NOTE the autoselected default language is a tricky issue |
— | — | @@ -254,17 +253,22 @@ |
255 | 254 | _this.config.languageKey = source.srclang; |
256 | 255 | for( var i = 0; i < captions.length ; i ++ ){ |
257 | 256 | var caption = captions[i]; |
258 | | - // get random letters |
259 | | - miroJsonSubs.push({ |
| 257 | + var miroSub = { |
260 | 258 | 'subtitle_id': 'sub_' + i, |
261 | 259 | 'text': caption.content, |
262 | | - 'start_time': caption.start, |
263 | | - 'end_time': caption.end, |
264 | | - 'sub_order': i |
265 | | - }); |
| 260 | + 'sub_order': i+1 |
| 261 | + }; |
| 262 | + if( caption.end == 0){ |
| 263 | + miroSub.start_time = -1; |
| 264 | + miroSub.end_time = -1; |
| 265 | + } else { |
| 266 | + miroSub.start_time = caption.start; |
| 267 | + miroSub.end_time = caption.end; |
| 268 | + } |
| 269 | + miroJsonSubs.push( miroSub ); |
266 | 270 | } |
267 | | - }); |
| 271 | + }); |
268 | 272 | callback( miroJsonSubs ); |
269 | 273 | }); |
270 | 274 | } |
271 | | -}; |
\ No newline at end of file |
| 275 | +}; |
Index: branches/MwEmbedStandAlone/modules/TimedText/mw.TimedText.js |
— | — | @@ -849,7 +849,7 @@ |
850 | 850 | if( text === this.prevText[ source.category ] ) |
851 | 851 | return ; |
852 | 852 | |
853 | | - //mw.log( 'updateTextDisplay: ' + text ); |
| 853 | + mw.log( 'mw.TimedText:: updateTextDisplay: ' + text ); |
854 | 854 | |
855 | 855 | var $playerTarget = this.embedPlayer.$interface; |
856 | 856 | var $textTarget = $playerTarget.find( '.track_' + source.category + ' span' ); |
— | — | @@ -1042,6 +1042,7 @@ |
1043 | 1043 | if( data ) { |
1044 | 1044 | _this.captions = handler( data ); |
1045 | 1045 | } |
| 1046 | + mw.log("mw.TimedText:: parsed " + _this.captions.length + ' captions'); |
1046 | 1047 | // Update the loaded state: |
1047 | 1048 | _this.loaded = true; |
1048 | 1049 | if( callback ) { |
— | — | @@ -1089,8 +1090,12 @@ |
1090 | 1091 | var startIndex = 0; |
1091 | 1092 | } |
1092 | 1093 | // Start looking for the text via time, return first match: |
1093 | | - for( var i = startIndex ; i < this.captions.length; i++ ) { |
| 1094 | + for( var i = startIndex ; i < this.captions.length; i++ ) { |
1094 | 1095 | caption = this.captions[ i ]; |
| 1096 | + // Don't handle captions with 0 or -1 end time: |
| 1097 | + if( caption.end == 0 || caption.end == -1) |
| 1098 | + continue; |
| 1099 | + |
1095 | 1100 | if( time >= caption.start && |
1096 | 1101 | time <= caption.end ) { |
1097 | 1102 | this.prevIndex = i; |
— | — | @@ -1117,7 +1122,10 @@ |
1118 | 1123 | //mw.log( 'pText: ' + currentPtext ); |
1119 | 1124 | |
1120 | 1125 | //Check if the p matches the "all in one line" match: |
1121 | | - var m = currentPtext.replace('-->', '-->').match(/\d+\s(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?\n?(.*)/); |
| 1126 | + var m = currentPtext |
| 1127 | + .replace('-->', '-->') |
| 1128 | + .match(/\d+\s([\d\-]+):([\d\-]+):([\d\-]+)(?:,([\d\-]+))?\s*--?>\s*([\d\-]+):([\d\-]+):([\d\-]+)(?:,([\d\-]+))?\n?(.*)/); |
| 1129 | + |
1122 | 1130 | if (m) { |
1123 | 1131 | var startMs = (m[4])? (parseInt(m[4], 10) / 1000):0; |
1124 | 1132 | var endMs = (m[8])? (parseInt(m[8], 10) / 1000) : 0; |
— | — | @@ -1134,7 +1142,7 @@ |
1135 | 1143 | endMs, |
1136 | 1144 | 'content': $j.trim( m[9] ) |
1137 | 1145 | }); |
1138 | | - return 'next'; |
| 1146 | + return true; |
1139 | 1147 | } |
1140 | 1148 | // Else check for multi-line match: |
1141 | 1149 | if( parseInt( currentPtext ) == currentPtext ) { |
— | — | @@ -1144,7 +1152,7 @@ |
1145 | 1153 | curentCap = { |
1146 | 1154 | 'content': '' |
1147 | 1155 | }; |
1148 | | - return 'next'; |
| 1156 | + return true; |
1149 | 1157 | } |
1150 | 1158 | //Check only for time match: |
1151 | 1159 | var m = currentPtext.replace('-->', '-->').match(/(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?/); |
— | — | @@ -1161,7 +1169,7 @@ |
1162 | 1170 | (parseInt(m[6], 10) * 60) + |
1163 | 1171 | (parseInt(m[7], 10)) + |
1164 | 1172 | endMs; |
1165 | | - return 'next'; |
| 1173 | + return true; |
1166 | 1174 | } |
1167 | 1175 | //Else content for the curentCap |
1168 | 1176 | if( currentPtext != '<br>' ) { |
Index: branches/MwEmbedStandAlone/modules/ApiProxy/mw.ApiProxy.js |
— | — | @@ -343,7 +343,7 @@ |
344 | 344 | sendClientMsg( { 'state':'ok' } ); |
345 | 345 | |
346 | 346 | return serverHandleRequest(); |
347 | | - } |
| 347 | + }; |
348 | 348 | |
349 | 349 | /** |
350 | 350 | * Local scoped helper functions: |
— | — | @@ -452,7 +452,7 @@ |
453 | 453 | 'clientFrame' : getClientFrame( context ), |
454 | 454 | 'action' : 'apiRequest', |
455 | 455 | 'request' : context[ 'apiReq' ] |
456 | | - } |
| 456 | + }; |
457 | 457 | |
458 | 458 | mw.log( "Do frame proxy request on src: \n" + getServerFrame( context ) + "\n" + JSON.stringify( context[ 'apiReq' ] ) ); |
459 | 459 | appendIframe( { |
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | */ |
6 | 6 | var urlparts = getRemoteEmbedPath(); |
7 | 7 | var mwEmbedHostPath = urlparts[0]; |
8 | | -var mwRemoteVersion = 'r169'; |
| 8 | +var mwRemoteVersion = 'r170'; |
9 | 9 | var mwUseScriptLoader = true; |
10 | 10 | |
11 | 11 | // Log the mwRemote version makes it easy to debug cache issues |