r80490 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80489‎ | r80490 | r80491 >
Date:05:27, 18 January 2011
Author:dale
Status:deferred
Tags:
Comment:
* added mwEmbedResourceMannager
* started to port over EmbedPlayer
Modified paths:
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedAutoLoader.php (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedMediaWikiStubs.php (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedResourceLoader.php (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedResourceLoaderStartUpModule.php (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedResourceManager.php (added) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedWebStartSetup.php (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/resourceloader/ResourceLoader.php (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/resourceloader/ResourceLoaderModule.php (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/resourceloader/ResourceLoaderStartUpModule.php (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/modules/EmbedPlayer/EmbedPlayer.php (added) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/modules/EmbedPlayer/loader.js (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_Sources.html (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/resources/mediawiki/mediawiki.js (modified) (history)
  • /branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/resources/startup.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedWebStartSetup.php
@@ -90,3 +90,15 @@
9191 # Create the wgRequest global:
9292 $wgRequest = new WebRequest;
9393
 94+$wgLang = new UserLang();
 95+
 96+# Register / load all the mwEmbed modules
 97+foreach( $wgMwEmbedEnabledModules as $moduleName ){
 98+ $modulePath = "modules/$moduleName";
 99+ if( is_file( "$IP/$modulePath/$moduleName.php" ) ){
 100+ MwEmbedResourceManager::register( $modulePath );
 101+ }
 102+}
 103+# Add the resource loader hook:
 104+$wgHooks['ResourceLoaderRegisterModules'][] = 'MwEmbedResourceManager::registerModules';
 105+
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedResourceLoader.php
@@ -19,6 +19,7 @@
2020 $this->register( include( "$IP/resources/MwEmbedSharedResources.php" ) );
2121 // Register extension modules
2222 wfRunHooks( 'ResourceLoaderRegisterModules', array( &$this ) );
 23+
2324 $this->register( $wgResourceModules );
2425
2526 wfProfileOut( __METHOD__ );
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedAutoLoader.php
@@ -29,6 +29,7 @@
3030 'MwEmbedResourceLoader' => 'includes/MwEmbedResourceLoader.php',
3131 'MwEmbedResourceLoaderFileModule' => 'includes/MwEmbedResourceLoaderFileModule.php',
3232 'MwEmbedResourceLoaderStartUpModule' => 'includes/MwEmbedResourceLoaderStartUpModule.php',
 33+ 'MwEmbedResourceManager' => 'includes/MwEmbedResourceManager.php',
3334
3435 );
3536
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedResourceManager.php
@@ -0,0 +1,87 @@
 2+<?php
 3+/**
 4+ * MwEmbedResourceManager adds some convenience functions for loading mwEmbed 'modules'.
 5+ * Its shared between the mwEmbedStandAlone and the MwEmbed extension
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+class MwEmbedResourceManager {
 12+
 13+ protected static $moduleSet = array();
 14+
 15+ /**
 16+ * Register mwEmbeed resource set
 17+ *
 18+ * Adds modules to ResourceLoader
 19+ */
 20+ public static function register( $mwEmbedResourcePath ) {
 21+ global $IP, $wgExtensionMessagesFiles;
 22+ $fullResourcePath = $IP .'/'. $mwEmbedResourcePath;
 23+
 24+ // Get the module name from the end of the path:
 25+ $modulePathParts = explode( '/', $mwEmbedResourcePath );
 26+ $moduleName = array_pop ( $modulePathParts );
 27+ if( !is_dir( $fullResourcePath ) ){
 28+ throw new MWException( __METHOD__ . " not given readable path: " . htmlspecialchars( $mwEmbedResourcePath ) );
 29+ }
 30+
 31+ if( substr( $mwEmbedResourcePath, -1 ) == '/' ){
 32+ throw new MWException( __METHOD__ . " path has trailing slash: " . htmlspecialchars( $mwEmbedResourcePath) );
 33+ }
 34+
 35+ // Add the messages to the extension messages set:
 36+ $wgExtensionMessagesFiles[ 'MwEmbed.' . $moduleName ] = $fullResourcePath . '/' . $moduleName . '.i18n.php';
 37+
 38+ // Get the mwEmbed module config
 39+ $moduleInfo = require_once( $fullResourcePath . '/' . $moduleName . '.php' );
 40+ $resourceList = $moduleInfo['resources'];
 41+ // Look for special 'messages' => 'moduleFile' key and load all modules file messages:
 42+ foreach( $resourceList as $name => $resources ){
 43+ if( isset( $resources['messageFile'] ) && is_file( $fullResourcePath . '/' .$resources['messageFile'] ) ){
 44+ $resourceList[ $name ][ 'messages' ] = array();
 45+ include( $fullResourcePath . '/' .$resources['messageFile'] );
 46+ foreach( $messages['en'] as $msgKey => $na ){
 47+ $resourceList[ $name ][ 'messages' ][] = $msgKey;
 48+ }
 49+ }
 50+ };
 51+
 52+ // If the module has a loader.js add it to the resource list:
 53+ if( is_file( $fullResourcePath . '/loader.js' ) ){
 54+ $resourceList[$moduleName. '.loader'] = array( 'loaderScripts' => 'loader.js' );
 55+ }
 56+ // @@TODO add $moduleInfo['config']
 57+
 58+ // Add the resource list into the module set with its provided path
 59+ self::$moduleSet[ $mwEmbedResourcePath ] = $resourceList;
 60+ }
 61+
 62+ /**
 63+ * ResourceLoaderRegisterModules hook
 64+ *
 65+ * Adds any mwEmbedResources to the ResourceLoader
 66+ */
 67+ public static function registerModules( &$resourceLoader ) {
 68+ global $IP;
 69+ // Register all the resources with the resource loader
 70+ foreach( self::$moduleSet as $path => $modules ) {
 71+ foreach ( $modules as $name => $resources ) {
 72+ $resourceLoader->register(
 73+ // Resource loader expects trailing slash:
 74+ $name, new MwEmbedResourceLoaderFileModule( $resources, "$IP/$path", $path)
 75+ );
 76+ }
 77+ }
 78+ // Continue module processing
 79+ return true;
 80+ }
 81+
 82+ // Add the mwEmbed module to the page:
 83+ public static function addMwEmbedModule( &$out, &$sk ){
 84+ // Add the mwEmbed module to the output
 85+ $out->addModules( 'mwEmbed' );
 86+ return true;
 87+ }
 88+}
\ No newline at end of file
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedMediaWikiStubs.php
@@ -16,7 +16,13 @@
1717 function wfDebug( $text, $logonly = false ) {
1818 return ;
1919 }
20 -
 20+// Stub userLang ( if no language code provided
 21+class UserLang {
 22+ // getCode (default english )
 23+ public function getCode(){
 24+ return 'en';
 25+ }
 26+}
2127 // MWException stub:
2228 class MWException extends Exception {
2329 }
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedResourceLoaderStartUpModule.php
@@ -4,6 +4,32 @@
55 // alone mode
66
77 class MwEmbedResourceLoaderStartUpModule extends ResourceLoaderStartUpModule {
 8+ /**
 9+ * Get the files this module depends on indirectly for a given skin.
 10+ * Currently these are only image files referenced by the module's CSS.
 11+ *
 12+ * @param $skin String: Skin name
 13+ * @return Array: List of files
 14+ */
 15+ public function getFileDependencies( $skin ) {
 16+ // Try in-object cache first
 17+ if ( isset( $this->fileDeps[$skin] ) ) {
 18+ return $this->fileDeps[$skin];
 19+ }
 20+ return array();
 21+ /*$dbr = wfGetDB( DB_SLAVE );
 22+ $deps = $dbr->selectField( 'module_deps', 'md_deps', array(
 23+ 'md_module' => $this->getName(),
 24+ 'md_skin' => $skin,
 25+ ), __METHOD__
 26+ );
 27+ if ( !is_null( $deps ) ) {
 28+ $this->fileDeps[$skin] = (array) FormatJson::decode( $deps, true );
 29+ } else {
 30+ $this->fileDeps[$skin] = array();
 31+ }
 32+ return $this->fileDeps[$skin];*/
 33+ }
834
935 protected function getConfig( $context ) {
1036 // @@todo set all the configuration variables
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/resourceloader/ResourceLoader.php
@@ -191,6 +191,7 @@
192192 * multiple-registration calling style.
193193 * @throws MWException: If a duplicate module registration is attempted
194194 * @throws MWException: If something other than a ResourceLoaderModule is being registered
 195+ * @throws MWException: If an empty module name is being registered
195196 * @return Boolean: False if there were any errors, in which case one or more modules were not
196197 * registered
197198 */
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/resourceloader/ResourceLoaderModule.php
@@ -147,7 +147,6 @@
148148 * @return Array: List of files
149149 */
150150 public function getFileDependencies( $skin ) {
151 - print_r( debug_backtrace() );
152151 // Try in-object cache first
153152 if ( isset( $this->fileDeps[$skin] ) ) {
154153 return $this->fileDeps[$skin];
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -148,17 +148,21 @@
149149 global $IP, $wgLoadScript;
150150 $out = file_get_contents( "$IP/resources/startup.js" );
151151 if ( $context->getOnly() === 'scripts' ) {
 152+ // Get the latest version
 153+ $version = 0;
 154+ $modules = $this->getStartupModuleList();
 155+ foreach( $modules as $moduleName){
 156+ $version = max( $version, $context->getResourceLoader()->getModule( 'jquery' )->getModifiedTime( $context ) );
 157+ }
 158+
152159 // Build load query for jquery and mediawiki modules
153160 $query = array(
154 - 'modules' => implode( '|', array( 'jquery', 'mediawiki' ) ),
 161+ 'modules' => implode( '|', $modules ),
155162 'only' => 'scripts',
156163 'lang' => $context->getLanguage(),
157164 'skin' => $context->getSkin(),
158165 'debug' => $context->getDebug() ? 'true' : 'false',
159 - 'version' => wfTimestamp( TS_ISO_8601_BASIC, round( max(
160 - $context->getResourceLoader()->getModule( 'jquery' )->getModifiedTime( $context ),
161 - $context->getResourceLoader()->getModule( 'mediawiki' )->getModifiedTime( $context )
162 - ), -2 ) )
 166+ 'version' => wfTimestamp( TS_ISO_8601_BASIC, round( $version, -2 ) )
163167 );
164168 // Ensure uniform query order
165169 ksort( $query );
@@ -180,7 +184,9 @@
181185 }
182186 return $out;
183187 }
184 -
 188+ private function getStartupModuleList(){
 189+ return array( 'jquery', 'mediawiki' );
 190+ }
185191 public function getModifiedTime( ResourceLoaderContext $context ) {
186192 global $IP, $wgCacheEpoch;
187193
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/modules/EmbedPlayer/EmbedPlayer.php
@@ -0,0 +1,287 @@
 2+<?php
 3+
 4+ // Register all the EmbedPlayer modules in the $wgResourceModules global array
 5+ return array(
 6+ 'resources' => array(
 7+ "mw.EmbedPlayer" => array(
 8+ 'scripts' => array( "mw.EmbedPlayer.js", "skins/mw.PlayerControlBuilder.js" ),
 9+ 'styles' => "skins/mw.style.EmbedPlayer.css",
 10+ 'messageFile' => 'EmbedPlayer.i18n.php'
 11+ ),
 12+
 13+ "mw.EmbedPlayerKplayer" => array( 'scripts'=> "mw.EmbedPlayerKplayer.js" ),
 14+ "mw.EmbedPlayerGeneric" => array( 'scripts'=> "mw.EmbedPlayerGeneric.js" ),
 15+ "mw.EmbedPlayerJava" => array( 'scripts'=> "mw.EmbedPlayerJava.js"),
 16+ "mw.EmbedPlayerNative" => array( 'scripts'=> "mw.EmbedPlayerNative.js" ),
 17+
 18+ "mw.EmbedPlayerVlc" => array( 'scripts'=> "mw.EmbedPlayerVlc.js" ),
 19+
 20+ "mw.IFramePlayerApiServer" => array( 'scripts' => "mw.IFramePlayerApiServer.js" ),
 21+ "mw.IFramePlayerApiClient" => array( 'scripts' => "mw.IFramePlayerApiClient.js" ),
 22+
 23+ "mw.PlayerSkinKskin" => array( 'scripts' => "skins/kskin/mw.PlayerSkinKskin.js",
 24+ 'styles' => "skins/kskin/mw.style.PlayerSkinKskin.css"),
 25+
 26+ "mw.PlayerSkinMvpcf" => array( 'scripts'=> "skins/mvpcf/mw.PlayerSkinMvpcf.js",
 27+ 'styles'=> "skins/mvpcf/mw.style.PlayerSkinMvpcf.css"),
 28+ ),
 29+ // Set any default configuration
 30+ 'config' => array(
 31+ // If the player controls should be overlaid on top of the video ( if supported by playback method)
 32+ // can be set to false per embed player via overlayControls attribute
 33+ 'EmbedPlayer.OverlayControls' => true,
 34+
 35+ // If the iPad should use html controls ( can't use fullscreen or control volume,
 36+ // but lets you support overlays ie html controls ads etc. )
 37+ 'EmbedPlayer.EnableIpadHTMLControls'=> false,
 38+
 39+ 'EmbedPlayer.LibraryPage'=> 'http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library',
 40+
 41+ // A default apiProvider ( ie where to lookup subtitles, video properties etc )
 42+ // NOTE: Each player instance can also specify a specific provider
 43+ "EmbedPlayer.ApiProvider" => "local",
 44+
 45+ // What tags will be re-written to video player by default
 46+ // Set to empty string or null to avoid automatic video tag rewrites to embedPlayer
 47+ "EmbedPlayer.RewriteTags" => "video,audio,playlist",
 48+
 49+ // Default video size ( if no size provided )
 50+ "EmbedPlayer.DefaultSize" => "400x300",
 51+
 52+ // If the video player should attribute kaltura
 53+ "EmbedPlayer.KalturaAttribution" => true,
 54+
 55+ // The attribution button
 56+ 'EmbedPlayer.AttributionButton' => array(
 57+ 'title' => 'Kaltura html5 video library',
 58+ 'href' => 'http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library',
 59+ // Style icon to be applied
 60+ 'class' => 'kaltura-icon',
 61+ // An icon image url ( should be a 12x12 image or data url )
 62+ 'iconurl' => false
 63+ ),
 64+
 65+ // If the player should wait for metadata like video size and duration, before trying to draw
 66+ // the player interface.
 67+ 'EmbedPlayer.WaitForMeta' => true,
 68+
 69+ // Set the browser player warning flag displays warning for non optimal playback
 70+ "EmbedPlayer.ShowNativeWarning" => true,
 71+
 72+ // If fullscreen is global enabled.
 73+ "EmbedPlayer.EnableFullscreen" => true,
 74+
 75+ // If mwEmbed should use the Native player controls
 76+ // this will prevent video tag rewriting and skinning
 77+ // useful for devices such as iPad / iPod that
 78+ // don't fully support DOM overlays or don't expose full-screen
 79+ // functionality to javascript
 80+ "EmbedPlayer.NativeControls" => false,
 81+
 82+ // If mwEmbed should use native controls on mobile safari
 83+ "EmbedPlayer.NativeControlsMobileSafari" => true,
 84+
 85+
 86+ // The z-index given to the player interface during full screen ( high z-index )
 87+ "EmbedPlayer.fullScreenZIndex" => 999998,
 88+
 89+ // The default share embed mode ( can be "object" or "videojs" )
 90+ //
 91+ // "iframe" will provide a <iframe tag pointing to mwEmbedFrame.php
 92+ // Object embedding should be much more compatible with sites that
 93+ // let users embed flash applets
 94+ // "videojs" will include the source javascript and video tag to
 95+ // rewrite the player on the remote page DOM
 96+ // Video tag embedding is much more mash-up friendly but exposes
 97+ // the remote site to the mwEmbed javascript and can be a xss issue.
 98+ "EmbedPlayer.ShareEmbedMode" => 'iframe',
 99+
 100+ // Default player skin name
 101+ "EmbedPlayer.SkinName" => "mvpcf",
 102+
 103+ // Number of milliseconds between interface updates
 104+ 'EmbedPlayer.MonitorRate' => 250,
 105+
 106+ // If the embedPlayer should accept arguments passed in from iframe postMessages calls
 107+ 'EmbedPlayer.EnalbeIFramePlayerServer' => false,
 108+
 109+ // If embedPlayer should support server side temporal urls for seeking options are
 110+ // flash|always|none default is support for flash only.
 111+ 'EmbedPlayer.EnableURLTimeEncoding' => 'flash',
 112+
 113+ // The domains which can read and send events to the video player
 114+ 'EmbedPLayer.IFramePlayer.DomainWhiteList' => '*',
 115+
 116+ // If the iframe should send and receive javascript events across domains via postMessage
 117+ 'EmbedPlayer.EnableIframeApi' => true,
 118+
 119+ /**
 120+ * The base source attribute checks also see:
 121+ * http://dev.w3.org/html5/spec/Overview.html#the-source-element
 122+ */
 123+ 'EmbedPlayer.SourceAttributes' => array(
 124+ // source id
 125+ 'id',
 126+
 127+ // media url
 128+ 'src',
 129+
 130+ // Title string for the source asset
 131+ 'title',
 132+
 133+ // boolean if we support temporal url requests on the source media
 134+ 'URLTimeEncoding',
 135+
 136+ // Media has a startOffset ( used for plugins that
 137+ // display ogg page time rather than presentation time
 138+ 'startOffset',
 139+
 140+ // A hint to the duration of the media file so that duration
 141+ // can be displayed in the player without loading the media file
 142+ 'durationHint',
 143+
 144+ // Media start time
 145+ 'start',
 146+
 147+ // Media end time
 148+ 'end',
 149+
 150+ // If the source is the default source
 151+ 'default',
 152+
 153+ // Title of the source
 154+ 'title',
 155+
 156+ // titleKey ( used for api lookups TODO move into mediaWiki specific support
 157+ 'titleKey'
 158+ ),
 159+ /**
 160+ * Merge in the default video attributes supported by embedPlayer:
 161+ */
 162+ 'EmbedPlayer.Attributes' => array(
 163+ /*
 164+ * Base html element attributes:
 165+ */
 166+
 167+ // id: Auto-populated if unset
 168+ "id" => null,
 169+
 170+ // Width: alternate to "style" to set player width
 171+ "width" => null,
 172+
 173+ // Height: alternative to "style" to set player height
 174+ "height" => null,
 175+
 176+ /*
 177+ * Base html5 video element attributes / states also see:
 178+ * http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
 179+ */
 180+
 181+ // Media src URI, can be relative or absolute URI
 182+ "src" => null,
 183+
 184+ // Poster attribute for displaying a place holder image before loading
 185+ // or playing the video
 186+ "poster" => null,
 187+
 188+ // Autoplay if the media should start playing
 189+ "autoplay" => false,
 190+
 191+ // Loop attribute if the media should repeat on complete
 192+ "loop" => false,
 193+
 194+ // If the player controls should be displayed
 195+ "controls" => true,
 196+
 197+ // Video starts "paused"
 198+ "paused" => true,
 199+
 200+ // ReadyState an attribute informs clients of video loading state:
 201+ // see: http://www.whatwg.org/specs/web-apps/current-work/#readystate
 202+ "readyState" => 0,
 203+
 204+ // Loading state of the video element
 205+ "networkState" => 0,
 206+
 207+ // Current playback position
 208+ "currentTime" => 0,
 209+
 210+ // Previous player set time
 211+ // Lets javascript use $j('#videoId').get(0).currentTime = newTime;
 212+ "previousTime" => 0,
 213+
 214+ // Previous player set volume
 215+ // Lets javascript use $j('#videoId').get(0).volume = newVolume;
 216+ "previousVolume" => 1,
 217+
 218+ // Initial player volume:
 219+ "volume" => 0.75,
 220+
 221+ // Caches the volume before a mute toggle
 222+ "preMuteVolume" => 0.75,
 223+
 224+ // Media duration: Value is populated via
 225+ // custom durationHint attribute or via the media file once its played
 226+ "duration" => null,
 227+
 228+ // Mute state
 229+ "muted" => false,
 230+
 231+ /**
 232+ * Custom attributes for embedPlayer player: (not part of the html5
 233+ * video spec)
 234+ */
 235+
 236+ // Default video aspect ratio
 237+ 'videoAspect' => '4:3',
 238+
 239+ // Start time of the clip
 240+ "start" => 0,
 241+
 242+ // End time of the clip
 243+ "end" => null,
 244+
 245+ // A apiTitleKey for looking up subtitles, credits and related videos
 246+ // TODO move to data-mwTitleKey and into mediaWikiSupport module
 247+ "apiTitleKey" => null,
 248+
 249+ // The apiProvider where to lookup the title key
 250+ // TODO move to data-mwApiProvider and into mediaWikiSupport module
 251+ "apiProvider" => null,
 252+
 253+ // If the player controls should be overlaid
 254+ // ( Global default via config EmbedPlayer.OverlayControls in module
 255+ // loader.js)
 256+ "overlaycontrols" => true,
 257+
 258+ // Attribute to use 'native' controls
 259+ "usenativecontrols" => false,
 260+
 261+ // If the player should include an attribution button:
 262+ 'attributionbutton' => true,
 263+
 264+ // ROE url ( for xml based metadata )
 265+ // also see: http://wiki.xiph.org/ROE
 266+ "roe" => null,
 267+
 268+ // If serving an ogg_chop segment use this to offset the presentation
 269+ // time
 270+ // ( for some plugins that use ogg page time rather than presentation
 271+ // time )
 272+ "startOffset" => 0,
 273+
 274+ // Source page for media asset ( used for linkbacks in remote embedding
 275+ // )
 276+ "linkback" => null,
 277+
 278+ // If the download link should be shown
 279+ "download_link" => true,
 280+
 281+ // Content type of the media
 282+ "type" => null
 283+ ),
 284+ ),
 285+ );
 286+
 287+
 288+?>
\ No newline at end of file
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
@@ -4,299 +4,13 @@
55 /**
66 * Default player module configuration
77 */
8 -( function( mw ) {
9 -
10 - mw.setDefaultConfig( {
11 - // If the player controls should be overlaid on top of the video ( if supported by playback method)
12 - // can be set to false per embed player via overlayControls attribute
13 - 'EmbedPlayer.OverlayControls' : true,
14 -
15 - // If the iPad should use html controls ( can't use fullscreen or control volume,
16 - // but lets you support overlays ie html controls ads etc. )
17 - 'EmbedPlayer.EnableIpadHTMLControls': false,
18 -
19 - 'EmbedPlayer.LibraryPage': 'http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library',
20 -
21 - // A default apiProvider ( ie where to lookup subtitles, video properties etc )
22 - // NOTE: Each player instance can also specify a specific provider
23 - "EmbedPlayer.ApiProvider" : "local",
24 -
25 - // What tags will be re-written to video player by default
26 - // Set to empty string or null to avoid automatic video tag rewrites to embedPlayer
27 - "EmbedPlayer.RewriteTags" : "video,audio,playlist",
28 -
29 - // Default video size ( if no size provided )
30 - "EmbedPlayer.DefaultSize" : "400x300",
31 -
32 - // If the video player should attribute kaltura
33 - "EmbedPlayer.KalturaAttribution" : true,
34 -
35 - // The attribution button
36 - 'EmbedPlayer.AttributionButton' :{
37 - 'title' : 'Kaltura html5 video library',
38 - 'href' : 'http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library',
39 - // Style icon to be applied
40 - 'class' : 'kaltura-icon',
41 - // An icon image url ( should be a 12x12 image or data url )
42 - 'iconurl' : false
43 - },
44 -
45 - // If the player should wait for metadata like video size and duration, before trying to draw
46 - // the player interface.
47 - 'EmbedPlayer.WaitForMeta' : true,
48 -
49 - // Set the browser player warning flag displays warning for non optimal playback
50 - "EmbedPlayer.ShowNativeWarning" : true,
51 -
52 - // If fullscreen is global enabled.
53 - "EmbedPlayer.EnableFullscreen" : true,
54 -
55 - // If mwEmbed should use the Native player controls
56 - // this will prevent video tag rewriting and skinning
57 - // useful for devices such as iPad / iPod that
58 - // don't fully support DOM overlays or don't expose full-screen
59 - // functionality to javascript
60 - "EmbedPlayer.NativeControls" : false,
61 -
62 - // If mwEmbed should use native controls on mobile safari
63 - "EmbedPlayer.NativeControlsMobileSafari" : true,
64 -
65 -
66 - // The z-index given to the player interface during full screen ( high z-index )
67 - "EmbedPlayer.fullScreenZIndex" : 999998,
68 -
69 - // The default share embed mode ( can be "object" or "videojs" )
70 - //
71 - // "iframe" will provide a <iframe tag pointing to mwEmbedFrame.php
72 - // Object embedding should be much more compatible with sites that
73 - // let users embed flash applets
74 - // "videojs" will include the source javascript and video tag to
75 - // rewrite the player on the remote page DOM
76 - // Video tag embedding is much more mash-up friendly but exposes
77 - // the remote site to the mwEmbed javascript and can be a xss issue.
78 - "EmbedPlayer.ShareEmbedMode" : 'iframe',
79 -
80 - // Default player skin name
81 - "EmbedPlayer.SkinName" : "mvpcf",
82 -
83 - // Number of milliseconds between interface updates
84 - 'EmbedPlayer.MonitorRate' : 250,
85 -
86 - // If the embedPlayer should accept arguments passed in from iframe postMessages calls
87 - 'EmbedPlayer.EnalbeIFramePlayerServer' : false,
88 -
89 - // If embedPlayer should support server side temporal urls for seeking options are
90 - // flash|always|none default is support for flash only.
91 - 'EmbedPlayer.EnableURLTimeEncoding' : 'flash',
92 -
93 - // The domains which can read and send events to the video player
94 - 'EmbedPLayer.IFramePlayer.DomainWhiteList' : '*',
95 -
96 - // If the iframe should send and receive javascript events across domains via postMessage
97 - 'EmbedPlayer.EnableIframeApi' : true
98 - } );
99 -
 8+( function( mw, $ ) {
1009 /**
101 - * The base source attribute checks also see:
102 - * http://dev.w3.org/html5/spec/Overview.html#the-source-element
103 - */
104 - mw.setDefaultConfig( 'EmbedPlayer.SourceAttributes', [
105 - // source id
106 - 'id',
107 -
108 - // media url
109 - 'src',
110 -
111 - // Title string for the source asset
112 - 'title',
113 -
114 - // boolean if we support temporal url requests on the source media
115 - 'URLTimeEncoding',
116 -
117 - // Media has a startOffset ( used for plugins that
118 - // display ogg page time rather than presentation time
119 - 'startOffset',
120 -
121 - // A hint to the duration of the media file so that duration
122 - // can be displayed in the player without loading the media file
123 - 'durationHint',
124 -
125 - // Media start time
126 - 'start',
127 -
128 - // Media end time
129 - 'end',
130 -
131 - // If the source is the default source
132 - 'default',
133 -
134 - // Title of the source
135 - 'title',
136 -
137 - // titleKey ( used for api lookups TODO move into mediaWiki specific support
138 - 'titleKey'
139 - ] );
140 -
141 - /**
142 - * Merge in the default video attributes supported by embedPlayer:
143 - */
144 - mw.mergeConfig('EmbedPlayer.Attributes', {
145 - /*
146 - * Base html element attributes:
147 - */
148 -
149 - // id: Auto-populated if unset
150 - "id" : null,
151 -
152 - // Width: alternate to "style" to set player width
153 - "width" : null,
154 -
155 - // Height: alternative to "style" to set player height
156 - "height" : null,
157 -
158 - /*
159 - * Base html5 video element attributes / states also see:
160 - * http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
161 - */
162 -
163 - // Media src URI, can be relative or absolute URI
164 - "src" : null,
165 -
166 - // Poster attribute for displaying a place holder image before loading
167 - // or playing the video
168 - "poster" : null,
169 -
170 - // Autoplay if the media should start playing
171 - "autoplay" : false,
172 -
173 - // Loop attribute if the media should repeat on complete
174 - "loop" : false,
175 -
176 - // If the player controls should be displayed
177 - "controls" : true,
178 -
179 - // Video starts "paused"
180 - "paused" : true,
181 -
182 - // ReadyState an attribute informs clients of video loading state:
183 - // see: http://www.whatwg.org/specs/web-apps/current-work/#readystate
184 - "readyState" : 0,
185 -
186 - // Loading state of the video element
187 - "networkState" : 0,
188 -
189 - // Current playback position
190 - "currentTime" : 0,
191 -
192 - // Previous player set time
193 - // Lets javascript use $j('#videoId').get(0).currentTime = newTime;
194 - "previousTime" : 0,
195 -
196 - // Previous player set volume
197 - // Lets javascript use $j('#videoId').get(0).volume = newVolume;
198 - "previousVolume" : 1,
199 -
200 - // Initial player volume:
201 - "volume" : 0.75,
202 -
203 - // Caches the volume before a mute toggle
204 - "preMuteVolume" : 0.75,
205 -
206 - // Media duration: Value is populated via
207 - // custom durationHint attribute or via the media file once its played
208 - "duration" : null,
209 -
210 - // Mute state
211 - "muted" : false,
212 -
213 - /**
214 - * Custom attributes for embedPlayer player: (not part of the html5
215 - * video spec)
216 - */
217 -
218 - // Default video aspect ratio
219 - 'videoAspect' : '4:3',
220 -
221 - // Start time of the clip
222 - "start" : 0,
223 -
224 - // End time of the clip
225 - "end" : null,
226 -
227 - // A apiTitleKey for looking up subtitles, credits and related videos
228 - "apiTitleKey" : null,
229 -
230 - // The apiProvider where to lookup the title key
231 - "apiProvider" : null,
232 -
233 - // If the player controls should be overlaid
234 - // ( Global default via config EmbedPlayer.OverlayControls in module
235 - // loader.js)
236 - "overlaycontrols" : true,
237 -
238 - // Attribute to use 'native' controls
239 - "usenativecontrols" : false,
240 -
241 - // If the player should include an attribution button:
242 - 'attributionbutton' : true,
243 -
244 - // ROE url ( for xml based metadata )
245 - // also see: http://wiki.xiph.org/ROE
246 - "roe" : null,
247 -
248 - // If serving an ogg_chop segment use this to offset the presentation
249 - // time
250 - // ( for some plugins that use ogg page time rather than presentation
251 - // time )
252 - "startOffset" : 0,
253 -
254 - // Thumbnail (same as poster)
255 - "thumbnail" : null,
256 -
257 - // Source page for media asset ( used for linkbacks in remote embedding
258 - // )
259 - "linkback" : null,
260 -
261 - // If the download link should be shown
262 - "download_link" : true,
263 -
264 - // Content type of the media
265 - "type" : null
266 - } );
267 -
268 - // Add class file paths
269 - mw.addResourcePaths( {
270 - "mw.EmbedPlayer" : "mw.EmbedPlayer.js",
271 -
272 - "mw.EmbedPlayerKplayer" : "mw.EmbedPlayerKplayer.js",
273 - "mw.EmbedPlayerGeneric" : "mw.EmbedPlayerGeneric.js",
274 - "mw.EmbedPlayerHtml" : "mw.EmbedPlayerHtml.js",
275 - "mw.EmbedPlayerJava": "mw.EmbedPlayerJava.js",
276 - "mw.EmbedPlayerNative" : "mw.EmbedPlayerNative.js",
277 -
278 - "mw.EmbedPlayerVlc" : "mw.EmbedPlayerVlc.js",
279 -
280 - "mw.PlayerControlBuilder" : "skins/mw.PlayerControlBuilder.js",
281 -
282 - "mw.style.EmbedPlayer" : "skins/mw.style.EmbedPlayer.css",
283 -
284 - "mw.style.PlayerSkinKskin" : "skins/kskin/mw.style.PlayerSkinKskin.css",
285 -
286 - "mw.PlayerSkinKskin" : "skins/kskin/mw.PlayerSkinKskin.js",
287 -
288 - "mw.PlayerSkinMvpcf" : "skins/mvpcf/mw.PlayerSkinMvpcf.js",
289 - "mw.style.PlayerSkinMvpcf" : "skins/mvpcf/mw.style.PlayerSkinMvpcf.css",
290 -
291 - "mw.IFramePlayerApiServer" : "mw.IFramePlayerApiServer.js",
292 - "mw.IFramePlayerApiClient" : "mw.IFramePlayerApiClient.js"
293 - } );
294 -
295 - /**
29610 * Check the current DOM for any tags in "EmbedPlayer.RewriteTags"
29711 */
29812 mw.documentHasPlayerTags = function() {
29913 var rewriteTags = mw.getConfig( 'EmbedPlayer.RewriteTags' );
300 - if( $j( rewriteTags ).length != 0 ) {
 14+ if( $( rewriteTags ).length != 0 ) {
30115 return true;
30216 }
30317 return false;
@@ -308,44 +22,41 @@
30923 * We use mw.addSetupHook instead of mw.ready so that
31024 * mwEmbed player is setup before any other mw.ready calls
31125 */
312 - mw.addSetupHook( function( callback ) {
313 - mw.rewritePagePlayerTags( callback );
314 - });
315 -
316 - mw.rewritePagePlayerTags = function( callback ) {
 26+ $( mw ).bind( 'SetupInterface', function( event, callback ){
 27+
31728 mw.log( 'Loader::EmbedPlayer:rewritePagePlayerTags:' + mw.documentHasPlayerTags() );
31829
31930 // Allow modules to do tag rewrites as well:
32031 var doModuleTagRewrites = function(){
321 - $j(mw).triggerQueueCallback( 'LoadeRewritePlayerTags', callback );
322 - }
 32+ $(mw).triggerQueueCallback( 'LoadeRewritePlayerTags', callback );
 33+ }
32334
32435 if( mw.documentHasPlayerTags() ) {
32536 var rewriteElementCount = 0;
32637
32738 // Set each player to loading ( as early on as possible )
328 - $j( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).each( function( index, element ){
 39+ $( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).each( function( index, element ){
32940
33041 // Assign an the element an ID ( if its missing one )
331 - if ( $j( element ).attr( "id" ) == '' ) {
332 - $j( element ).attr( "id", 'v' + ( rewriteElementCount++ ) );
 42+ if ( $( element ).attr( "id" ) == '' ) {
 43+ $( element ).attr( "id", 'v' + ( rewriteElementCount++ ) );
33344 }
33445 // Add an absolute positioned loader
335 - $j( element )
 46+ $( element )
33647 .getAbsoluteOverlaySpinner()
337 - .attr('id', 'loadingSpinner_' + $j( element ).attr('id') )
 48+ .attr('id', 'loadingSpinner_' + $( element ).attr('id') )
33849 .addClass( 'playerLoadingSpinner' );
33950
34051 });
34152 // Load the embedPlayer module ( then run queued hooks )
34253 mw.load( 'EmbedPlayer', function ( ) {
34354 // Rewrite the EmbedPlayer.RewriteTags with the
344 - $j( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).embedPlayer( doModuleTagRewrites );
 55+ $( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).embedPlayer( doModuleTagRewrites );
34556 })
34657 } else {
34758 doModuleTagRewrites();
34859 }
349 - };
 60+ });
35061
35162 /**
35263 * Add the module loader function:
@@ -353,7 +64,7 @@
35465 mw.addModuleLoader( 'EmbedPlayer', function() {
35566 var _this = this;
35667 // Hide videonojs class
357 - $j( '.videonojs' ).hide();
 68+ $( '.videonojs' ).hide();
35869
35970 // Set up the embed video player class request: (include the skin js as well)
36071 var dependencyRequest = [
@@ -362,40 +73,40 @@
36374 ],
36475 [
36576 'mw.PlayerControlBuilder',
366 - '$j.fn.hoverIntent',
 77+ '$.fn.hoverIntent',
36778 'mw.style.EmbedPlayer',
368 - '$j.cookie',
 79+ '$.cookie',
36980 // Add JSON lib if browsers does not define "JSON" natively
37081 'JSON',
371 - '$j.ui',
372 - '$j.widget'
 82+ '$.ui',
 83+ '$.widget'
37384 ],
37485 [
375 - '$j.ui.mouse',
376 - '$j.fn.menu',
 86+ '$.ui.mouse',
 87+ '$.fn.menu',
37788 'mw.style.jquerymenu',
378 - '$j.ui.slider'
 89+ '$.ui.slider'
37990 ]
38091 ];
38192
38293 // Pass every tag being rewritten through the update request function
383 - $j( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).each( function(inx, playerElement) {
 94+ $( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).each( function(inx, playerElement) {
38495 mw.embedPlayerUpdateLibraryRequest( playerElement, dependencyRequest[ 1 ] )
38596 } );
38697
38798 // Add PNG fix code needed:
388 - if ( $j.browser.msie && $j.browser.version < 7 ) {
389 - dependencyRequest[0].push( '$j.fn.pngFix' );
 99+ if ( $.browser.msie && $.browser.version < 7 ) {
 100+ dependencyRequest[0].push( '$.fn.pngFix' );
390101 }
391102
392103 // Do short detection, to avoid extra player library request in ~most~ cases.
393104 //( If browser is firefox include native, if browser is IE include java )
394 - if( $j.browser.msie ) {
 105+ if( $.browser.msie ) {
395106 dependencyRequest[0].push( 'mw.EmbedPlayerJava' );
396107 }
397108
398109 // Safari gets slower load since we have to detect ogg support
399 - if( !!document.createElement('video').canPlayType && !$j.browser.safari ) {
 110+ if( !!document.createElement('video').canPlayType && !$.browser.safari ) {
400111 dependencyRequest[0].push( 'mw.EmbedPlayerNative' )
401112 }
402113 // Check if the iFrame player api is enabled and we have a parent iframe url:
@@ -404,7 +115,7 @@
405116 mw.getConfig( 'EmbedPlayer.IframeParentUrl' )
406117 ){
407118 dependencyRequest[0].push('mw.EmbedPlayerNative');
408 - dependencyRequest[0].push('$j.postMessage');
 119+ dependencyRequest[0].push('$.postMessage');
409120 dependencyRequest[0].push('mw.IFramePlayerApiServer');
410121 }
411122
@@ -423,26 +134,26 @@
424135 * @param {Array} dependencyRequest The library request array
425136 */
426137 mw.embedPlayerUpdateLibraryRequest = function(playerElement, dependencyRequest ){
427 - var skinName = $j( playerElement ).attr( 'class' );
 138+ var skinName = $( playerElement ).attr( 'class' );
428139 // Set playerClassName to default if unset or not a valid skin
429 - if( ! skinName || $j.inArray( skinName.toLowerCase(), mw.validSkins ) == -1 ){
 140+ if( ! skinName || $.inArray( skinName.toLowerCase(), mw.validSkins ) == -1 ){
430141 skinName = mw.getConfig( 'EmbedPlayer.SkinName' );
431142 }
432143 skinName = skinName.toLowerCase();
433144 // Add the skin to the request
434145 var skinCaseName = skinName.charAt(0).toUpperCase() + skinName.substr(1);
435146 // The skin js:
436 - if( $j.inArray( 'mw.PlayerSkin' + skinCaseName, dependencyRequest ) == -1 ){
 147+ if( $.inArray( 'mw.PlayerSkin' + skinCaseName, dependencyRequest ) == -1 ){
437148 dependencyRequest.push( 'mw.PlayerSkin' + skinCaseName );
438149 }
439150 // The skin css
440 - if( $j.inArray( 'mw.style.PlayerSkin' + skinCaseName, dependencyRequest ) == -1 ){
 151+ if( $.inArray( 'mw.style.PlayerSkin' + skinCaseName, dependencyRequest ) == -1 ){
441152 dependencyRequest.push( 'mw.style.PlayerSkin' + skinCaseName );
442153 }
443154
444155 // Allow extension to extend the request.
445 - $j( mw ).trigger( 'LoaderEmbedPlayerUpdateRequest',
 156+ $( mw ).trigger( 'LoaderEmbedPlayerUpdateRequest',
446157 [ playerElement, dependencyRequest ] );
447158 }
448159
449 -} )( window.mw );
 160+} )( mediaWiki, jQuery );
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_Sources.html
@@ -3,7 +3,7 @@
44 <head>
55 <title>Player sources</title>
66
7 -<script type="text/javascript" src="../../../ResourceLoader.php?class=window.jQuery,mwEmbed&&debug=true"></script>
 7+<script type="text/javascript" src="../../../load.php?modules=startup&only=scripts&debug=true"></script>
88 </head>
99 <body>
1010
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -859,9 +859,6 @@
860860 // Selected mediaSource element.
861861 selectedSource: null,
862862
863 - // Media element thumbnail
864 - thumbnail: null,
865 -
866863 // Media element linkback
867864 linkback: null,
868865
@@ -1070,9 +1067,9 @@
10711068 },
10721069
10731070 /**
1074 - * Returns the thumbnail URL for the media element.
 1071+ * Returns the poster URL for the media element.
10751072 *
1076 - * @returns {String} thumbnail URL
 1073+ * @returns {String} poster URL
10771074 */
10781075 getPosterSrc: function( ) {
10791076 return this.poster;
@@ -1315,9 +1312,6 @@
13161313 }
13171314
13181315 // Set the poster:
1319 - if ( $j( element ).attr( 'thumbnail' ) ) {
1320 - _this.poster = $j( element ).attr( 'thumbnail' );
1321 - }
13221316 if ( $j( element ).attr( 'poster' ) ) {
13231317 _this.poster = $j( element ).attr( 'poster' );
13241318 }
@@ -1971,7 +1965,7 @@
19721966 // Close Menu Overlay:
19731967 this.controlBuilder.closeMenuOverlay();
19741968
1975 - // update the thumbnail html:
 1969+ // update the Poster html:
19761970 this.updatePosterHTML();
19771971
19781972 this.paused = true;
@@ -1979,7 +1973,7 @@
19801974 // Make sure the controlBuilder bindings are up-to-date
19811975 this.controlBuilder.addControlBindings();
19821976
1983 - // Once the thumbnail is shown run the mediaReady trigger (if not using
 1977+ // Once the Poster is shown run the mediaReady trigger (if not using
19841978 // native controls)
19851979 if( !this.useNativePlayerControls() ){
19861980 mw.log("mediaLoaded");
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/resources/mediawiki/mediawiki.js
@@ -299,7 +299,7 @@
300300 // Check the parameters type
301301 if( parameters[index] && ( typeof parameters[index] == 'function' || parameters[index] instanceof jQuery ) ){
302302 useSwapIndex = true;
303 - return '<span id="mw_message_swap_index_' + index +'"></span>'
 303+ return '<span id="mw_message_swap_index_' + index +'"></span>';
304304 } else {
305305 // directly swap in the index or a missing index indicator ( $1{int}
306306 return ( index in parameters ) ? parameters[index] : '$' + match;
@@ -930,7 +930,7 @@
931931 }
932932 // Load asynchronously after doumument ready
933933 if ( ready ) {
934 - setTimeout( function() { $( 'body' ).append( request() ); }, 0 )
 934+ setTimeout( function() { $( 'body' ).append( request() ); }, 0 );
935935 } else {
936936 document.write( request() );
937937 }
@@ -1043,7 +1043,7 @@
10441044 // Validate input
10451045 if ( typeof dependencies !== 'object' && typeof dependencies !== 'string' ) {
10461046 throw new Error( 'dependencies must be a string or an array, not a ' +
1047 - typeof dependencies )
 1047+ typeof dependencies );
10481048 }
10491049 // Allow calling with a single dependency as a string
10501050 if ( typeof dependencies === 'string' ) {
@@ -1083,7 +1083,7 @@
10841084 // Validate input
10851085 if ( typeof modules !== 'object' && typeof modules !== 'string' ) {
10861086 throw new Error( 'dependencies must be a string or an array, not a ' +
1087 - typeof dependencies )
 1087+ typeof dependencies );
10881088 }
10891089 // Allow calling with an external script or single dependency as a string
10901090 if ( typeof modules === 'string' ) {
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/resources/startup.js
@@ -16,7 +16,7 @@
1717 * * Opera 9+
1818 * * Chrome 1+
1919 */
20 -var isCompatible = function() {
 20+var mwIsCompatible = function() {
2121 // IE < 6
2222 if ( navigator.appVersion.indexOf( 'MSIE' ) !== -1
2323 && parseFloat( navigator.appVersion.split( 'MSIE' )[1] ) < 6 )

Status & tagging log