define(["connectionManager","globalize"],function(connectionManager,globalize){"use strict";return function(){function validatePlayback(options){var item=options.item;if(!item)return Promise.resolve();var serverId=item.ServerId;return serverId?connectionManager.getApiClient(serverId).getCurrentUser().then(function(user){return user.Policy.EnableMediaPlayback?Promise.resolve():options.fullscreen?showErrorMessage():Promise.reject()}):Promise.resolve()}function getRequirePromise(deps){return new Promise(function(resolve,reject){require(deps,resolve)})}function showErrorMessage(){return getRequirePromise(["alert"]).then(function(alert){return alert(globalize.translate("sharedcomponents#MessagePlayAccessRestricted")).then(function(){return Promise.reject()})})}var self=this;self.name="Playback validation",self.type="preplayintercept",self.id="playaccessvalidation",self.order=-2,self.intercept=function(options){return validatePlayback(options)}}});