Skip to content

Commit

Permalink
merge with develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ranyefet committed Mar 19, 2012
1 parent 7810380 commit 48a812b
Show file tree
Hide file tree
Showing 39 changed files with 815 additions and 203 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
/LocalSettings.php
/cache
/nbproject
1 change: 1 addition & 0 deletions loader.js
Expand Up @@ -133,6 +133,7 @@ mw.addResourcePaths( {
"mw.style.ui_start" : "skins/jquery.ui.themes/start/jquery-ui-1.7.2.css",
"mw.style.ui_sunny" : "skins/jquery.ui.themes/sunny/jquery-ui-1.7.2.css",
"mw.style.ui_kdark" : "skins/jquery.ui.themes/kaltura-dark/jquery-ui-1.7.2.css",
"mw.style.ui_smoothness" : "skins/jquery.ui.themes/smoothness/jquery-ui-1.7.2.css",

"mw.style.mwCommon" : "skins/common/mw.style.mwCommon.css",

Expand Down
5 changes: 4 additions & 1 deletion modules/AdSupport/mw.AdTimeline.js
Expand Up @@ -180,9 +180,12 @@ mw.AdTimeline.prototype = {
// Restore the player if we played an ad:
_this.restorePlayer();
}
// Sync player size
embedPlayer.bindHelper('playing', function() {
embedPlayer.controlBuilder.syncPlayerSize();
});
// Trigger onplay ( even if there were no ads )
embedPlayer.triggerHelper( 'onplay' );

// Continue playback
embedPlayer.play();
},0);
Expand Down
19 changes: 15 additions & 4 deletions modules/AdSupport/mw.VastAdParser.js 100644 → 100755
Expand Up @@ -78,10 +78,21 @@ mw.VastAdParser = {
}

if( type == 'video/h264' || type == 'video/ogg' || type == 'video/webm' ){
currentAd.videoFiles.push({
'src' :_this.getURLFromNode( mediaFile ),
'type' : type
});
var source = {
'src' :_this.getURLFromNode( mediaFile ),
'type' : type
};
if( $( mediaFile ).attr('bitrate') ){
source['data-bandwith'] = $( mediaFile ).attr('bitrate')* 1024;
}
if( $( mediaFile ).attr('width') ){
source['data-width'] = $( mediaFile ).attr('width');
}
if( $( mediaFile ).attr('height') ){
source['data-height'] = $( mediaFile ).attr('height');
}
// Add the source object:
currentAd.videoFiles.push( source );
mw.log( "VastAdParser::add MediaFile:" + currentAd.videoFile );
}
});
Expand Down
15 changes: 8 additions & 7 deletions modules/DolStatistics/mw.DolStatistics.js 100755 → 100644
Expand Up @@ -65,11 +65,16 @@ mw.DolStatistics.prototype = {
});

// On change media remove any existing bindings:
embedPlayer.bindHelper( 'onChangeMediaDone' + _this.bindPostFix, function(){
embedPlayer.bindHelper( 'onChangeMedia' + _this.bindPostFix, function(){
if( ! embedPlayer['data-playerError'] ){
$embedPlayer.data('DolStatisticsCounter', $embedPlayer.data('DolStatisticsCounter') + 1 );
}
});
// Set the local autoplay flag:
embedPlayer.bindHelper( 'Playlist_PlayClip' + _this.bindPostFix, function(event, clipIndex, autoPlay){
$( embedPlayer ).data('playlistAutoPlayFlag', autoPlay);
});

// Register to our events
$.each(this.eventsList, function(k, eventName) {
switch( eventName ) {
Expand Down Expand Up @@ -298,12 +303,8 @@ mw.DolStatistics.prototype = {
getAutoPlayFlag: function(){
var embedPlayer = this.embedPlayer;
// Check if in playlist mode:
if( embedPlayer.evaluate( '{playlistAPI.kpl0Url}' ) ){
if( $( embedPlayer ).data('DolStatisticsCounter') == 1 ){
return embedPlayer.autoplay;
} else {
return !!embedPlayer.evaluate( '{playlistAPI.autoContinue}' );
}
if( typeof $( embedPlayer ).data('playlistAutoPlayFlag') != 'undefined' ){
return $( embedPlayer ).data('playlistAutoPlayFlag');
}
return embedPlayer.autoplay;
},
Expand Down
1 change: 1 addition & 0 deletions modules/DolStatistics/tests/DOLStatisticsPlaylist.html 100644 → 100755
Expand Up @@ -29,6 +29,7 @@ <h3> Test DOL statistic plugin</h3>
flashvars: {
'autoPlay' : true,
'playlistAPI.autoInsert' : 'true',
'playlistAPI.autoContinue' : 'true',
'playlistAPI.kpl0Name' : 'test 4 item playlist',
'playlistAPI.kpl0Url' : 'http%3A%2F%2Fwww.kaltura.com%2Findex.php%2Fpartnerservices2%2Fexecuteplaylist%3Fuid%3D%26partner_id%3D243342%26subp_id%3D24334200%26format%3D8%26ks%3D%7Bks%7D%26playlist_id%3D0_q79jh71b'
}
Expand Down
8 changes: 7 additions & 1 deletion modules/DoubleClick/mw.DoubleClick.js
Expand Up @@ -33,6 +33,9 @@ mw.DoubleClick.prototype = {
// Inherit BaseAdPlugin
mw.inherit( this, new mw.BaseAdPlugin( embedPlayer, callback ) );

// remove any old bindings:
embedPlayer.unbindHelper( this.bindPostfix );

// Determine if we are in managed or kaltura point based mode.
if( this.getConfig( "preSequence" ) && this.getConfig( "adTagUrl" ) ){
// managed:
Expand Down Expand Up @@ -80,6 +83,7 @@ mw.DoubleClick.prototype = {
},
addKalturaCuePointBindings: function(){
var _this = this;
mw.log("DoubleClick::addKalturaCuePointBindings");
// Add a binding for cuepoints:
_this.embedPlayer.bindHelper( 'KalturaSupport_AdOpportunity' + _this.bindPostfix, function( event, cuePointWrapper ){
var cuePoint = cuePointWrapper.cuePoint;
Expand Down Expand Up @@ -409,6 +413,7 @@ mw.DoubleClick.prototype = {
this.restorePlayer();
},
restorePlayer: function(){
mw.log("DoubleClick::restorePlayer");
this.adPlaying = false;
this.embedPlayer.sequenceProxy.isInSequence = true;

Expand All @@ -424,10 +429,11 @@ mw.DoubleClick.prototype = {
// Show the content:
this.showContent();

// Check for sequence proxy style restore:
if( this.restorePlayerCallback ){
this.restorePlayerCallback();
this.restorePlayerCallback = null;
} else {
} else { // do a manual restore:
// stop ad playback:
this.embedPlayer.adTimeline.restorePlayer();
// managed midroll ( just play content directly )
Expand Down
8 changes: 7 additions & 1 deletion modules/EmbedPlayer/mw.EmbedPlayer.js
Expand Up @@ -481,6 +481,7 @@ mw.EmbedPlayer.prototype = {
*/
switchPlaySource: function( source, switchCallback, doneCallback ){
var _this = this;

var targetPlayer = mw.EmbedTypes.getMediaPlayers().defaultPlayer( source.mimeType ) ;
if( targetPlayer.id != this.selectedPlayer.id ){
this.selectedPlayer = targetPlayer;
Expand Down Expand Up @@ -1224,6 +1225,8 @@ mw.EmbedPlayer.prototype = {
var chnagePlayingMedia = this.isPlaying();
// Reset first play to true, to count that play event
this.firstPlay = true;
// reset donePlaying count on change media.
this.donePlayingCount = 0;
this.triggeredEndDone = false;
this.preSequence = false;
this.postSequence = false;
Expand Down Expand Up @@ -1277,7 +1280,9 @@ mw.EmbedPlayer.prototype = {
if( chnagePlayingMedia ){
_this.play();
} else {
// need to confirm this pause is not needed ( mdale )
// pause is need to keep pause sate, while
// switch source calls .play() that some browsers require.
// to reflect source swiches.
_this.pause();
}
if( callback ){
Expand Down Expand Up @@ -1676,6 +1681,7 @@ mw.EmbedPlayer.prototype = {
var _this = this;
var $this = $( this );


mw.log( "EmbedPlayer:: play: " + this._propagateEvents + ' poster: ' + this.stopped );
// Store the absolute play time ( to track native events that should not invoke interface updates )
this.absoluteStartPlayTime = new Date().getTime();
Expand Down
9 changes: 4 additions & 5 deletions modules/EmbedPlayer/mw.EmbedPlayerNative.js
Expand Up @@ -704,13 +704,12 @@ mw.EmbedPlayerNative = {
if( _this.parent_play() ){
this.getPlayerElement();
if ( this.playerElement && this.playerElement.play ) {
// Dont play if in pause loading state
// If in pauseloading state make sure the loading spinner is present:
if( this.isPauseLoading ){
this.playerElement.pause();
} else {
// issue a play request
this.playerElement.play();
this.hideSpinnerOncePlaying()
}
// issue a play request
this.playerElement.play();
// re-start the monitor:
this.monitor();
}
Expand Down
2 changes: 1 addition & 1 deletion modules/EmbedPlayer/mw.IFramePlayerApiClient.js
Expand Up @@ -217,7 +217,7 @@ mw.IFramePlayerApiClient.prototype = {
// Bind orientation change to resize player ( if fullscreen )
$(window).bind( 'orientationchange', function(e){
if( localIframeInFullscreen ){
$('meta[name="viewport"]').attr('content', 'initial-scale=1; maximum-scale=1.0');
$('meta[name="viewport"]').attr('content', 'initial-scale=1');
doFullscreen();
}
});
Expand Down
13 changes: 7 additions & 6 deletions modules/EmbedPlayer/mw.MediaElement.js
Expand Up @@ -164,7 +164,6 @@ mw.MediaElement.prototype = {
// Select the default source
var playableSources = this.getPlayableSources();
var flash_flag = false, ogg_flag = false;

// Check if there are any playableSources
if( playableSources.length == 0 ){
return false;
Expand Down Expand Up @@ -207,15 +206,15 @@ mw.MediaElement.prototype = {
// Check for device flags:
var desktopVdn, mobileVdn;
$.each( vndSources, function( inx, source) {
// kaltura tags vdn sources with iphonenew
// Kaltura tags vdn sources with iphonenew
if( source.getFlavorId() && source.getFlavorId().toLowerCase() == 'iphonenew' ){
mobileVdn = source;
} else {
desktopVdn = source;
}
})
// NOTE: We really should not have two vdn sources the point of vdn is to be a set of adaptive streams.
// This work around is a result of kaltura HLS stream tagging
// NOTE: We really should not have two VDN sources the point of vdn is to be a set of adaptive streams.
// This work around is a result of Kaltura HLS stream tagging
if( mw.isIphone() && mobileVdn ){
setSelectedSource( mobileVdn );
} else if( desktopVdn ){
Expand All @@ -226,8 +225,6 @@ mw.MediaElement.prototype = {
mw.log('MediaElement::autoSelectSource: Set via Adaptive HLS: source flavor id:' + _this.selectedSource.getFlavorId() + ' src: ' + _this.selectedSource.getSrc() );
return this.selectedSource;
}



//Set via user bandwidth pref will always set source to closest bandwidth allocation while not going over EmbedPlayer.UserBandwidth
if( $.cookie('EmbedPlayer.UserBandwidth') ){
Expand Down Expand Up @@ -319,6 +316,10 @@ mw.MediaElement.prototype = {
mw.log('MediaElement::autoSelectSource: from ' + this.selectedSource.mimeType + ' because of resolution:' + this.selectedSource.width + ' close to: ' + displayWidth );
return this.selectedSource;
}
// if no size info is set just select the first source:
if( namedSourceSet[ codec ][0] ){
return setSelectedSource( namedSourceSet[ codec ][0] );
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion modules/EmbedPlayer/mw.MediaSource.js
Expand Up @@ -46,7 +46,7 @@ mw.mergeConfig( 'EmbedPlayer.SourceAttributes', [
'data-shorttitle', // short title for stream ( useful for stream switching control bar widget)
'data-width', // the width of the stream
'data-height', // the height of the stream
'data-bandwidth', // the overall bitrate of the stream
'data-bandwidth', // the overall bitrate of the stream in bytes
'data-sizebytes', // the size of the stream in bytes
'data-framerate', // the framereate of the stream
'data-flavorid', // a source flavor id ( useful for targeting devices )
Expand Down
16 changes: 12 additions & 4 deletions modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
Expand Up @@ -457,10 +457,18 @@ mw.PlayerControlBuilder.prototype = {
setTimeout( function(){ _this.syncPlayerSize() }, 200);
},
syncPlayerSize: function(){
mw.log( "PlayerControlBuilder::syncPlayerSize" );
var embedPlayer = this.embedPlayer;
if( $( embedPlayer ).width() != $(window).width() ){
embedPlayer.resizePlayer( this.getWindowSize() );
};
// resize to the playlist container
// TODO change this to an event so player with interface around it ( ppt widget etc ) can
// set the player to the right size.
if( embedPlayer.playlist && ! this.inFullScreen ){
embedPlayer.playlist.syncPlayerSize();
} else {
if( $( embedPlayer ).width() != $(window).width() ){
embedPlayer.resizePlayer( this.getWindowSize() );
};
}
},
getWindowSize: function(){
return {
Expand Down Expand Up @@ -857,7 +865,7 @@ mw.PlayerControlBuilder.prototype = {

var bindFirstPlay = false;
_this.addRightClickBinding();

// check if the player takes up the full window size:
if( $( embedPlayer ).width() == $(window).width() ){
this.isWindowSizePlayer = true;
Expand Down
7 changes: 4 additions & 3 deletions modules/KalturaSupport/KalturaResultObject.php 100644 → 100755
Expand Up @@ -356,7 +356,7 @@ function setupPlayerConfig() {
if( $key == "id" ) {
continue;
}
$plugins[ $pluginId ][ $key ] = $this->formatString((string) $value);
$plugins[ $pluginId ][ $key ] = $this->formatString( (string) $value );
}
}
}
Expand All @@ -371,7 +371,7 @@ function setupPlayerConfig() {

// uiVars
if( $this->uiConfFile ) {
$uiVarsXml = $this->getUiConfXML()->xpath("*//var");
$uiVarsXml = $this->getUiConfXML()->xpath( "*//var" );
for( $i=0; $i < count($uiVarsXml); $i++ ) {

$key = ( string ) $uiVarsXml[ $i ]->attributes()->key;
Expand All @@ -385,6 +385,7 @@ function setupPlayerConfig() {
$vars[ $key ] = $this->formatString($value);
}
}

// Set Plugin attributes from uiVars/flashVars to our plugins array
foreach( $vars as $key => $value ) {
// If this is not a plugin setting, continue
Expand All @@ -409,7 +410,7 @@ function setupPlayerConfig() {
);
}
// Removes from vars array (keep only flat vars)
unset( $vars[ $key ] );
//unset( $vars[ $key ] );
}

$this->playerConfig = array(
Expand Down
2 changes: 1 addition & 1 deletion modules/KalturaSupport/mw.KAds.js
Expand Up @@ -212,7 +212,7 @@ mw.KAds.prototype = {
waitForPlayback = function(){
waitForPlaybackCount++;
// Wait for playback for 10 seconds
if( vid.currentTime > 0 || waitForPlaybackCount > 200 ){
if( vid.currentTime > 0 || waitForPlaybackCount > 400 ){
// Seek to where we did the switch
embedPlayer.seek( seekPerc );
} else {
Expand Down
28 changes: 15 additions & 13 deletions modules/KalturaSupport/mw.KDPMapping.js
Expand Up @@ -260,7 +260,7 @@
return result;
}
// Return undefined to string: undefined, null, ''
if( result === "undefined" || result === "null" || result == "" )
if( result === "undefined" || result === "null" || result === "" )
result = undefined;

if( result === "false"){
Expand Down Expand Up @@ -300,15 +300,17 @@

// Check the exported kaltura object ( for manual overrides of any mapping )
if( embedPlayer.playerConfig
&&
embedPlayer.playerConfig[ objectPath[0] ]
&&
embedPlayer.playerConfig.plugins
&&
embedPlayer.playerConfig.plugins[ objectPath[0] ]
){
var kObj = embedPlayer.playerConfig[ objectPath[0] ] ;
var kObj = embedPlayer.playerConfig.plugins[ objectPath[0] ] ;
// TODO SHOULD USE A FUNCTION map
if( !objectPath[1] ){
return kObj;
}
if( !objectPath[2] && kObj[ objectPath[1] ] ){
if( !objectPath[2] && (objectPath[1] in kObj) ){
return kObj[ objectPath[1] ];
}
if( objectPath[2] && kObj[ objectPath[1] ] && kObj[ objectPath[1] ][ objectPath[2] ] ){
Expand Down Expand Up @@ -410,13 +412,13 @@
case 'configProxy':
switch( objectPath[1] ){
case 'flashvars':
var fv;
if( embedPlayer.playerConfig && embedPlayer.playerConfig['vars'] ){
fv = embedPlayer.playerConfig['vars'];
} else {
fv = $( embedPlayer ).data('flashvars');
}
if( objectPath[2] ) {
var fv;
if( embedPlayer.playerConfig && embedPlayer.playerConfig['vars'] ){
fv = embedPlayer.playerConfig['vars'];
} else {
fv = $( embedPlayer ).data('flashvars');
}
switch( objectPath[2] ) {
case 'autoPlay':
// get autoplay
Expand All @@ -439,7 +441,7 @@
}
} else {
// Get full flashvars object
return $( embedPlayer ).data( 'flashvars' );
return fv;
}
break;
case 'sessionId':
Expand Down Expand Up @@ -899,7 +901,7 @@
embedPlayer.emptySources();
break;
case 'changeMedia':
// Check if we don't have entryId and referenceId and they both not -1 - Empty sources
// ChecchangeMediak if we don't have entryId and referenceId and they both not -1 - Empty sources
if( ( ! notificationData.entryId || notificationData.entryId == "" || notificationData.entryId == -1 )
&& ( ! notificationData.referenceId || notificationData.referenceId == "" || notificationData.referenceId == -1 ) ) {
embedPlayer.emptySources();
Expand Down

0 comments on commit 48a812b

Please sign in to comment.