mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
made some otimizations in nowPlayingBar.js
minor fixes in youtubePlayer plugin
This commit is contained in:
parent
383c0d2cc4
commit
8a41247491
2 changed files with 29 additions and 38 deletions
|
@ -11,6 +11,10 @@ import itemContextMenu from '../itemContextMenu';
|
||||||
import '../../elements/emby-button/paper-icon-button-light';
|
import '../../elements/emby-button/paper-icon-button-light';
|
||||||
import '../../elements/emby-ratingbutton/emby-ratingbutton';
|
import '../../elements/emby-ratingbutton/emby-ratingbutton';
|
||||||
import ServerConnections from '../ServerConnections';
|
import ServerConnections from '../ServerConnections';
|
||||||
|
import appFooter from '../appFooter/appFooter';
|
||||||
|
import itemShortcuts from '../shortcuts';
|
||||||
|
import './nowPlayingBar.css';
|
||||||
|
import '../../elements/emby-slider/emby-slider';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
@ -252,44 +256,34 @@ import ServerConnections from '../ServerConnections';
|
||||||
let nowPlayingBarElement;
|
let nowPlayingBarElement;
|
||||||
function getNowPlayingBar() {
|
function getNowPlayingBar() {
|
||||||
if (nowPlayingBarElement) {
|
if (nowPlayingBarElement) {
|
||||||
return Promise.resolve(nowPlayingBarElement);
|
return nowPlayingBarElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
const parentContainer = appFooter.element;
|
||||||
Promise.all([
|
nowPlayingBarElement = parentContainer.querySelector('.nowPlayingBar');
|
||||||
import('../appFooter/appFooter'),
|
|
||||||
import('../shortcuts'),
|
|
||||||
import('./nowPlayingBar.css'),
|
|
||||||
import('../../elements/emby-slider/emby-slider')
|
|
||||||
])
|
|
||||||
.then(([appfooter, itemShortcuts]) => {
|
|
||||||
const parentContainer = appfooter.element;
|
|
||||||
nowPlayingBarElement = parentContainer.querySelector('.nowPlayingBar');
|
|
||||||
|
|
||||||
if (nowPlayingBarElement) {
|
if (nowPlayingBarElement) {
|
||||||
resolve(nowPlayingBarElement);
|
return nowPlayingBarElement;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
parentContainer.insertAdjacentHTML('afterbegin', getNowPlayingBarHtml());
|
parentContainer.insertAdjacentHTML('afterbegin', getNowPlayingBarHtml());
|
||||||
nowPlayingBarElement = parentContainer.querySelector('.nowPlayingBar');
|
nowPlayingBarElement = parentContainer.querySelector('.nowPlayingBar');
|
||||||
|
|
||||||
if (layoutManager.mobile) {
|
if (layoutManager.mobile) {
|
||||||
hideButton(nowPlayingBarElement.querySelector('.btnShuffleQueue'));
|
hideButton(nowPlayingBarElement.querySelector('.btnShuffleQueue'));
|
||||||
hideButton(nowPlayingBarElement.querySelector('.nowPlayingBarCenter'));
|
hideButton(nowPlayingBarElement.querySelector('.nowPlayingBarCenter'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.safari && browser.slow) {
|
if (browser.safari && browser.slow) {
|
||||||
// Not handled well here. The wrong elements receive events, bar doesn't update quickly enough, etc.
|
// Not handled well here. The wrong elements receive events, bar doesn't update quickly enough, etc.
|
||||||
nowPlayingBarElement.classList.add('noMediaProgress');
|
nowPlayingBarElement.classList.add('noMediaProgress');
|
||||||
}
|
}
|
||||||
|
|
||||||
itemShortcuts.on(nowPlayingBarElement);
|
itemShortcuts.on(nowPlayingBarElement);
|
||||||
|
|
||||||
bindEvents(nowPlayingBarElement);
|
bindEvents(nowPlayingBarElement);
|
||||||
resolve(nowPlayingBarElement);
|
|
||||||
});
|
return nowPlayingBarElement;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showButton(button) {
|
function showButton(button) {
|
||||||
|
@ -621,7 +615,7 @@ import ServerConnections from '../ServerConnections';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNowPlayingBar().then(slideUp);
|
slideUp(getNowPlayingBar());
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideNowPlayingBar() {
|
function hideNowPlayingBar() {
|
||||||
|
@ -682,9 +676,8 @@ import ServerConnections from '../ServerConnections';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNowPlayingBar().then(function () {
|
getNowPlayingBar();
|
||||||
updatePlayerStateInternal(event, state, player);
|
updatePlayerStateInternal(event, state, player);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTimeUpdate(e) {
|
function onTimeUpdate(e) {
|
||||||
|
|
|
@ -114,9 +114,7 @@ function onPlaying(instance, playOptions, resolve) {
|
||||||
instance.videoDialog.classList.remove('onTop');
|
instance.videoDialog.classList.remove('onTop');
|
||||||
}
|
}
|
||||||
|
|
||||||
import('../../components/loading/loading').then(({default: loading}) => {
|
loading.hide();
|
||||||
loading.hide();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +128,7 @@ function setCurrentSrc(instance, elem, options) {
|
||||||
instance.currentYoutubePlayer = new YT.Player('player', {
|
instance.currentYoutubePlayer = new YT.Player('player', {
|
||||||
height: instance.videoDialog.offsetHeight,
|
height: instance.videoDialog.offsetHeight,
|
||||||
width: instance.videoDialog.offsetWidth,
|
width: instance.videoDialog.offsetWidth,
|
||||||
videoId: params.v,
|
videoId: params.get('v'),
|
||||||
events: {
|
events: {
|
||||||
'onReady': onPlayerReady,
|
'onReady': onPlayerReady,
|
||||||
'onStateChange': function (event) {
|
'onStateChange': function (event) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue