<commit_before>( function( mw, $ ) {"use strict";

	mw.PluginManager.add( 'playlistAPI', mw.KBaseMediaList.extend({

		defaultConfig: {
			'templatePath': 'components/playlist/playList.tmpl.html',
			'initItemEntryId': null,
			'autoContinue': false,
			'autoPlay': false,
			'kpl0Name': null,
			'kpl0Url': null,
			'kpl0Id': null,
			'titleLimit': 36,
			'descriptionLimit': 32,
			'thumbnailWidth' : 86,
			'mediaItemWidth': 320,
			'mediaItemHeight': 70,
			'includeThumbnail': true,
			'includeItemNumberPattern': false,
			'includeMediaItemDuration': true,
			'hideClipPoster': true,
			'loop': false,
			'overflow': false,
			'cssFileName': 'modules/KalturaSupport/components/playlist/playList.css',
			'showControls': true,
			'MaxClips': 25,
			'selectedIndex': 0
		},


		loadingEntry: null,      // flag to store the current loading entry
		firstLoad: true,         // Flag for setting initial entry in first load
		kClient: null,           // kClient for API calls
		firstPlay: true,         // firstPlay is used to check if we need to check for autoMute or keep the player volume from previous clip

		currentClipIndex: null,  // currently playing clip index
		currentPlaylistIndex: 0, // current playlist index (when we have more than 1 play lists)
		playlistSet : [],        // array holding all the play lists returned from the server

		videoWidth: null,        // used to save the video width when exiting to full screen and returning

		setup: function( embedPlayer ) {
			if ( this.getConfig( 'includeInLayout' ) === false){ // support hidden playlists - force onPage and hide its div.
				this.setConfig( 'onPage', true );
			}
			//Backward compatibility setting - set autoplay on embedPlayer instead of playlist
			this.getPlayer().autoplay = (this.getConfig( 'autoPlay' ) == true);

			this.setConfig( 'horizontalHeaderHeight', 43 );
			this.addBindings();
			this.loadPlaylists();
		},
		addBindings: function() {
			var _this = this;

			$( this.embedPlayer ).unbind( this.bindPostFix );
			this.bind( 'playerReady', function ( e, newState ) {
				if (_this.playlistSet.length > 0){
					_this.selectPlaylist(_this.currentPlaylistIndex);
					//Revert block player display after selecting playlist entry
					_this.getPlayer()['data-blockPlayerDisplay'] = false;
				}
				_this.unbind( 'playerReady'); // we want to select the playlist only the first time the player loads
			});

			this.bind( 'mediaError', function ( e ) {
				_this.loadingEntry = null; // reset loadingEntry if we got a media error (also media loading error will trigger this event)
				_this.onEnable();
			});

			// API support + backward compatibility
			$( this.embedPlayer ).bind( 'Kaltura_SetKDPAttribute' + this.bindPostFix, function( event, componentName, property, value ){
				mw.log("PlaylistAPI::Kaltura_SetKDPAttribute:" + property + ' value:' + value);
				switch( componentName ){
					case "playlistAPI.dataProvider":
					case "playlistAPI":
						if ( property == "selectedIndex"){
							_this.playMedia(value, true);
						}
						break;
					case 'tabBar':
					case 'playList':
						if (property == "selectedIndex" && value < _this.playlistSet.length){
							_this.switchPlaylist(value);
						}
						break;
				}
			});

			$( this.embedPlayer ).bind( 'Kaltura_SendNotification'+ this.bindPostFix , function( event, notificationName, notificationData){
				switch( notificationName ){
					case 'playlistPlayNext':
						_this.playNext();
						break;
					case 'playlistPlayPrevious':
						_this.playPrevious();
						break;
				}
			});

			$( this.embedPlayer ).bind( 'playNextClip', function( event){
				_this.playNext();
			});

			$( this.embedPlayer ).bind( 'playPreviousClip', function( event){
				_this.playPrevious();
			});

			// set responsiveness
			this.bind('updateLayout', function(){
				if ($(".mwPlayerContainer").width() / 3 > _this.getConfig('mediaItemWidth')){
					_this.setConfig('mediaItemWidth',$(".mwPlayerContainer").width()/3);
					_this.setConfig('titleLimit', parseInt(_this.getConfig('mediaItemWidth') / 7));
					_this.setConfig('descriptionLimit', parseInt(_this.getConfig('mediaItemWidth') / 8));
				}
			});

			$( this.embedPlayer ).bind( 'mediaListLayoutReady', function( event){<commit_msg>#FEC-2321 #time 2h #comment make playlist and video resize on layout change<commit_after>( function( mw, $ ) {"use strict";

	mw.PluginManager.add( 'playlistAPI', mw.KBaseMediaList.extend({

		defaultConfig: {
			'templatePath': 'components/playlist/playList.tmpl.html',
			'initItemEntryId': null,
			'autoContinue': false,
			'autoPlay': false,
			'kpl0Name': null,
			'kpl0Url': null,
			'kpl0Id': null,
			'titleLimit': 36,
			'descriptionLimit': 32,
			'thumbnailWidth' : 86,
			'mediaItemWidth': 320,
			'mediaItemHeight': 70,
			'includeThumbnail': true,
			'includeItemNumberPattern': false,
			'includeMediaItemDuration': true,
			'hideClipPoster': true,
			'loop': false,
			'overflow': false,
			'cssFileName': 'modules/KalturaSupport/components/playlist/playList.css',
			'showControls': true,
			'MaxClips': 25,
			'selectedIndex': 0
		},


		loadingEntry: null,      // flag to store the current loading entry
		firstLoad: true,         // Flag for setting initial entry in first load
		kClient: null,           // kClient for API calls
		firstPlay: true,         // firstPlay is used to check if we need to check for autoMute or keep the player volume from previous clip

		currentClipIndex: null,  // currently playing clip index
		currentPlaylistIndex: 0, // current playlist index (when we have more than 1 play lists)
		playlistSet : [],        // array holding all the play lists returned from the server

		videoWidth: null,        // used to save the video width when exiting to full screen and returning

		setup: function( embedPlayer ) {
			if ( this.getConfig( 'includeInLayout' ) === false){ // support hidden playlists - force onPage and hide its div.
				this.setConfig( 'onPage', true );
			}
			//Backward compatibility setting - set autoplay on embedPlayer instead of playlist
			this.getPlayer().autoplay = (this.getConfig( 'autoPlay' ) == true);

			this.setConfig( 'horizontalHeaderHeight', 43 );
			this.addBindings();
			this.loadPlaylists();
		},
		addBindings: function() {
			var _this = this;

			$( this.embedPlayer ).unbind( this.bindPostFix );
			this.bind( 'playerReady', function ( e, newState ) {
				if (_this.playlistSet.length > 0){
					_this.selectPlaylist(_this.currentPlaylistIndex);
					//Revert block player display after selecting playlist entry
					_this.getPlayer()['data-blockPlayerDisplay'] = false;
				}
				_this.unbind( 'playerReady'); // we want to select the playlist only the first time the player loads
			});

			this.bind( 'mediaError', function ( e ) {
				_this.loadingEntry = null; // reset loadingEntry if we got a media error (also media loading error will trigger this event)
				_this.onEnable();
			});

			// API support + backward compatibility
			$( this.embedPlayer ).bind( 'Kaltura_SetKDPAttribute' + this.bindPostFix, function( event, componentName, property, value ){
				mw.log("PlaylistAPI::Kaltura_SetKDPAttribute:" + property + ' value:' + value);
				switch( componentName ){
					case "playlistAPI.dataProvider":
					case "playlistAPI":
						if ( property == "selectedIndex"){
							_this.playMedia(value, true);
						}
						break;
					case 'tabBar':
					case 'playList':
						if (property == "selectedIndex" && value < _this.playlistSet.length){
							_this.switchPlaylist(value);
						}
						break;
				}
			});

			$( this.embedPlayer ).bind( 'Kaltura_SendNotification'+ this.bindPostFix , function( event, notificationName, notificationData){
				switch( notificationName ){
					case 'playlistPlayNext':
						_this.playNext();
						break;
					case 'playlistPlayPrevious':
						_this.playPrevious();
						break;
				}
			});

			$( this.embedPlayer ).bind( 'playNextClip', function( event){
				_this.playNext();
			});

			$( this.embedPlayer ).bind( 'playPreviousClip', function( event){
				_this.playPrevious();
			});

			// set responsiveness
			this.bind('updateLayout', function(){
				if ($(".playlistInterface").width() / 3 > _this.getConfig('mediaItemWidth')) {
					_this.setConfig('mediaItemWidth', $(".playlistInterface").width() / 3);

				} else {
					_this.setConfig('mediaItemWidth', '320');
				}
				_this.setConfig('titleLimit', parseInt(_this.getConfig('mediaItemWidth') / 7));
				_this.setConfig('descriptionLimit', parseInt(_this.getConfig('mediaItemWidth') / 8));

				// redraw player and playlist
				_this.$mediaListContainer = null;
				_this.getMedialistContainer();
				_this.renderMediaList();
			});

			$( this.embedPlayer ).bind( 'mediaListLayoutReady', function( event){
{'fraction_non_alphanumeric': 0.13106353905716236, 'fraction_numerical': 0.006832156684126622, 'mean_word_length': 3.4606399187404775, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4619668', 'n_tokens_mistral': 3221, 'n_tokens_neox': 2592, 'n_words': 699}