<commit_before>(function (mw, $) {
	"use strict";
	var multiDrm = mw.KBasePlugin.extend({

		setup: function () {
			//If both FPS certificate is available and FPS is supported then
			//use hls on native html5 video tag and FPS plugin will handle DRM flow
			var player = this.getPlayer();
			var cert = this.getFpsCertificate(player);
			if (cert && mw.isDesktopSafari()) {
				mw.log("Loading HLS FPS player");
				$(mw).bind('EmbedPlayerUpdateMediaPlayers', function (event, mediaPlayers) {
					mediaPlayers.removeMIMETypePlayers('video/playreadySmooth', 'Silverlight');
					mediaPlayers.removeMIMETypePlayers('video/ism', 'Silverlight');
				});
				this.loadHlsFpsHandler().then(function () {
					mw.fps = new mw.FPS(player, function () {
					}, "FPS");
				});
			} else if (this.isCastLabsNeeded()) {
				this.registerCastLabsPlayer();
			}
		},

		isCastLabsNeeded: function () {
			return (mw.isChrome() && !mw.isMobileDevice()) || //for smoothStream over dash
				this.isOldIE() || mw.isDesktopSafari();  //for dash over silverLight
		},

		isOldIE: function () {
			return mw.isIE8() || mw.isIE9() || mw.isIE10Comp();
		},

		getFpsCertificate: function (embedPlayer) {
			var cert = null;
			if (window.kWidgetSupport) {
				cert = window.kWidgetSupport.getFairplayCert({contextData: embedPlayer.kalturaContextData});
			}
			return cert;
		},

		loadHlsFpsHandler: function () {
			var deferred = $.Deferred();
			mw.load(['mw.FPS'], function () {
				deferred.resolve();
			});
			return deferred;
		},

		registerCastLabsPlayer: function () {
			var _this = this;
			$(mw).bind('EmbedPlayerUpdateMediaPlayers', function (event, mediaPlayers) {
				mw.log("Register CastLabs player and extensions");

				_this.setEmbedPlayerConfig(_this.getPlayer());

				var multiDRMProtocols = ["video/ism", "video/playreadySmooth"];
				if (_this.isOldIE() || mw.isDesktopSafari()) {
					multiDRMProtocols.push("application/dash+xml");
				}

				var multiDRMPlayer = new mw.MediaPlayer('multidrm', multiDRMProtocols, 'MultiDRM');
				mediaPlayers.addPlayer(multiDRMPlayer);
<commit_msg>FEC-5969 #comment Use CastLabs for old IEs only if forceDASH is true,… (#2969)<commit_after>(function (mw, $) {
	"use strict";
	var multiDrm = mw.KBasePlugin.extend({

		setup: function () {
			//If both FPS certificate is available and FPS is supported then
			//use hls on native html5 video tag and FPS plugin will handle DRM flow
			var player = this.getPlayer();
			var cert = this.getFpsCertificate(player);
			if (cert && mw.isDesktopSafari()) {
				mw.log("Loading HLS FPS player");
				$(mw).bind('EmbedPlayerUpdateMediaPlayers', function (event, mediaPlayers) {
					mediaPlayers.removeMIMETypePlayers('video/playreadySmooth', 'Silverlight');
					mediaPlayers.removeMIMETypePlayers('video/ism', 'Silverlight');
				});
				this.loadHlsFpsHandler().then(function () {
					mw.fps = new mw.FPS(player, function () {
					}, "FPS");
				});
			} else if (this.isCastLabsNeeded()) {
				this.registerCastLabsPlayer();
			}
		},

		isCastLabsNeeded: function () {
			return (mw.isChrome() && !mw.isMobileDevice()) || //for smoothStream over dash
				((this.isOldIE() || mw.isDesktopSafari()) && this.getConfig("forceDASH"));  //for dash over silverLight
		},

		isOldIE: function () {
			return mw.isIE8() || mw.isIE9() || mw.isIE10Comp();
		},

		getFpsCertificate: function (embedPlayer) {
			var cert = null;
			if (window.kWidgetSupport) {
				cert = window.kWidgetSupport.getFairplayCert({contextData: embedPlayer.kalturaContextData});
			}
			return cert;
		},

		loadHlsFpsHandler: function () {
			var deferred = $.Deferred();
			mw.load(['mw.FPS'], function () {
				deferred.resolve();
			});
			return deferred;
		},

		registerCastLabsPlayer: function () {
			var _this = this;
			$(mw).bind('EmbedPlayerUpdateMediaPlayers', function (event, mediaPlayers) {
				mw.log("Register CastLabs player and extensions");

				_this.setEmbedPlayerConfig(_this.getPlayer());

				var multiDRMProtocols = ["video/ism", "video/playreadySmooth"];
				if ((_this.isOldIE() || mw.isDesktopSafari()) &&
					_this.getConfig("forceDASH")) {
					multiDRMProtocols.push("application/dash+xml");
				}

				var multiDRMPlayer = new mw.MediaPlayer('multidrm', multiDRMProtocols, 'MultiDRM');
				mediaPlayers.addPlayer(multiDRMPlayer);

{'fraction_non_alphanumeric': 0.14807114807114807, 'fraction_numerical': 0.004158004158004158, 'mean_word_length': 3.937286202964652, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '661250', 'n_tokens_mistral': 1734, 'n_tokens_neox': 1407, 'n_words': 292}