mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 19:38:20 -07:00
1 line
1.0 KiB
JavaScript
1 line
1.0 KiB
JavaScript
define(["playbackManager","itemHelper"],function(playbackManager,itemHelper){"use strict";return function(){function validatePlayback(options){return new Promise(function(resolve,reject){require(["registrationServices"],function(registrationServices){registrationServices.validateFeature("playback",options).then(function(result){result&&result.enableTimeLimit&&startAutoStopTimer(),resolve()})})})}function startAutoStopTimer(){stopAutoStopTimer(),autoStopTimeout=setTimeout(onAutoStopTimeout,lockedTimeLimitMs)}function onAutoStopTimeout(){stopAutoStopTimer(),playbackManager.stop()}function stopAutoStopTimer(){var timeout=autoStopTimeout;timeout&&(clearTimeout(timeout),autoStopTimeout=null)}var self=this;self.name="Playback validation",self.type="preplayintercept",self.id="playbackvalidation",self.order=-1,self.intercept=function(options){return options.fullscreen?options.item&&itemHelper.isLocalItem(options.item)?Promise.resolve():validatePlayback(options):Promise.resolve()};var autoStopTimeout,lockedTimeLimitMs=63e3}}); |