(function (mw, $) {
	"use strict";

	var tvpapiGetLicensedLinks = mw.tvpapiRequest.extend( {

		defaultConfig: {
			"restMethod": "GetLicensedLinks",
			"restApiBaseUrl": null
		},

		isDisabled: false,
		lastSelectedSource: "",

		setup: function ( embedPlayer ) {
			this.addBindings();
		},

		addBindings: function () {
			var _this = this;
			this.bind("SourceSelected", function(event, source){
				//Prevent dispatching request if source haven't change or it's not valid source (assetid is not valid)
				if ((source.assetid != 0) && (_this.lastSelectedSource != source.assetid)) {
					_this.lastSelectedSource = source.assetid;
					_this.getMediaLicenseLink( event, source );
				}
			});
		},

		getMediaLicenseLink: function(event, source){
			var url = this.getRequestUrl();
			if (url) {
				var data = {
					"mediaFileID": source.assetid,
					"baseLink": source.src,
					"initObj": this.getInitObj()
				};

				var getResponseLink = function (res) {
					return res.mainUrl ||
							( res.licensed_link && res.licensed_link.main_url );
				};

				var _this = this;

				this.doRequest(url, data).then(
					function (res) {
						var mediaLink = getResponseLink(res);
						if (mediaLink) {
							_this.getPlayer().triggerHelper('tvpapiSubscription', [res]);
							source.src = mediaLink;
						} else {
							_this.getPlayer().triggerHelper('tvpapiNoSubscription', [res]);
						}
					},
					function (xmlHttpRequest, status) {
						//TODO:Handle error - dispatch event
					},
					null
				);
			}

			return false;
		}
	});
	mw.PluginManager.add( 'tvpapiGetLicensedLinks', tvpapiGetLicensedLinks);
})(window.mw, window.jQuery);

@@ -791,24 +791,220 @@
 %09if (url) %7B%0A
+%09%09%09%09var sessionData = source.src.match(/(%5B&%7C%5C?%5D?playSessionId=%5B0-9a-zA-Z%7C%5C-%5D+)/ig);%0A%09%09%09%09if (sessionData && sessionData.length) %7B%0A%09%09%09%09%09source.src = source.src.replace( sessionData%5B0%5D , '' );%0A%09%09%09%09%7D%0A
 %09%09%09%09var data
@@ -1008,16 +1008,16 @@
 ata = %7B%0A
-
 %09%09%09%09%09%22me
@@ -1275,17 +1275,16 @@
 = this;%0A
-%0A
 %09%09%09%09this
@@ -1396,24 +1396,24 @@
 ediaLink) %7B%0A
-
 %09%09%09%09%09%09%09_this
@@ -1465,24 +1465,241 @@
 n', %5Bres%5D);%0A
+%09%09%09%09%09%09%09if (sessionData && sessionData.length)%7B%0A%09%09%09%09%09%09%09%09var qp = ( mediaLink.indexOf('?') === -1) ? '?' : '&';%0A%09%09%09%09%09%09%09%09var sessionString = sessionData%5B0%5D.substring(1);%0A%09%09%09%09%09%09%09%09mediaLink += qp + sessionString;%0A%09%09%09%09%09%09%09%7D%0A
 %09%09%09%09%09%09%09sourc

remove and add the playsessionId for licenseLink (#2732)