mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge branch 'master' into return-of-the-scrollbar
This commit is contained in:
commit
c2b1d02a33
321 changed files with 7572 additions and 6563 deletions
|
@ -1,4 +1,5 @@
|
|||
/* eslint-disable indent */
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
|
||||
class BackdropScreensaver {
|
||||
constructor() {
|
||||
|
@ -20,10 +21,10 @@ class BackdropScreensaver {
|
|||
Limit: 200
|
||||
};
|
||||
|
||||
const apiClient = window.connectionManager.currentApiClient();
|
||||
const apiClient = ServerConnections.currentApiClient();
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), query).then((result) => {
|
||||
if (result.Items.length) {
|
||||
import('slideshow').then(({default: Slideshow}) => {
|
||||
import('../../components/slideshow/slideshow').then(({default: Slideshow}) => {
|
||||
const newSlideShow = new Slideshow({
|
||||
showTitle: true,
|
||||
cover: true,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import browser from 'browser';
|
||||
import loading from 'loading';
|
||||
import keyboardnavigation from 'keyboardnavigation';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import dom from 'dom';
|
||||
import events from 'events';
|
||||
import 'css!./style';
|
||||
import 'material-icons';
|
||||
import 'paper-icon-button-light';
|
||||
|
||||
import loading from '../../components/loading/loading';
|
||||
import keyboardnavigation from '../../scripts/keyboardNavigation';
|
||||
import dialogHelper from '../../components/dialogHelper/dialogHelper';
|
||||
import '../../scripts/dom';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import './style.css';
|
||||
import 'material-design-icons-iconfont';
|
||||
import '../../elements/emby-button/paper-icon-button-light';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
import TableOfContents from './tableOfContents';
|
||||
import browser from '../../scripts/browser';
|
||||
|
||||
export class BookPlayer {
|
||||
constructor() {
|
||||
|
@ -260,7 +260,7 @@ export class BookPlayer {
|
|||
};
|
||||
|
||||
const serverId = item.ServerId;
|
||||
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
import('epubjs').then(({default: epubjs}) => {
|
||||
|
@ -290,7 +290,7 @@ export class BookPlayer {
|
|||
epubElem.style.display = 'block';
|
||||
rendition.on('relocated', (locations) => {
|
||||
this.progress = book.locations.percentageFromCfi(locations.start.cfi);
|
||||
events.trigger(this, 'timeupdate');
|
||||
Events.trigger(this, 'timeupdate');
|
||||
});
|
||||
|
||||
loading.hide();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import dialogHelper from 'dialogHelper';
|
||||
import dialogHelper from '../../components/dialogHelper/dialogHelper';
|
||||
|
||||
export default class TableOfContents {
|
||||
constructor(bookPlayer) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import events from 'events';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
|
||||
// LinkParser
|
||||
//
|
||||
|
@ -221,8 +222,8 @@ function getCachedValue(key) {
|
|||
return null;
|
||||
}
|
||||
|
||||
events.on(window.connectionManager, 'localusersignedin', clearCache);
|
||||
events.on(window.connectionManager, 'localusersignedout', clearCache);
|
||||
Events.on(ServerConnections, 'localusersignedin', clearCache);
|
||||
Events.on(ServerConnections, 'localusersignedout', clearCache);
|
||||
|
||||
export default {
|
||||
getServerAddress: getServerAddress
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import appSettings from 'appSettings';
|
||||
import * as userSettings from 'userSettings';
|
||||
import playbackManager from 'playbackManager';
|
||||
import globalize from 'globalize';
|
||||
import events from 'events';
|
||||
import castSenderApiLoader from 'castSenderApiLoader';
|
||||
import appSettings from '../../scripts/settings/appSettings';
|
||||
import * as userSettings from '../../scripts/settings/userSettings';
|
||||
import { playbackManager } from '../../components/playback/playbackmanager';
|
||||
import globalize from '../../scripts/globalize';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import castSenderApiLoader from '../../components/castSenderApi';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
import alert from '../../components/alert';
|
||||
|
||||
// Based on https://github.com/googlecast/CastVideos-chrome/blob/master/CastVideos.js
|
||||
|
||||
|
@ -167,7 +169,7 @@ class CastPlayer {
|
|||
alertText(globalize.translate('MessageChromecastConnectionError'), globalize.translate('HeaderError'));
|
||||
}, 300);
|
||||
} else if (message.type) {
|
||||
events.trigger(this, message.type, [message.data]);
|
||||
Events.trigger(this, message.type, [message.data]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +238,7 @@ class CastPlayer {
|
|||
document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
|
||||
document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
|
||||
|
||||
events.trigger(this, 'connect');
|
||||
Events.trigger(this, 'connect');
|
||||
this.sendMessage({
|
||||
options: {},
|
||||
command: 'Identify'
|
||||
|
@ -324,11 +326,11 @@ class CastPlayer {
|
|||
|
||||
let apiClient;
|
||||
if (message.options && message.options.ServerId) {
|
||||
apiClient = window.connectionManager.getApiClient(message.options.ServerId);
|
||||
apiClient = ServerConnections.getApiClient(message.options.ServerId);
|
||||
} else if (message.options && message.options.items && message.options.items.length) {
|
||||
apiClient = window.connectionManager.getApiClient(message.options.items[0].ServerId);
|
||||
apiClient = ServerConnections.getApiClient(message.options.items[0].ServerId);
|
||||
} else {
|
||||
apiClient = window.connectionManager.currentApiClient();
|
||||
apiClient = ServerConnections.currentApiClient();
|
||||
}
|
||||
|
||||
message = Object.assign(message, {
|
||||
|
@ -439,11 +441,9 @@ class CastPlayer {
|
|||
}
|
||||
|
||||
function alertText(text, title) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert({
|
||||
text: text,
|
||||
title: title
|
||||
});
|
||||
alert({
|
||||
text,
|
||||
title
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -495,11 +495,11 @@ function getItemsForPlayback(apiClient, query) {
|
|||
}
|
||||
|
||||
function bindEventForRelay(instance, eventName) {
|
||||
events.on(instance._castPlayer, eventName, function (e, data) {
|
||||
Events.on(instance._castPlayer, eventName, function (e, data) {
|
||||
console.debug('cc: ' + eventName);
|
||||
const state = instance.getPlayerStateInternal(data);
|
||||
|
||||
events.trigger(instance, eventName, [state]);
|
||||
Events.trigger(instance, eventName, [state]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ function initializeChromecast() {
|
|||
}
|
||||
}));
|
||||
|
||||
events.on(instance._castPlayer, 'connect', function (e) {
|
||||
Events.on(instance._castPlayer, 'connect', function (e) {
|
||||
if (currentResolve) {
|
||||
sendConnectionResult(true);
|
||||
} else {
|
||||
|
@ -526,20 +526,20 @@ function initializeChromecast() {
|
|||
instance.lastPlayerData = null;
|
||||
});
|
||||
|
||||
events.on(instance._castPlayer, 'playbackstart', function (e, data) {
|
||||
Events.on(instance._castPlayer, 'playbackstart', function (e, data) {
|
||||
console.debug('cc: playbackstart');
|
||||
|
||||
instance._castPlayer.initializeCastPlayer();
|
||||
|
||||
const state = instance.getPlayerStateInternal(data);
|
||||
events.trigger(instance, 'playbackstart', [state]);
|
||||
Events.trigger(instance, 'playbackstart', [state]);
|
||||
});
|
||||
|
||||
events.on(instance._castPlayer, 'playbackstop', function (e, data) {
|
||||
Events.on(instance._castPlayer, 'playbackstop', function (e, data) {
|
||||
console.debug('cc: playbackstop');
|
||||
let state = instance.getPlayerStateInternal(data);
|
||||
|
||||
events.trigger(instance, 'playbackstop', [state]);
|
||||
Events.trigger(instance, 'playbackstop', [state]);
|
||||
|
||||
state = instance.lastPlayerData.PlayState || {};
|
||||
const volume = state.VolumeLevel || 0.5;
|
||||
|
@ -552,11 +552,11 @@ function initializeChromecast() {
|
|||
instance.lastPlayerData.PlayState.IsMuted = mute;
|
||||
});
|
||||
|
||||
events.on(instance._castPlayer, 'playbackprogress', function (e, data) {
|
||||
Events.on(instance._castPlayer, 'playbackprogress', function (e, data) {
|
||||
console.debug('cc: positionchange');
|
||||
const state = instance.getPlayerStateInternal(data);
|
||||
|
||||
events.trigger(instance, 'timeupdate', [state]);
|
||||
Events.trigger(instance, 'timeupdate', [state]);
|
||||
});
|
||||
|
||||
bindEventForRelay(instance, 'timeupdate');
|
||||
|
@ -566,11 +566,11 @@ function initializeChromecast() {
|
|||
bindEventForRelay(instance, 'repeatmodechange');
|
||||
bindEventForRelay(instance, 'shufflequeuemodechange');
|
||||
|
||||
events.on(instance._castPlayer, 'playstatechange', function (e, data) {
|
||||
Events.on(instance._castPlayer, 'playstatechange', function (e, data) {
|
||||
console.debug('cc: playstatechange');
|
||||
const state = instance.getPlayerStateInternal(data);
|
||||
|
||||
events.trigger(instance, 'pause', [state]);
|
||||
Events.trigger(instance, 'pause', [state]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@ class ChromecastPlayer {
|
|||
console.debug(JSON.stringify(data));
|
||||
|
||||
if (triggerStateChange) {
|
||||
events.trigger(this, 'statechange', [data]);
|
||||
Events.trigger(this, 'statechange', [data]);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
@ -672,7 +672,7 @@ class ChromecastPlayer {
|
|||
|
||||
playWithCommand(options, command) {
|
||||
if (!options.items) {
|
||||
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||
const apiClient = ServerConnections.getApiClient(options.serverId);
|
||||
const instance = this;
|
||||
|
||||
return apiClient.getItem(apiClient.getCurrentUserId(), options.ids[0]).then(function (item) {
|
||||
|
@ -984,7 +984,7 @@ class ChromecastPlayer {
|
|||
}
|
||||
|
||||
shuffle(item) {
|
||||
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
const userId = apiClient.getCurrentUserId();
|
||||
|
||||
const instance = this;
|
||||
|
@ -997,7 +997,7 @@ class ChromecastPlayer {
|
|||
}
|
||||
|
||||
instantMix(item) {
|
||||
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
const userId = apiClient.getCurrentUserId();
|
||||
|
||||
const instance = this;
|
||||
|
@ -1035,7 +1035,7 @@ class ChromecastPlayer {
|
|||
}
|
||||
|
||||
const instance = this;
|
||||
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||
const apiClient = ServerConnections.getApiClient(options.serverId);
|
||||
|
||||
return getItemsForPlayback(apiClient, {
|
||||
Ids: options.ids.join(',')
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import loading from 'loading';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import keyboardnavigation from 'keyboardnavigation';
|
||||
import appRouter from 'appRouter';
|
||||
import * as libarchive from 'libarchive';
|
||||
// eslint-disable-next-line import/named, import/namespace
|
||||
import { Archive } from 'libarchive.js';
|
||||
import loading from '../../components/loading/loading';
|
||||
import dialogHelper from '../../components/dialogHelper/dialogHelper';
|
||||
import keyboardnavigation from '../../scripts/keyboardNavigation';
|
||||
import { appRouter } from '../../components/appRouter';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
|
||||
export class ComicsPlayer {
|
||||
constructor() {
|
||||
|
@ -93,9 +95,9 @@ export class ComicsPlayer {
|
|||
loading.show();
|
||||
|
||||
const serverId = item.ServerId;
|
||||
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
|
||||
libarchive.Archive.init({
|
||||
Archive.init({
|
||||
workerUrl: appRouter.baseUrl() + '/libraries/worker-bundle.js'
|
||||
});
|
||||
|
||||
|
@ -175,7 +177,7 @@ class ArchiveSource {
|
|||
}
|
||||
|
||||
const blob = await res.blob();
|
||||
this.archive = await libarchive.Archive.open(blob);
|
||||
this.archive = await Archive.open(blob);
|
||||
this.raw = await this.archive.getFilesArray();
|
||||
this.numberOfFiles = this.raw.length;
|
||||
await this.archive.extractFiles();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import globalize from 'globalize';
|
||||
import * as userSettings from 'userSettings';
|
||||
import appHost from 'apphost';
|
||||
import globalize from '../../scripts/globalize';
|
||||
import * as userSettings from '../../scripts/settings/userSettings';
|
||||
import { appHost } from '../../components/apphost';
|
||||
import alert from '../../components/alert';
|
||||
|
||||
// TODO: Replace with date-fns
|
||||
// https://stackoverflow.com/questions/6117814/get-week-of-year-in-javascript-like-in-php
|
||||
|
@ -26,13 +27,8 @@ function showMessage(text, userSettingsKey, appHostFeature) {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
userSettings.set(userSettingsKey, '1', false);
|
||||
|
||||
import('alert').then(({default: alert}) => {
|
||||
return alert(text).then(resolve, resolve);
|
||||
});
|
||||
});
|
||||
userSettings.set(userSettingsKey, '1', false);
|
||||
return alert(text).catch(() => { /* ignore exceptions */ });
|
||||
}
|
||||
|
||||
function showBlurayMessage() {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import events from 'events';
|
||||
import browser from 'browser';
|
||||
import appHost from 'apphost';
|
||||
import * as htmlMediaHelper from 'htmlMediaHelper';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import browser from '../../scripts/browser';
|
||||
import { appHost } from '../../components/apphost';
|
||||
import * as htmlMediaHelper from '../../components/htmlMediaHelper';
|
||||
import profileBuilder from '../../scripts/browserDeviceProfile';
|
||||
|
||||
function getDefaultProfile() {
|
||||
return import('browserdeviceprofile').then(({ default: profileBuilder }) => {
|
||||
return profileBuilder({});
|
||||
});
|
||||
return profileBuilder({});
|
||||
}
|
||||
|
||||
let fadeTimeout;
|
||||
|
@ -51,7 +50,7 @@ function supportsFade() {
|
|||
}
|
||||
|
||||
function requireHlsPlayer(callback) {
|
||||
import('hlsjs').then(({ default: hls }) => {
|
||||
import('hls.js').then(({ default: hls }) => {
|
||||
window.Hls = hls;
|
||||
callback();
|
||||
});
|
||||
|
@ -68,7 +67,7 @@ function enableHlsPlayer(url, item, mediaSource, mediaType) {
|
|||
|
||||
// issue head request to get content type
|
||||
return new Promise(function (resolve, reject) {
|
||||
import('fetchHelper').then((fetchHelper) => {
|
||||
import('../../components/fetchhelper').then((fetchHelper) => {
|
||||
fetchHelper.ajax({
|
||||
url: url,
|
||||
type: 'HEAD'
|
||||
|
@ -251,14 +250,14 @@ class HtmlAudioPlayer {
|
|||
// Don't trigger events after user stop
|
||||
if (!self._isFadingOut) {
|
||||
self._currentTime = time;
|
||||
events.trigger(self, 'timeupdate');
|
||||
Events.trigger(self, 'timeupdate');
|
||||
}
|
||||
}
|
||||
|
||||
function onVolumeChange() {
|
||||
if (!self._isFadingOut) {
|
||||
htmlMediaHelper.saveVolume(this.volume);
|
||||
events.trigger(self, 'volumechange');
|
||||
Events.trigger(self, 'volumechange');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,19 +268,19 @@ class HtmlAudioPlayer {
|
|||
|
||||
htmlMediaHelper.seekOnPlaybackStart(self, e.target, self._currentPlayOptions.playerStartPositionTicks);
|
||||
}
|
||||
events.trigger(self, 'playing');
|
||||
Events.trigger(self, 'playing');
|
||||
}
|
||||
|
||||
function onPlay(e) {
|
||||
events.trigger(self, 'unpause');
|
||||
Events.trigger(self, 'unpause');
|
||||
}
|
||||
|
||||
function onPause() {
|
||||
events.trigger(self, 'pause');
|
||||
Events.trigger(self, 'pause');
|
||||
}
|
||||
|
||||
function onWaiting() {
|
||||
events.trigger(self, 'waiting');
|
||||
Events.trigger(self, 'waiting');
|
||||
}
|
||||
|
||||
function onError() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import browser from 'browser';
|
||||
import events from 'events';
|
||||
import appHost from 'apphost';
|
||||
import loading from 'loading';
|
||||
import dom from 'dom';
|
||||
import playbackManager from 'playbackManager';
|
||||
import appRouter from 'appRouter';
|
||||
import browser from '../../scripts/browser';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import { appHost } from '../../components/apphost';
|
||||
import loading from '../../components/loading/loading';
|
||||
import dom from '../../scripts/dom';
|
||||
import { playbackManager } from '../../components/playback/playbackmanager';
|
||||
import { appRouter } from '../../components/appRouter';
|
||||
import {
|
||||
bindEventsToHlsPlayer,
|
||||
destroyHlsPlayer,
|
||||
|
@ -22,10 +22,12 @@ import {
|
|||
getSavedVolume,
|
||||
isValidDuration,
|
||||
getBufferedRanges
|
||||
} from 'htmlMediaHelper';
|
||||
import itemHelper from 'itemHelper';
|
||||
import screenfull from 'screenfull';
|
||||
import globalize from 'globalize';
|
||||
} from '../../components/htmlMediaHelper';
|
||||
import itemHelper from '../../components/itemHelper';
|
||||
import Screenfull from 'screenfull';
|
||||
import globalize from '../../scripts/globalize';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
import profileBuilder from '../../scripts/browserDeviceProfile';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
|
@ -85,7 +87,7 @@ function tryRemoveElement(elem) {
|
|||
}
|
||||
|
||||
function requireHlsPlayer(callback) {
|
||||
import('hlsjs').then(({default: hls}) => {
|
||||
import('hls.js').then(({default: hls}) => {
|
||||
window.Hls = hls;
|
||||
callback();
|
||||
});
|
||||
|
@ -137,9 +139,7 @@ function tryRemoveElement(elem) {
|
|||
}
|
||||
|
||||
function getDefaultProfile() {
|
||||
return import('browserdeviceprofile').then(({default: profileBuilder}) => {
|
||||
return profileBuilder({});
|
||||
});
|
||||
return profileBuilder({});
|
||||
}
|
||||
|
||||
export class HtmlVideoPlayer {
|
||||
|
@ -284,7 +284,7 @@ function tryRemoveElement(elem) {
|
|||
incrementFetchQueue() {
|
||||
if (this.#fetchQueue <= 0) {
|
||||
this.isFetching = true;
|
||||
events.trigger(this, 'beginFetch');
|
||||
Events.trigger(this, 'beginFetch');
|
||||
}
|
||||
|
||||
this.#fetchQueue++;
|
||||
|
@ -298,7 +298,7 @@ function tryRemoveElement(elem) {
|
|||
|
||||
if (this.#fetchQueue <= 0) {
|
||||
this.isFetching = false;
|
||||
events.trigger(this, 'endFetch');
|
||||
Events.trigger(this, 'endFetch');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ function tryRemoveElement(elem) {
|
|||
|
||||
console.debug(`prefetching hls playlist: ${hlsPlaylistUrl}`);
|
||||
|
||||
return window.connectionManager.getApiClient(item.ServerId).ajax({
|
||||
return ServerConnections.getApiClient(item.ServerId).ajax({
|
||||
|
||||
type: 'GET',
|
||||
url: hlsPlaylistUrl
|
||||
|
@ -360,7 +360,7 @@ function tryRemoveElement(elem) {
|
|||
* @private
|
||||
*/
|
||||
setSrcWithFlvJs(elem, options, url) {
|
||||
return import('flvjs').then(({default: flvjs}) => {
|
||||
return import('flv.js').then(({default: flvjs}) => {
|
||||
const flvPlayer = flvjs.createPlayer({
|
||||
type: 'flv',
|
||||
url: url
|
||||
|
@ -703,8 +703,8 @@ function tryRemoveElement(elem) {
|
|||
dlg.parentNode.removeChild(dlg);
|
||||
}
|
||||
|
||||
if (screenfull.isEnabled) {
|
||||
screenfull.exit();
|
||||
if (Screenfull.isEnabled) {
|
||||
Screenfull.exit();
|
||||
} else {
|
||||
// iOS Safari
|
||||
if (document.webkitIsFullScreen && document.webkitCancelFullscreen) {
|
||||
|
@ -753,7 +753,7 @@ function tryRemoveElement(elem) {
|
|||
this.updateSubtitleText(timeMs);
|
||||
}
|
||||
|
||||
events.trigger(this, 'timeupdate');
|
||||
Events.trigger(this, 'timeupdate');
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -766,7 +766,7 @@ function tryRemoveElement(elem) {
|
|||
*/
|
||||
const elem = e.target;
|
||||
saveVolume(elem.volume);
|
||||
events.trigger(this, 'volumechange');
|
||||
Events.trigger(this, 'volumechange');
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -825,14 +825,14 @@ function tryRemoveElement(elem) {
|
|||
this.onStartedAndNavigatedToOsd();
|
||||
}
|
||||
}
|
||||
events.trigger(this, 'playing');
|
||||
Events.trigger(this, 'playing');
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onPlay = () => {
|
||||
events.trigger(this, 'unpause');
|
||||
Events.trigger(this, 'unpause');
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -858,25 +858,25 @@ function tryRemoveElement(elem) {
|
|||
* @private
|
||||
*/
|
||||
onClick = () => {
|
||||
events.trigger(this, 'click');
|
||||
Events.trigger(this, 'click');
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onDblClick = () => {
|
||||
events.trigger(this, 'dblclick');
|
||||
Events.trigger(this, 'dblclick');
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onPause = () => {
|
||||
events.trigger(this, 'pause');
|
||||
Events.trigger(this, 'pause');
|
||||
};
|
||||
|
||||
onWaiting() {
|
||||
events.trigger(this, 'waiting');
|
||||
Events.trigger(this, 'waiting');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1029,15 +1029,21 @@ function tryRemoveElement(elem) {
|
|||
* @private
|
||||
*/
|
||||
renderSsaAss(videoElement, track, item) {
|
||||
const avaliableFonts = [];
|
||||
const attachments = this._currentPlayOptions.mediaSource.MediaAttachments || [];
|
||||
const apiClient = window.connectionManager.getApiClient(item);
|
||||
attachments.map(function (i) {
|
||||
// embedded font url
|
||||
return avaliableFonts.push(i.DeliveryUrl);
|
||||
});
|
||||
const apiClient = ServerConnections.getApiClient(item);
|
||||
const fallbackFontList = apiClient.getUrl('/FallbackFont/Fonts', {
|
||||
api_key: apiClient.accessToken()
|
||||
});
|
||||
const htmlVideoPlayer = this;
|
||||
const options = {
|
||||
video: videoElement,
|
||||
subUrl: getTextTrackUrl(track, item),
|
||||
fonts: attachments.map(function (i) {
|
||||
return apiClient.getUrl(i.DeliveryUrl);
|
||||
}),
|
||||
fonts: avaliableFonts,
|
||||
workerUrl: `${appRouter.baseUrl()}/libraries/subtitles-octopus-worker.js`,
|
||||
legacyWorkerUrl: `${appRouter.baseUrl()}/libraries/subtitles-octopus-worker-legacy.js`,
|
||||
onError() {
|
||||
|
@ -1057,8 +1063,22 @@ function tryRemoveElement(elem) {
|
|||
resizeVariation: 0.2,
|
||||
renderAhead: 90
|
||||
};
|
||||
import('JavascriptSubtitlesOctopus').then(({default: SubtitlesOctopus}) => {
|
||||
this.#currentSubtitlesOctopus = new SubtitlesOctopus(options);
|
||||
import('libass-wasm').then(({default: SubtitlesOctopus}) => {
|
||||
apiClient.getNamedConfiguration('encoding').then(config => {
|
||||
if (config.EnableFallbackFont) {
|
||||
apiClient.getJSON(fallbackFontList).then((fontFiles = []) => {
|
||||
fontFiles.forEach(font => {
|
||||
const fontUrl = apiClient.getUrl(`/FallbackFont/Fonts/${font.Name}`, {
|
||||
api_key: apiClient.accessToken()
|
||||
});
|
||||
avaliableFonts.push(fontUrl);
|
||||
});
|
||||
this.#currentSubtitlesOctopus = new SubtitlesOctopus(options);
|
||||
});
|
||||
} else {
|
||||
this.#currentSubtitlesOctopus = new SubtitlesOctopus(options);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1113,7 +1133,7 @@ function tryRemoveElement(elem) {
|
|||
* @private
|
||||
*/
|
||||
setSubtitleAppearance(elem, innerElem) {
|
||||
Promise.all([import('userSettings'), import('subtitleAppearanceHelper')]).then(([userSettings, subtitleAppearanceHelper]) => {
|
||||
Promise.all([import('../../scripts/settings/userSettings'), import('../../components/subtitlesettings/subtitleappearancehelper')]).then(([userSettings, subtitleAppearanceHelper]) => {
|
||||
subtitleAppearanceHelper.applyStyles({
|
||||
text: innerElem,
|
||||
window: elem
|
||||
|
@ -1134,7 +1154,7 @@ function tryRemoveElement(elem) {
|
|||
* @private
|
||||
*/
|
||||
setCueAppearance() {
|
||||
Promise.all([import('userSettings'), import('subtitleAppearanceHelper')]).then(([userSettings, subtitleAppearanceHelper]) => {
|
||||
Promise.all([import('../../scripts/settings/userSettings'), import('../../components/subtitlesettings/subtitleappearancehelper')]).then(([userSettings, subtitleAppearanceHelper]) => {
|
||||
const elementId = `${this.id}-cuestyle`;
|
||||
|
||||
let styleElem = document.querySelector(`#${elementId}`);
|
||||
|
@ -1189,7 +1209,7 @@ function tryRemoveElement(elem) {
|
|||
|
||||
// download the track json
|
||||
this.fetchSubtitles(track, item).then(function (data) {
|
||||
import('userSettings').then((userSettings) => {
|
||||
import('../../scripts/settings/userSettings').then((userSettings) => {
|
||||
// show in ui
|
||||
console.debug(`downloaded ${data.TrackEvents.length} track events`);
|
||||
|
||||
|
@ -1281,7 +1301,7 @@ function tryRemoveElement(elem) {
|
|||
const dlg = document.querySelector('.videoPlayerContainer');
|
||||
|
||||
if (!dlg) {
|
||||
return import('css!./style').then(() => {
|
||||
return import('./style.css').then(() => {
|
||||
loading.show();
|
||||
|
||||
const dlg = document.createElement('div');
|
||||
|
@ -1561,7 +1581,7 @@ function tryRemoveElement(elem) {
|
|||
elem.style['-webkit-filter'] = `brightness(${cssValue})`;
|
||||
elem.style.filter = `brightness(${cssValue})`;
|
||||
elem.brightnessValue = val;
|
||||
events.trigger(this, 'brightnesschange');
|
||||
Events.trigger(this, 'brightnesschange');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import pluginManager from 'pluginManager';
|
||||
|
||||
export default function () {
|
||||
const self = this;
|
||||
|
||||
|
@ -128,7 +126,7 @@ export default function () {
|
|||
}
|
||||
|
||||
self.show = function () {
|
||||
import('css!' + pluginManager.mapPath(self, 'style.css')).then(() => {
|
||||
import('./style.css').then(() => {
|
||||
let elem = document.querySelector('.logoScreenSaver');
|
||||
|
||||
if (!elem) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import loading from 'loading';
|
||||
import keyboardnavigation from 'keyboardnavigation';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import dom from 'dom';
|
||||
import appRouter from 'appRouter';
|
||||
import events from 'events';
|
||||
import 'css!./style';
|
||||
import 'material-icons';
|
||||
import 'paper-icon-button-light';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
import loading from '../../components/loading/loading';
|
||||
import keyboardnavigation from '../../scripts/keyboardNavigation';
|
||||
import dialogHelper from '../../components/dialogHelper/dialogHelper';
|
||||
import dom from '../../scripts/dom';
|
||||
import { appRouter } from '../../components/appRouter';
|
||||
import './style.css';
|
||||
import '../../elements/emby-button/paper-icon-button-light';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
|
||||
export class PdfPlayer {
|
||||
constructor() {
|
||||
|
@ -186,10 +186,10 @@ export class PdfPlayer {
|
|||
};
|
||||
|
||||
const serverId = item.ServerId;
|
||||
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
import('pdfjs').then(({default: pdfjs}) => {
|
||||
import('pdfjs-dist').then(({default: pdfjs}) => {
|
||||
const downloadHref = apiClient.getItemDownloadUrl(item.Id);
|
||||
|
||||
this.bindEvents();
|
||||
|
@ -266,7 +266,7 @@ export class PdfPlayer {
|
|||
|
||||
renderPage(canvas, number) {
|
||||
this.book.getPage(number).then(page => {
|
||||
events.trigger(this, 'timeupdate');
|
||||
Events.trigger(this, 'timeupdate');
|
||||
|
||||
const original = page.getViewport({ scale: 1 });
|
||||
const context = canvas.getContext('2d');
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import ServerConnections from '../../components/ServerConnections';
|
||||
|
||||
export default class PhotoPlayer {
|
||||
constructor() {
|
||||
|
@ -9,12 +10,12 @@ export default class PhotoPlayer {
|
|||
|
||||
play(options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
import('slideshow').then(({default: slideshow}) => {
|
||||
import('../../components/slideshow/slideshow').then(({default: Slideshow}) => {
|
||||
const index = options.startIndex || 0;
|
||||
|
||||
const apiClient = window.connectionManager.currentApiClient();
|
||||
const apiClient = ServerConnections.currentApiClient();
|
||||
apiClient.getCurrentUser().then(function(result) {
|
||||
const newSlideShow = new slideshow({
|
||||
const newSlideShow = new Slideshow({
|
||||
showTitle: false,
|
||||
cover: false,
|
||||
items: options.items,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import globalize from 'globalize';
|
||||
import globalize from '../../scripts/globalize';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
import alert from '../../components/alert';
|
||||
|
||||
function showErrorMessage() {
|
||||
return import('alert').then(({default: alert}) => {
|
||||
return alert(globalize.translate('MessagePlayAccessRestricted'));
|
||||
});
|
||||
return alert(globalize.translate('MessagePlayAccessRestricted'));
|
||||
}
|
||||
|
||||
class PlayAccessValidation {
|
||||
|
@ -24,7 +24,7 @@ class PlayAccessValidation {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return window.connectionManager.getApiClient(serverId).getCurrentUser().then(function (user) {
|
||||
return ServerConnections.getApiClient(serverId).getCurrentUser().then(function (user) {
|
||||
if (user.Policy.EnableMediaPlayback) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import playbackManager from 'playbackManager';
|
||||
import events from 'events';
|
||||
import serverNotifications from 'serverNotifications';
|
||||
import { playbackManager } from '../../components/playback/playbackmanager';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import serverNotifications from '../../scripts/serverNotifications';
|
||||
import ServerConnections from '../../components/ServerConnections';
|
||||
|
||||
function getActivePlayerId() {
|
||||
const info = playbackManager.getPlayerInfo();
|
||||
|
@ -53,10 +54,10 @@ function getCurrentApiClient(instance) {
|
|||
const currentServerId = instance.currentServerId;
|
||||
|
||||
if (currentServerId) {
|
||||
return window.connectionManager.getApiClient(currentServerId);
|
||||
return ServerConnections.getApiClient(currentServerId);
|
||||
}
|
||||
|
||||
return window.connectionManager.currentApiClient();
|
||||
return ServerConnections.currentApiClient();
|
||||
}
|
||||
|
||||
function sendCommandByName(instance, name, options) {
|
||||
|
@ -104,7 +105,7 @@ function processUpdatedSessions(instance, sessions, apiClient) {
|
|||
instance.lastPlayerData = session;
|
||||
|
||||
for (let i = 0, length = eventNames.length; i < length; i++) {
|
||||
events.trigger(instance, eventNames[i], [session]);
|
||||
Events.trigger(instance, eventNames[i], [session]);
|
||||
}
|
||||
} else {
|
||||
instance.lastPlayerData = session;
|
||||
|
@ -186,7 +187,7 @@ class SessionPlayer {
|
|||
this.isLocalPlayer = false;
|
||||
this.id = 'remoteplayer';
|
||||
|
||||
events.on(serverNotifications, 'Sessions', function (e, apiClient, data) {
|
||||
Events.on(serverNotifications, 'Sessions', function (e, apiClient, data) {
|
||||
processUpdatedSessions(self, data, apiClient);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import events from 'events';
|
||||
import browser from 'browser';
|
||||
import appRouter from 'appRouter';
|
||||
import loading from 'loading';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import browser from '../../scripts/browser';
|
||||
import { appRouter } from '../../components/appRouter';
|
||||
import loading from '../../components/loading/loading';
|
||||
|
||||
/* globals YT */
|
||||
|
||||
|
@ -24,7 +24,7 @@ function createMediaElement(instance, options) {
|
|||
const dlg = document.querySelector('.youtubePlayerContainer');
|
||||
|
||||
if (!dlg) {
|
||||
import('css!./style').then(() => {
|
||||
import('./style.css').then(() => {
|
||||
loading.show();
|
||||
|
||||
const dlg = document.createElement('div');
|
||||
|
@ -93,7 +93,7 @@ function onEndedInternal(instance) {
|
|||
src: instance._currentSrc
|
||||
};
|
||||
|
||||
events.trigger(instance, 'stopped', [stopInfo]);
|
||||
Events.trigger(instance, 'stopped', [stopInfo]);
|
||||
|
||||
instance._currentSrc = null;
|
||||
if (instance.currentYoutubePlayer) {
|
||||
|
@ -108,7 +108,7 @@ function onPlayerReady(event) {
|
|||
}
|
||||
|
||||
function onTimeUpdate(e) {
|
||||
events.trigger(this, 'timeupdate');
|
||||
Events.trigger(this, 'timeupdate');
|
||||
}
|
||||
|
||||
function onPlaying(instance, playOptions, resolve) {
|
||||
|
@ -127,68 +127,64 @@ function onPlaying(instance, playOptions, resolve) {
|
|||
instance.videoDialog.classList.remove('onTop');
|
||||
}
|
||||
|
||||
import('loading').then(({default: loading}) => {
|
||||
loading.hide();
|
||||
});
|
||||
loading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function setCurrentSrc(instance, elem, options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
import('queryString').then(({default: queryString}) => {
|
||||
instance._currentSrc = options.url;
|
||||
const params = queryString.parse(options.url.split('?')[1]);
|
||||
// 3. This function creates an <iframe> (and YouTube player)
|
||||
// after the API code downloads.
|
||||
window.onYouTubeIframeAPIReady = function () {
|
||||
instance.currentYoutubePlayer = new YT.Player('player', {
|
||||
height: instance.videoDialog.offsetHeight,
|
||||
width: instance.videoDialog.offsetWidth,
|
||||
videoId: params.v,
|
||||
events: {
|
||||
'onReady': onPlayerReady,
|
||||
'onStateChange': function (event) {
|
||||
if (event.data === YT.PlayerState.PLAYING) {
|
||||
onPlaying(instance, options, resolve);
|
||||
} else if (event.data === YT.PlayerState.ENDED) {
|
||||
onEndedInternal(instance);
|
||||
} else if (event.data === YT.PlayerState.PAUSED) {
|
||||
events.trigger(instance, 'pause');
|
||||
}
|
||||
instance._currentSrc = options.url;
|
||||
const params = new URLSearchParams(options.url.split('?')[1]); /* eslint-disable-line compat/compat */
|
||||
// 3. This function creates an <iframe> (and YouTube player)
|
||||
// after the API code downloads.
|
||||
window.onYouTubeIframeAPIReady = function () {
|
||||
instance.currentYoutubePlayer = new YT.Player('player', {
|
||||
height: instance.videoDialog.offsetHeight,
|
||||
width: instance.videoDialog.offsetWidth,
|
||||
videoId: params.get('v'),
|
||||
events: {
|
||||
'onReady': onPlayerReady,
|
||||
'onStateChange': function (event) {
|
||||
if (event.data === YT.PlayerState.PLAYING) {
|
||||
onPlaying(instance, options, resolve);
|
||||
} else if (event.data === YT.PlayerState.ENDED) {
|
||||
onEndedInternal(instance);
|
||||
} else if (event.data === YT.PlayerState.PAUSED) {
|
||||
Events.trigger(instance, 'pause');
|
||||
}
|
||||
},
|
||||
playerVars: {
|
||||
controls: 0,
|
||||
enablejsapi: 1,
|
||||
modestbranding: 1,
|
||||
rel: 0,
|
||||
showinfo: 0,
|
||||
fs: 0,
|
||||
playsinline: 1
|
||||
}
|
||||
});
|
||||
|
||||
let resizeListener = instance.resizeListener;
|
||||
if (resizeListener) {
|
||||
window.removeEventListener('resize', resizeListener);
|
||||
window.addEventListener('resize', resizeListener);
|
||||
} else {
|
||||
resizeListener = instance.resizeListener = onVideoResize.bind(instance);
|
||||
window.addEventListener('resize', resizeListener);
|
||||
},
|
||||
playerVars: {
|
||||
controls: 0,
|
||||
enablejsapi: 1,
|
||||
modestbranding: 1,
|
||||
rel: 0,
|
||||
showinfo: 0,
|
||||
fs: 0,
|
||||
playsinline: 1
|
||||
}
|
||||
window.removeEventListener('orientationChange', resizeListener);
|
||||
window.addEventListener('orientationChange', resizeListener);
|
||||
};
|
||||
});
|
||||
|
||||
if (!window.YT) {
|
||||
const tag = document.createElement('script');
|
||||
tag.src = 'https://www.youtube.com/iframe_api';
|
||||
const firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
let resizeListener = instance.resizeListener;
|
||||
if (resizeListener) {
|
||||
window.removeEventListener('resize', resizeListener);
|
||||
window.addEventListener('resize', resizeListener);
|
||||
} else {
|
||||
window.onYouTubeIframeAPIReady();
|
||||
resizeListener = instance.resizeListener = onVideoResize.bind(instance);
|
||||
window.addEventListener('resize', resizeListener);
|
||||
}
|
||||
});
|
||||
window.removeEventListener('orientationChange', resizeListener);
|
||||
window.addEventListener('orientationChange', resizeListener);
|
||||
};
|
||||
|
||||
if (!window.YT) {
|
||||
const tag = document.createElement('script');
|
||||
tag.src = 'https://www.youtube.com/iframe_api';
|
||||
const firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
} else {
|
||||
window.onYouTubeIframeAPIReady();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -292,7 +288,7 @@ class YoutubePlayer {
|
|||
|
||||
// This needs a delay before the youtube player will report the correct player state
|
||||
setTimeout(function () {
|
||||
events.trigger(instance, 'pause');
|
||||
Events.trigger(instance, 'pause');
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +302,7 @@ class YoutubePlayer {
|
|||
|
||||
// This needs a delay before the youtube player will report the correct player state
|
||||
setTimeout(function () {
|
||||
events.trigger(instance, 'unpause');
|
||||
Events.trigger(instance, 'unpause');
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue