diff --git a/LocalSettings.php b/LocalSettings.php
new file mode 100644
index 0000000000..81589c36a8
--- /dev/null
+++ b/LocalSettings.php
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/ResourceLoader.php b/ResourceLoader.php
index 371a7439ff..8ec78d6d5f 100644
--- a/ResourceLoader.php
+++ b/ResourceLoader.php
@@ -5,8 +5,6 @@
*/
//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';
// Check if being used in mediaWiki ( ResourceLoader.php is NOT an entry point )
if( is_file ( dirname( __FILE__ ) .'../mwResourceLoader.php' )
@@ -16,10 +14,8 @@
// Check if we are an entry point or being used as part of MEDIAWIKI:
if ( !defined( 'MEDIAWIKI' ) && !defined( 'SCRIPTLOADER_MEDIAWIKI') ) {
- // Allow an installation an optional PHP customization/overrides file
- if ( is_file ( dirname( __FILE__ ) .'/../localSettings.php' ) ) {
- require_once dirname( __FILE__ ) .'/../localSettings.php';
- }
+ // Include settings ( will include LocalSettings.php in the root mwEmbed folder
+ require_once( dirname( __FILE__ ) . '/includes/DefaultSettings.php' );
// Load stand alone Resource Loader config
// ( if running as a remote, mediaWiki variables / functions are already included as part of mediaWiki )
@@ -1215,8 +1211,9 @@ public function getCacheFileName() {
$this->filename = "{$wgScriptCacheDirectory}/{$hash1}/{$hash2}/{$hash}.js";
// Check for defined files::
- if( is_file( $this->filename ) )
- return $this->filename;
+ if( is_file( $this->filename ) ){
+ return $this->filename;
+ }
// Check for non-config based gzip version already there?
if( is_file( $this->filename . '.gz') ){
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
new file mode 100644
index 0000000000..a6ba9ef2ef
--- /dev/null
+++ b/includes/DefaultSettings.php
@@ -0,0 +1,52 @@
+
\ No newline at end of file
diff --git a/modules/EmbedPlayer/mw.EmbedPlayer.js b/modules/EmbedPlayer/mw.EmbedPlayer.js
index 695a06d3bd..344e5ca3cc 100644
--- a/modules/EmbedPlayer/mw.EmbedPlayer.js
+++ b/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -2068,8 +2068,7 @@ mw.EmbedPlayer.prototype = {
this.controls = true;
}
if( !this.useNativePlayerControls() && !this.isPersistentNativePlayer() && !_this.controlBuilder.checkOverlayControls() ){
- // give the interface more space for the controls:
- //this.$interface.css('height', this.height + _this.controlBuilder.height )
+ // Update the video size per available control space.
$j(this).css('height', this.height - _this.controlBuilder.height );
}
diff --git a/modules/KalturaSupport/kalturaIframe.php b/modules/KalturaSupport/kalturaIframe.php
index b6fbc2d9bb..2b44ba4ab9 100644
--- a/modules/KalturaSupport/kalturaIframe.php
+++ b/modules/KalturaSupport/kalturaIframe.php
@@ -4,15 +4,7 @@
*
*/
-// Some predefined constants ( need to load these from config..
-// and or allow configuration payload to be passed in via iframe message.
-define( 'KALTURA_SERVICE_URL', 'http://www.kaltura.com/' );
-define( 'KALTURA_CDN_URL', 'http://cdn.kaltura.com' );
-define( 'KALTURA_SERVICE_BASE', '/api_v3/index.php?');
-define( 'KALTURA_MWEMBED_PATH', str_replace( 'mwEmbedFrame.php', '', $_SERVER['SCRIPT_NAME'] ) );
-define( 'KALTURA_UICONF_CACHE_TIME', 600 );
-
-define( 'KALTURA_GENERIC_SERVER_ERROR', "Error getting sources from server, something maybe broken or server is under high loa.d Please try again.");
+define( 'KALTURA_GENERIC_SERVER_ERROR', "Error getting sources from server, something maybe broken or server is under high load. Please try again.");
// Setup the kalturaIframe
$mykalturaIframe = new kalturaIframe();
@@ -87,13 +79,13 @@ private function parseRequest(){
// Check for required config
if( $this->playerAttributes['wid'] == null ){
- $this->error = 'Can not display player, missing widget id';
+ $this->outputIframeError( 'Can not display player, missing widget id' );
}
}
// Load the kaltura library and grab the most compatible flavor
private function getFlavorSources(){
-
+ global $wgKalturaCDNUrl;
// Check the access control before returning any source urls
if( !$this->isAccessControlAllowed() ) {
return array();
@@ -107,7 +99,7 @@ private function getFlavorSources(){
if( isset( $resultObject['flavors']['code'] ) ){
switch( $resultObject['flavors']['code'] ){
case 'ENTRY_ID_NOT_FOUND':
- $this->error = "
Entry Id not found
" . htmlspecialchars( $resultObject['flavors']['message'] );
+ $this->fatalIframeError( "Entry Id not found", htmlspecialchars( $resultObject['flavors']['message'] ) );
break;
}
// @@TODO should probably refactor to use throw catch error system.
@@ -116,7 +108,7 @@ private function getFlavorSources(){
foreach( $resultObject['flavors'] as $KalturaFlavorAsset ){
- $assetUrl = KALTURA_CDN_URL .'/p/' . $this->getPartnerId() . '/sp/' .
+ $assetUrl = $wgKalturaCDNUrl .'/p/' . $this->getPartnerId() . '/sp/' .
$this->getPartnerId() . '00/flvclipper/entry_id/' .
$this->playerAttributes['entry_id'] . '/flavor/' . $KalturaFlavorAsset->id;
if( strpos( $KalturaFlavorAsset->tags, 'iphone' ) !== false ){
@@ -164,13 +156,14 @@ private function getCacheDir(){
}
private function getResultObject(){
+ global $wgKalturaUiConfCacheTime;
// Check if we have a cached result object:
if( $this->resultObj ){
return $this->resultObj;
}
$cacheFile = $this->getCacheDir() . '/' . $this->getResultObjectCacheKey() . ".entry.txt";
- $cacheLife = KALTURA_UICONF_CACHE_TIME;
+ $cacheLife = $wgKalturaUiConfCacheTime;
// Check modify time on cached php file
$filemtime = @filemtime($cacheFile); // returns FALSE if file does not exist
@@ -233,7 +226,7 @@ function getResultObjectFromApi(){
$rawResultObject = $client->doQueue();
$client->throwExceptionIfError($this->resultObj);
} catch( Exception $e ){
- $this->error = KALTURA_GENERIC_SERVER_ERROR . "\n" . $e->getMessage();
+ $this->fatalIframeError( KALTURA_GENERIC_SERVER_ERROR . "\n" . $e->getMessage() );
return array();
}
@@ -256,12 +249,12 @@ function getReferer(){
return ( isset( $_SERVER['HTTP_REFERER'] ) ) ? $_SERVER['HTTP_REFERER'] : 'http://www.kaltura.org/';
}
function getClient(){
- global $mwEmbedRoot;
+ global $mwEmbedRoot, $wgKalturaUiConfCacheTime;
$cacheDir = $mwEmbedRoot . '/includes/cache';
$cacheFile = $this->getCacheDir() . '/' . $this->getPartnerId() . ".ks.txt";
- $cacheLife = KALTURA_UICONF_CACHE_TIME;
+ $cacheLife = $wgKalturaUiConfCacheTime;
$conf = new KalturaConfiguration( $this->getPartnerId() );
$client = new KalturaClient( $conf );
@@ -274,8 +267,7 @@ function getClient(){
$this->ks = $session->ks;
file_put_contents( $cacheFile, $this->ks );
} catch ( Exception $e ){
- $this->error = $this->error = KALTURA_GENERIC_SERVER_ERROR . "\n" . $e->getMessage();
- return false;
+ $this->fatalIframeError( KALTURA_GENERIC_SERVER_ERROR . "\n" . $e->getMessage() );
}
} else {
$this->ks = file_get_contents( $cacheFile );
@@ -311,39 +303,36 @@ function getPlayerData() {
function isAccessControlAllowed() {
$resultObject = $this->getResultObject();
$accessControl = $resultObject['accessControl'];
+
// Checks if admin
- if($accessControl->isAdmin) {
+ if( $accessControl->isAdmin ) {
return true;
}
/* Domain Name Restricted */
if($accessControl->isSiteRestricted) {
- $this->error = "Un authorized domain
We're sorry, this content is only available on certain domains.";
- return false;
+ $this->fatalIframeError( "Un authorized domain", "We're sorry, this content is only available on certain domains." );
}
/* Country Restricted */
if($accessControl->isCountryRestricted) {
- $this->error = "Un authorized country
We're sorry, this content is only available on certain countries.";
- return false;
+ $this->fatalIframeError( "Un authorized country", "We're sorry, this content is only available on certain countries.");
}
/* Session Restricted */
if($accessControl->isSessionRestricted) {
- $this->error = "No KS where KS is required
We're sorry, access to this content is restricted.";
- return false;
+ $this->fatalIframeError( "No KS where KS is required", "We're sorry, access to this content is restricted.");
}
if($accessControl->isScheduledNow == null) {
- $this->error = "Out of scheduling
We're sorry, this content is currently unavailable.";
- return false;
+ $this->fatalIframeError( "Out of scheduling", "We're sorry, this content is currently unavailable.");
}
return true;
}
function getPlayEventUrl() {
-
+ global $wgKalturaServiceUrl, $wgKalturaServiceBase;
$param = array(
'service' => 'stats',
'action' => 'collect',
@@ -381,7 +370,7 @@ function getPlayEventUrl() {
$param['kalsig'] = md5( $sigString );
$requestString = http_build_query( $param );
- return KALTURA_SERVICE_URL . KALTURA_SERVICE_BASE . $requestString;
+ return $wgKalturaServiceUrl . $wgKalturaServiceBase . $requestString;
}
// Returns a simple image with a direct link to the asset
@@ -400,8 +389,7 @@ private function getFileLinkHTML(){
$flavorUrl = $sources['ogg']['src'];
} else {
// Throw an exception ( no web streams )
- $this->error = 'No web streams available, please check your enabled flavors';
- return ;
+ $this->fatalIframeError( 'No web streams available, please check your enabled flavors' );
}
// The outer container:
$o='';
@@ -414,13 +402,14 @@ private function getFileLinkHTML(){
}
private function getVideoHTML( ){
+ global $wgKalturaCDNUrl;
$videoTagMap = array(
'entry_id' => 'kentryid',
'uiconf_id' => 'kuiconfid',
'wid' => 'kwidgetid',
'autoplay' => 'autoplay',
);
- $posterUrl = KALTURA_CDN_URL . '/p/' . $this->getPartnerId() . '/sp/' .
+ $posterUrl = $wgKalturaCDNUrl . '/p/' . $this->getPartnerId() . '/sp/' .
$this->getPartnerId() . '00/thumbnail/' .
'entry_id/' . $this->playerAttributes['entry_id'] .
'/height/480';
@@ -475,7 +464,8 @@ private function getVideoHTML( ){
}
private function getFlashEmbedHTML( $childHTML = '' ){
- $swfUrl = KALTURA_SERVICE_URL . '/index.php/kwidget';
+ global $wgKalturaServiceUrl;
+ $swfUrl = $wgKalturaServiceUrl . '/index.php/kwidget';
foreach($this->playerAttributes as $key => $val ){
if( $val != null ){
$swfUrl.='/' . $key . '/' . $val;
@@ -496,211 +486,239 @@ private function getFlashEmbedHTML( $childHTML = '' ){
$childHTML .
'';
}
+
/**
* void function to set iframe content headers
*/
private function setIFrameHeaders(){
+ global $wgKalturaUiConfCacheTime;
header( 'Pragma: public' );
// Set relevent expire headers:
if( $this->isCachedOutput() ){
- // Cache for KALTURA_UICONF_CACHE_TIME
- header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + KALTURA_UICONF_CACHE_TIME ) . " GM" );
+ // Cache for $wgKalturaUiConfCacheTime
+ header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $wgKalturaUiConfCacheTime ) . " GM" );
} else {
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
}
// Gzip the output
}
-
- function outputIFrame( ){
+ private function outputIframeHeadElement(){
+ global $wgMwEmbedPathUrl;
+ ?>
+
+
+
Kaltura Embed Player iFrame
+
+
+ setIFrameHeaders();
- // ob_gzhandler automatically checks for browser gzip support in the request
+
+ // ob_gzhandler automatically checks for browser gzip support in and gzips
ob_start("ob_gzhandler");
?>
-
-
-
-
-
kaltura iFrame
-
-
-
- getVideoHTML();
- if( $this->error ) {
- echo '
'. $this->error .'
';
- } else {
- ?>
-
-
-
+
+ window.kCollectCallback = function(){ return ; }; // callback for jsonp
+
+ document.getElementById('directFileLinkButton').onclick = function() {
+ kAppendScriptUrl( 'getPlayEventUrl() ?>' + '&callback=kCollectCallback' );
+ return true;
+ };
+ }
+
+ }
+
+
+
+ outputIframeHeadElement() ?>
+
+
' . htmlspecialchars( $errorTitle ) . '';
+ }
+ // Presently errors can have html foramting ( not ideal )
+ // TODO refactor to have error title and error message arguments
+ echo htmlspecialchars( $errorMsg );
+ ?>
+
+
diff --git a/mwEmbedFrame.php b/mwEmbedFrame.php
index 8c6725a5b8..8054668308 100644
--- a/mwEmbedFrame.php
+++ b/mwEmbedFrame.php
@@ -9,6 +9,8 @@
*
*/
+// Include configuration: ( will include LocalSettings.php )
+require( dirname( __FILE__ ) . '/includes/DefaultSettings.php' );
// Setup the mwEmbedFrame
$myMwEmbedFrame = new mwEmbedFrame();
diff --git a/mwEmbedLoader.js b/mwEmbedLoader.js
index c5be92bbd7..7021103533 100644
--- a/mwEmbedLoader.js
+++ b/mwEmbedLoader.js
@@ -35,15 +35,15 @@
* // $j('#iframeid').bind('ended', function(){ .. end playback event ... }
* 'EmbedPlayer.EnableIframeApi' : false
*/
-var kURID = '1.2j';
+var kURID = '1.2h';
// Static script loader url:
var SCRIPT_LOADER_URL = 'http://www.kaltura.org/apis/html5lib/mwEmbed/ResourceLoader.php';
var SCRIPT_FORCE_DEBUG = false;
var FORCE_LOAD_JQUERY = false;
// These Lines are for local testing:
-//SCRIPT_FORCE_DEBUG = true;
-//SCRIPT_LOADER_URL = 'http://192.168.1.145/html5.kaltura/mwEmbed/ResourceLoader.php';
+SCRIPT_FORCE_DEBUG = true;
+SCRIPT_LOADER_URL = 'http://192.168.1.145/html5.kaltura/mwEmbed/ResourceLoader.php';
if( typeof console != 'undefined' && console.log ) {
console.log( 'Kaltura MwEmbed Loader Version: ' + kURID );
diff --git a/skins/common/mw.style.mwCommon.css b/skins/common/mw.style.mwCommon.css
index 63dadec2a0..f70eaade94 100644
--- a/skins/common/mw.style.mwCommon.css
+++ b/skins/common/mw.style.mwCommon.css
@@ -187,12 +187,12 @@ ul.ui-provider-selection li a {
.play-btn-large {
width: 70px;
height: 53px;
- background : url(images/player_big_play_button.png?1);
+ background : url('images/player_big_play_button.png?1');
position : absolute;
cursor : pointer;
border : none !important;
z-index : 1;
}
.play-btn-large:hover {
- background : url(images/player_big_play_button_hover.png?1);
+ background : url('images/player_big_play_button_hover.png?1');
}
\ No newline at end of file