mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
28bb4ffd62
commit
6fb6168107
12 changed files with 113 additions and 241 deletions
57
dashboard-ui/bower_components/emby-webcomponents/playback/playbackvalidation.js
vendored
Normal file
57
dashboard-ui/bower_components/emby-webcomponents/playback/playbackvalidation.js
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
define(['playbackManager'], function (playbackManager) {
|
||||
"use strict";
|
||||
|
||||
return function () {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.name = 'Playback validation';
|
||||
self.type = 'preplayintercept';
|
||||
self.id = 'playbackvalidation';
|
||||
self.order = -1;
|
||||
|
||||
self.intercept = function (options) {
|
||||
|
||||
// Don't care about video backdrops or any kind of non-fullscreen playback
|
||||
if (!options.fullscreen && options.mediaType === 'Video') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return validatePlayback(options);
|
||||
};
|
||||
|
||||
function validatePlayback(options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(["registrationServices"], function (registrationServices) {
|
||||
registrationServices.validateFeature('playback', options).then(resolve, function () {
|
||||
startAutoStopTimer();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var autoStopTimeout;
|
||||
var lockedTimeLimitMs = 63000;
|
||||
|
||||
function startAutoStopTimer() {
|
||||
stopAutoStopTimer();
|
||||
autoStopTimeout = setTimeout(onAutoStopTimeout, lockedTimeLimitMs);
|
||||
}
|
||||
|
||||
function onAutoStopTimeout() {
|
||||
stopAutoStopTimer();
|
||||
playbackManager.stop();
|
||||
}
|
||||
|
||||
function stopAutoStopTimer() {
|
||||
|
||||
var timeout = autoStopTimeout;
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
autoStopTimeout = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue