http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72840
Revision: 72840
Author: dale
Date: 2010-09-12 07:24:32 +0000 (Sun, 12 Sep 2010)
Log Message:
-----------
* added attributionButton config option as a genneral attribution support type
* added jQuery include with player test
* added about library link to player menu
* added concept of localSettings.js for site config
* removed unused wgScriptCacheDir in mwEmbedFrame.php
Modified Paths:
--------------
branches/MwEmbedStandAlone/ResourceLoader.php
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/EmbedPlayer.i18n.php
branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
branches/MwEmbedStandAlone/mwEmbed.js
branches/MwEmbedStandAlone/mwEmbedFrame.php
Added Paths:
-----------
branches/MwEmbedStandAlone/localSettings.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_IncludeJQuery.html
Modified: branches/MwEmbedStandAlone/ResourceLoader.php
===================================================================
--- branches/MwEmbedStandAlone/ResourceLoader.php 2010-09-12 05:27:29 UTC
(rev 72839)
+++ branches/MwEmbedStandAlone/ResourceLoader.php 2010-09-12 07:24:32 UTC
(rev 72840)
@@ -151,8 +151,16 @@
// Output the current language resource js
$this->output .=
NamedResourceLoader::getLanguageJs( $this->langCode );
-
- // Add the required core mwEmbed style sheets
Commted out
+
+ // Output the localSettings.js
+ $localSettingsJsPath = realpath( dirname(
__FILE__ ) ) . '/localSettings.js';
+ if( is_file( $localSettingsJsPath ) ){
+ wfSuppressWarnings();
+ $this->output .= file_get_contents(
$localSettingsJsPath );
+ wfRestoreWarnings();
+ }
+
+ // Add the required core mwEmbed style sheets
removed for now
// because when creating stand alone packages
js package with css
// the paths get messed up.
/*
Added: branches/MwEmbedStandAlone/localSettings.js
===================================================================
--- branches/MwEmbedStandAlone/localSettings.js (rev 0)
+++ branches/MwEmbedStandAlone/localSettings.js 2010-09-12 07:24:32 UTC (rev
72840)
@@ -0,0 +1,9 @@
+/**
+* Local Setting file hosts any per site configuration
+*
+* This file is automatically included in any resourceLoader or mwEmbed.js
request
+*
+* You can put any mw.setConfig('moduleOption', value ) calls in here.
+*
+* In a fresh svn checkout this file will always be empty.
+*/
Modified:
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
2010-09-12 05:27:29 UTC (rev 72839)
+++ branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
2010-09-12 07:24:32 UTC (rev 72840)
@@ -331,9 +331,6 @@
if ( size.width ) {
request['iiurlwidth'] = size.width;
}
- if( size.height ){
- request['iiurlheight'] = size.height;
- }
mw.getJSON( this.provider.apiUrl, request, function( data ) {
var imObj = { };
Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/EmbedPlayer.i18n.php
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/EmbedPlayer.i18n.php
2010-09-12 05:27:29 UTC (rev 72839)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/EmbedPlayer.i18n.php
2010-09-12 07:24:32 UTC (rev 72840)
@@ -34,6 +34,9 @@
'mwe-embedplayer-download' => 'Download',
'mwe-embedplayer-share' => 'Share',
'mwe-embedplayer-credits' => 'Credits',
+ 'mwe-embedplayer-about-library'=> 'About kaltura player',
+ '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].',
+
'mwe-embedplayer-clip_linkback' => 'Clip source page',
'mwe-embedplayer-choose_player' => 'Choose video player',
'mwe-embedplayer-no-player' => 'No player available for $1',
Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js 2010-09-12
05:27:29 UTC (rev 72839)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js 2010-09-12
07:24:32 UTC (rev 72840)
@@ -6,6 +6,7 @@
* Default player module configuration
*/
( function( mw ) {
+ window['MW_EMBED_LIBRARY_PAGE'] =
'http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library';
mw.setDefaultConfig( {
// If the player controls should be overlaid on top of the
video ( if supported by playback method)
@@ -25,8 +26,19 @@
// If the video player should attribute kaltura
"EmbedPlayer.KalturaAttribution" : true,
+
+ // The attribution button
+ 'EmbedPlayer.AttributionButton' :{
+ 'title' : 'Kaltura html5 video library',
+ 'href' : MW_EMBED_LIBRARY_PAGE,
+ // Style icon to be applied
+ 'class' : 'kaltura-icon',
+ // An icon image url ( should be a 16x16 image or data url
)
+ 'iconurl' : false
+ },
+
- // Set the browser player warning flag to true by default (
applies to all players so its not part of attribute defaults above )
+ // Set the browser player warning flag displays warning for non
optimal playback
"EmbedPlayer.ShowNativeWarning" : true,
// If fullscreen is global enabled.
@@ -137,7 +149,7 @@
});
// Load the embedPlayer module ( then run queued hooks
)
mw.load( 'EmbedPlayer', function ( ) {
- mw.log("EmbedPlayer:: do rewrite tags");
+ mw.log("EmbedPlayer:: do rewrite players:" +
$j( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).length );
// Rewrite the EmbedPlayer.RewriteTags with the
$j( mw.getConfig( 'EmbedPlayer.RewriteTags' )
).embedPlayer();
})
Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
2010-09-12 05:27:29 UTC (rev 72839)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
2010-09-12 07:24:32 UTC (rev 72840)
@@ -36,6 +36,8 @@
"mwe-embedplayer-download_text" : "Download timed text",
"mwe-embedplayer-download" : "Download",
"mwe-embedplayer-share" : "Share",
+ 'mwe-embedplayer-about-library' : 'About kaltura player',
+ "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].',
"mwe-embedplayer-credits" : "Credits",
"mwe-embedplayer-clip_linkback" : "Clip source page",
"mwe-embedplayer-choose_player" : "Choose video player",
@@ -335,7 +337,7 @@
// Make sure we have user preference setup ( for setting
preferences on video selection )
mw.setupUserConfig( function() {
// Add each selected element to the player manager:
- $j( playerSelect ).each( function( index,
playerElement) {
+ $j( playerSelect ).each( function( index,
playerElement) {
// Make sure the video tag was not generated by
our library:
if( $j( playerElement ).hasClass(
'nativeEmbedPlayerPid' ) ){
$j('#loadingSpinner_' + $j(
playerElement ).attr('id') ).hide();
@@ -478,8 +480,9 @@
if( ranPlayerSwapFlag ){
return ;
}
+ ranPlayerSwapFlag = true;
mw.log("EmbedPlayer::runPlayerSwap::" + $j(
playerElement ).attr('id') );
- ranPlayerSwapFlag = true;
+
var playerInterface = new mw.EmbedPlayer(
playerElement , attributes);
_this.swapEmbedPlayerElement( playerElement,
playerInterface );
@@ -611,6 +614,7 @@
if( playerInterface.shouldUseNativeControls() ) {
$j( targetElement )
.attr('id', playerInterface.pid )
+ .addClass( 'nativeEmbedPlayerPid' )
.after(
$j( swapPlayerElement ).css('display', 'none')
)
@@ -1480,7 +1484,7 @@
// Set the player size attributes based loaded video element:
this.setPlayerSize( element );
-
+
// Set the plugin id
this.pid = 'pid_' + this.id;
@@ -2693,15 +2697,18 @@
_this.pause();
} )
.attr( 'title', gM( 'mwe-embedplayer-pause_clip' ) );
-
-
- // If we previously finished playing this clip run the
"replay hook"
- if( this.donePlayingCount > 0 ) {
+
+ // Start the monitor if not already started
+ this.monitor();
+
+ // If we previously finished playing this clip run the "replay
hook"
+ if( this.donePlayingCount > 0 ) {
mw.log("replayEvent");
$j( this ).trigger( 'replayEvent' );
- }
+ }
},
+
/**
* Maps the html5 load request. There is no general way to "load" clips
so
* underling plugin-player libs should override.
@@ -3037,13 +3044,11 @@
}
// Call monitor at 250ms interval. ( use setInterval to avoid
stacking monitor requests )
- //mw.log("EmbedPlayer::monitor: continue?:" + !this.isStopped()
+ ' monitorInterval: ' + this.monitorInterval );
- if( ! this.isStopped() ) {
- if( !this.monitorInterval ){
- this.monitorInterval = setInterval( function(){
- if( _this.monitor ){
+ if( ! this.isStopped() ) {
+ if( !this.monitorInterval ){
+ this.monitorInterval = setInterval( function(){
+ if( _this.monitor )
_this.monitor();
- }
}, this.monitorRate )
}
} else {
@@ -3104,14 +3109,14 @@
*
* @param {Float} perc Value between 0 and 1 for position of playhead
*/
- updatePlayHead: function( perc ) {
+ updatePlayHead: function( perc ) {
$playHead = this.$interface.find( '.play_head' );
if ( this.controls && $playHead.length != 0 ) {
var val = parseInt( perc * 1000 );
$playHead.slider( 'value', val );
}
- // @@todo should fix this name:
- $j(this).trigger('updatePlayHeadPercent', perc);
+ // @@todo should have 'progress' trigger the same as html5
+ $j( this ).trigger('updatePlayHeadPercent', perc);
},
/**
Modified:
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
===================================================================
---
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
2010-09-12 05:27:29 UTC (rev 72839)
+++
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.PlayerSkinKskin.js
2010-09-12 07:24:32 UTC (rev 72840)
@@ -46,8 +46,8 @@
'volumeControl': {
'w':40
},
- // No kalturaAttribution component for kSkin ( its integrated
into the credits screen )
- 'kalturaAttribution' : false,
+ // No attributionButton component for kSkin ( its integrated
into the credits screen )
+ 'attributionButton' : false,
// Time display:
'timeDisplay': {
@@ -315,7 +315,7 @@
);
break;
case 'share':
- embedPlayer.$interface.find(
'.menu-share').html(
+ embedPlayer.$interface.find( '.menu-share'
).html(
this.getShare()
);
break;
@@ -339,7 +339,7 @@
.loadingSpinner()
);
- if( mw.getConfig( 'EmbedPlayer.KalturaAttribution' ) == true ){
+ if( mw.getConfig( 'EmbedPlayer.KalturaAttribution' ) == true ){
$target.append(
$j( '<div />' )
.addClass( 'k-attribution' )
Modified:
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
===================================================================
---
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
2010-09-12 05:27:29 UTC (rev 72839)
+++
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
2010-09-12 07:24:32 UTC (rev 72840)
@@ -2,6 +2,7 @@
* Msg text is inherited from embedPlayer
*/
+( function( mw ) {
/**
* mw.PlayerControlBuilder object
* @param the embedPlayer element we are targeting
@@ -43,7 +44,10 @@
'download' : true,
// Share the video menu
- 'share' : true
+ 'share' : true,
+
+ // Player library link
+ 'aboutPlayerLibrary': true
},
// Flag to store the current fullscreen mode
@@ -161,9 +165,9 @@
if( embedPlayer.isTimedTextSupported() ){
this.supportedComponets['timedText'] = true;
}
- // Check for kalturaAttribution
- if( mw.getConfig( 'EmbedPlayer.KalturaAttribution' ) ){
- this.supportedComponets[ 'kalturaAttribution' ] = true;
+ // Check for Attribution button
+ if( mw.getConfig( 'EmbedPlayer.AttributionButton' ) ){
+ this.supportedComponets[ 'attributionButton' ] = true;
}
// Check global fullscreen enabled flag
@@ -813,7 +817,7 @@
);
}
- // Setup play-head slider:
+ // Setup volume slider:
var sliderConf = {
range: "min",
value: 80,
@@ -935,6 +939,19 @@
$j( ctrlObj.embedPlayer ).trigger(
'showShareEvent' );
}
)
+ },
+
+ 'aboutPlayerLibrary' : function( ctrlObj ){
+ return $j.getLineItem(
+ gM( 'mwe-embedplayer-about-library' ),
+ 'info',
+ function( ) {
+ ctrlObj.displayOverlay(
+
ctrlObj.aboutPlayerLibrary()
+ );
+ $j( ctrlObj.embedPlayer
).trigger( 'aboutPlayerLibrary' );
+ }
+ )
}
},
@@ -1050,7 +1067,25 @@
return false; // onclick action return false
},
-
+ aboutPlayerLibrary: function(){
+ return $j( '<div />' )
+ .append(
+ $j( '<h3 />' )
+ .text(
+
gM('mwe-embedplayer-about-library')
+ )
+ ,
+ $j( '<span />')
+ .append(
+
gM('mwe-embedplayer-about-library-desc',
+ $j('<a />').attr({
+ 'href' :
MW_EMBED_LIBRARY_PAGE,
+ 'target' :
'_new'
+ })
+ )
+ )
+ )
+ },
/**
* Get the "share" interface
*
@@ -1428,15 +1463,31 @@
},
/**
- * The kaltura attribution button
+ * The Attribution button ( by default this is kaltura-icon
*/
- 'kalturaAttribution' : {
+ 'attributionButton' : {
'w' : 28,
- 'o' : function( ctrlObj ){
+ 'o' : function( ctrlObj ){
+ var buttonConfig = mw.getConfig(
'EmbedPlayer.AttributionButton');
+
+ var $icon = $j('<span />')
+ .addClass( 'ui-icon' );
+ if( buttonConfig['class'] ){
+ $icon.addClass( buttonConfig['class'] )
+ }
+ // Check for source ( by configuration
convention this is a 16x16 image
+ if( buttonConfig.iconurl ){
+ $icon.append(
+ $j('<img />')
+ .css({'width': '16px',
'height': '16px'})
+ .attr('src',
buttonConfig.iconurl )
+ )
+ }
+
return $j('<a />')
.attr({
- 'href': 'http://kaltura.com',
- 'title' : gM(
'mwe-embedplayer-kaltura-platform-title' ),
+ 'href': buttonConfig.href,
+ 'title' : buttonConfig.title,
'target' : '_new'
})
.append(
@@ -1447,10 +1498,9 @@
'left' : '2px'
})
.append(
- $j('<span />')
- .addClass( 'ui-icon
kaltura-icon' )
+ $icon
)
- )
+ )
}
},
@@ -1687,3 +1737,6 @@
}
}
};
+
+
+} )( window.mw );
Added:
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_IncludeJQuery.html
===================================================================
---
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_IncludeJQuery.html
(rev 0)
+++
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_IncludeJQuery.html
2010-09-12 07:24:32 UTC (rev 72840)
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Player sources</title>
+
+<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"
type="text/javascript"></script>
+<script
src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7/jquery-ui.min.js"
type="text/javascript"></script>
+<script type="text/javascript" src="../../../mwEmbedLoader.js"></script>
+<script type="text/javascript">
+ $(document).ready(function(){
+ $('#test').text('jQuery $ supported' );
+ });
+</script>
+</head>
+<body>
+<div id="test"></div>
+
+<video
poster="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/elephants-dream.jpg"
+ duration="10:53" preload="auto">
+ <source type="video/webm"
src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/elephants-dream_400p.webm"
/>
+ <source type="video/h264"
src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/elephants-dream_iphone.m4v"
/>
+ <source type="video/ogg"
src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/elephants-dream_400p.ogv"
/>
+</video>
+
+
+</body>
+</html>
\ No newline at end of file
Property changes on:
branches/MwEmbedStandAlone/modules/EmbedPlayer/tests/Player_IncludeJQuery.html
___________________________________________________________________
Added: svn:executable
+ *
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-09-12 05:27:29 UTC (rev 72839)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-09-12 07:24:32 UTC (rev 72840)
@@ -138,9 +138,15 @@
)
$clipTrackName = $j( '#' +
this.getTrackNameInterfaceId( trackIndex ) );
}
- // xxx check for specific smilSequenceTrack updates that
require TrackNameInterface update
+ // Update the TrackNameInterface duration on every draw::
+ /*$clipTrackName.find('.trackDuration').text(
+ mw.seconds2npt(
+
this.sequencer.getSmil().getBody().getClipDuration( smilSequenceTrack )
+ )
+ )*/
+
// Add Sequence track container if not present
var $clipTrackSet = $j( '#' + this.getTrackSetId( trackIndex ))
mw.log( "SequenceTimeline::drawSequenceTrack: id: " +
$clipTrackSet.length );
@@ -776,7 +782,15 @@
$trackNameTitle.find('span').attr('title', $j(
smilSequenceTrack ).attr('title') );
}
- $trackNameContainer.append( $trackNameTitle )
+ $trackNameContainer.append(
+ $trackNameTitle
+ ,
+ // Also append a trackDuration span
+ $j( '<br />')
+ ,
+ $j( '<span />').addClass('trackDuration')
+
+ )
// Wrap the track name in a box that matches the trackNames
return $trackNameContainer;
},
Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
2010-09-12 05:27:29 UTC (rev 72839)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
2010-09-12 07:24:32 UTC (rev 72840)
@@ -39,7 +39,6 @@
/**
* Checks if assets are insync
- * re
*/
getPlaybackSyncDelta: function( time ){
var _this = this;
Modified: branches/MwEmbedStandAlone/mwEmbed.js
===================================================================
--- branches/MwEmbedStandAlone/mwEmbed.js 2010-09-12 05:27:29 UTC (rev
72839)
+++ branches/MwEmbedStandAlone/mwEmbed.js 2010-09-12 07:24:32 UTC (rev
72840)
@@ -2153,18 +2153,24 @@
}
if ( ! langLoaderRequest.length ) {
- callback();
+ addLocalSettings();
return ;
}
// Load the launage if set
mw.load( langLoaderRequest, function(){
- mw.log( 'Done moduleLoaderCheck request' );
+ mw.log( 'Done moduleLoaderCheck request' );
+ addLocalSettings();
+ } );
+ }
+ function addLocalSettings(){
+ mw.log("Load loacal settings")
+ mw.load( 'localSettings.js', function(){
// Set the mwModuleLoaderCheckFlag flag to true
- mwModuleLoaderCheckFlag = true;
+ mwModuleLoaderCheckFlag = true;
callback();
- } );
- }
+ })
+ }
}
Modified: branches/MwEmbedStandAlone/mwEmbedFrame.php
===================================================================
--- branches/MwEmbedStandAlone/mwEmbedFrame.php 2010-09-12 05:27:29 UTC (rev
72839)
+++ branches/MwEmbedStandAlone/mwEmbedFrame.php 2010-09-12 07:24:32 UTC (rev
72840)
@@ -13,10 +13,6 @@
* <iframe src="mwEmbedFrame.php?src={SRC URL}&poster={POSTER
URL}&width={WIDTH}etc"> </iframe>
*/
-//Setup the script local script cache directory
-// ( has to be hard coded rather than config based for fast non-mediawiki
config hits )
-$wgScriptCacheDirectory = realpath( dirname( __FILE__ ) ) . '/includes/cache';
-
// Setup the mwEmbedFrame
$myMwEmbedFrame = new mwEmbedFrame();
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs