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

// Class defined in resources/class/class.js
	mw.PlayerElementFlash = mw.PlayerElement.extend({
		jsReadyFunName: 'elementJsReadyFunc',
		playerElement: null,
		currentTime: 0,
		duration: 0,
		paused: true,
		muted: false,
		volume: 1,
		id: null,
		readyState: 0,
		disabled: false,
		//counter for listneres function names, in case we want to subscribe more than one func to the same kdp notification
		listenerCounter: 0,
		targetObj: null,

		/**
		 * initialize the class, creates flash embed
		 * @param containerId container for the flash embed
		 * @param playerId id of the object to create
		 * @param elementFlashvars additional flashvars to pass to the flash object
		 * @param target target class to run subscribed functions on
		 * @param readyCallback to run when player is ready
		 * @returns {*}
		 */
		init: function( containerId , playerId , elementFlashvars, target, readyCallback ){
			var _this = this;
			this.element = this;			
			this.id = playerId;
			this.targetObj = target;

			var flashvars = {};
			flashvars.jsCallBackReadyFunc = this.jsReadyFunName;
			flashvars.externalInterfaceDisabled = "false";
			flashvars.disableOnScreenClick = true;

			//if debug mode
			if( mw.getConfig( 'debug', true ) ){
				flashvars.debugMode = 'true';
			}

			if ( elementFlashvars ) {
				$.extend ( flashvars, elementFlashvars );
			}

			var mwEmbedPath = mw.getMwEmbedPath();
			//replace protocol with page protocol
			if ( window.location.protocol ) {
				mwEmbedPath = window.location.protocol + mwEmbedPath.substring( mwEmbedPath.indexOf(":") + 1);
			}

			var kdpPath = mwEmbedPath + 'modules/EmbedPlayer/binPlayers/kaltura-player/kdp3.swf';
			// var kdpPath = "http://localhost/chromeless-kdp/KDP3/bin-debug/kdp3.swf";

			window[this.jsReadyFunName] = function( playerId ){
				// We wrap everything in setTimeout to avoid Firefox race condition with empty cache
				setTimeout(function(){
					_this.playerElement = $('#' + playerId )[0];

					//if this is the target object: add event listeners
					//if a different object is the target: it should take care of its listeners (such as embedPlayerKPlayer)
					if ( !_this.targetObj ) {
						_this.targetObj = _this;

						var bindEventMap = {
							'playerPaused' : 'onPause',
							'playerPlayed' : 'onPlay',
							'durationChange' : 'onDurationChange',
							'playbackComplete' : 'onClipDone',
							'playerUpdatePlayhead' : 'onUpdatePlayhead',
							'playerSeekEnd': 'onPlayerSeekEnd',
							'alert': 'onAlert',
							'mute': 'onMute',
							'unmute': 'onUnMute',
							'volumeChanged': 'onVolumeChanged'
						};

						$.each( bindEventMap, function( bindName, localMethod ) {
							_this.bindPlayerFunction(bindName, localMethod);
						});
					}

					//imitate html5 video readyState
					_this.readyState = 4;
					// Run ready callback
					if( $.isFunction( readyCallback ) ){
						readyCallback.apply( _this );
					}

					//notify player is ready
					$( _this ).trigger('playerJsReady');
				},0);
			};

			// attributes and params:
			flashembed( containerId,
				{
					id :				playerId,
					src : 				kdpPath,
					bgcolor :			"#000000",
					allowNetworking : 	"all",
					version :			[10,0],
					wmode : 			"transparent"
				},
				flashvars
			);

			return this;
		},
		play: function(){
			this.sendNotification( 'doPlay' );
		},
		pause: function(){
			this.sendNotification( 'doPause' );
		},
		seek: function( val ){<commit_msg>FEC-1569 #comment prevent continuous firing of player jsReady callback function #time 4h<commit_after>( function( mw, $ ) {"use strict";

// Class defined in resources/class/class.js
	mw.PlayerElementFlash = mw.PlayerElement.extend({
		jsReadyFunName: 'elementJsReadyFunc',
		playerElement: null,
		currentTime: 0,
		duration: 0,
		paused: true,
		muted: false,
		volume: 1,
		id: null,
		readyState: 0,
		disabled: false,
		//counter for listneres function names, in case we want to subscribe more than one func to the same kdp notification
		listenerCounter: 0,
		targetObj: null,
		initialized: false,

		/**
		 * initialize the class, creates flash embed
		 * @param containerId container for the flash embed
		 * @param playerId id of the object to create
		 * @param elementFlashvars additional flashvars to pass to the flash object
		 * @param target target class to run subscribed functions on
		 * @param readyCallback to run when player is ready
		 * @returns {*}
		 */
		init: function( containerId , playerId , elementFlashvars, target, readyCallback ){
			var _this = this;
			this.element = this;			
			this.id = playerId;
			this.targetObj = target;

			var flashvars = {};
			flashvars.jsCallBackReadyFunc = this.jsReadyFunName;
			flashvars.externalInterfaceDisabled = "false";
			flashvars.disableOnScreenClick = true;

			//if debug mode
			if( mw.getConfig( 'debug', true ) ){
				flashvars.debugMode = 'true';
			}

			if ( elementFlashvars ) {
				$.extend ( flashvars, elementFlashvars );
			}

			var mwEmbedPath = mw.getMwEmbedPath();
			//replace protocol with page protocol
			if ( window.location.protocol ) {
				mwEmbedPath = window.location.protocol + mwEmbedPath.substring( mwEmbedPath.indexOf(":") + 1);
			}

			var kdpPath = mwEmbedPath + 'modules/EmbedPlayer/binPlayers/kaltura-player/kdp3.swf';
			// var kdpPath = "http://localhost/chromeless-kdp/KDP3/bin-debug/kdp3.swf";

			window[this.jsReadyFunName] = function( playerId ){
				if (!_this.initialized) {
					_this.initialized = true;
					// We wrap everything in setTimeout to avoid Firefox race condition with empty cache
					setTimeout( function () {
						_this.playerElement = $( '#' + playerId )[0];

						//if this is the target object: add event listeners
						//if a different object is the target: it should take care of its listeners (such as embedPlayerKPlayer)
						if ( !_this.targetObj ) {
							_this.targetObj = _this;

							var bindEventMap = {
								'playerPaused': 'onPause',
								'playerPlayed': 'onPlay',
								'durationChange': 'onDurationChange',
								'playbackComplete': 'onClipDone',
								'playerUpdatePlayhead': 'onUpdatePlayhead',
								'playerSeekEnd': 'onPlayerSeekEnd',
								'alert': 'onAlert',
								'mute': 'onMute',
								'unmute': 'onUnMute',
								'volumeChanged': 'onVolumeChanged'
							};

							$.each( bindEventMap, function ( bindName, localMethod ) {
								_this.bindPlayerFunction( bindName, localMethod );
							} );
						}

						//imitate html5 video readyState
						_this.readyState = 4;
						// Run ready callback
						if ( $.isFunction( readyCallback ) ) {
							readyCallback.apply( _this );
						}

						//notify player is ready
						$( _this ).trigger( 'playerJsReady' );
					}, 0 );
				}
			};

			// attributes and params:
			flashembed( containerId,
				{
					id :				playerId,
					src : 				kdpPath,
					bgcolor :			"#000000",
					allowNetworking : 	"all",
					version :			[10,0],
					wmode : 			"transparent"
				},
				flashvars
			);

			return this;
		},
		play: function(){
			this.sendNotification( 'doPlay' );
		},
		pause: function(){
			this.sendNotification( 'doPause' );
		},
		seek: function( val ){
{'fraction_non_alphanumeric': 0.1154644884397065, 'fraction_numerical': 0.006783884812404818, 'mean_word_length': 2.909090909090909, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '1089184', 'n_tokens_mistral': 2928, 'n_tokens_neox': 2206, 'n_words': 610}