Add constants for app features
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { AppFeature } from 'constants/appFeature';
|
||||
import { MediaError } from 'types/mediaError';
|
||||
|
||||
import browser from '../../scripts/browser';
|
||||
import { appHost } from '../../components/apphost';
|
||||
import * as htmlMediaHelper from '../../components/htmlMediaHelper';
|
||||
@@ -5,7 +8,6 @@ import profileBuilder from '../../scripts/browserDeviceProfile';
|
||||
import { getIncludeCorsCredentials } from '../../scripts/settings/webSettings';
|
||||
import { PluginType } from '../../types/plugin.ts';
|
||||
import Events from '../../utils/events.ts';
|
||||
import { MediaError } from 'types/mediaError';
|
||||
|
||||
function getDefaultProfile() {
|
||||
return profileBuilder({});
|
||||
@@ -278,7 +280,7 @@ class HtmlAudioPlayer {
|
||||
}
|
||||
|
||||
// TODO: Move volume control to PlaybackManager. Player should just be a wrapper that translates commands into API calls.
|
||||
if (!appHost.supports('physicalvolumecontrol')) {
|
||||
if (!appHost.supports(AppFeature.PhysicalVolumeControl)) {
|
||||
elem.volume = htmlMediaHelper.getSavedVolume();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import DOMPurify from 'dompurify';
|
||||
import debounce from 'lodash-es/debounce';
|
||||
import Screenfull from 'screenfull';
|
||||
|
||||
import { AppFeature } from 'constants/appFeature';
|
||||
import { ServerConnections } from 'lib/jellyfin-apiclient';
|
||||
import { MediaError } from 'types/mediaError';
|
||||
|
||||
import browser from '../../scripts/browser';
|
||||
import appSettings from '../../scripts/settings/appSettings';
|
||||
@@ -27,9 +33,7 @@ import {
|
||||
getBufferedRanges
|
||||
} from '../../components/htmlMediaHelper';
|
||||
import itemHelper from '../../components/itemHelper';
|
||||
import Screenfull from 'screenfull';
|
||||
import globalize from '../../lib/globalize';
|
||||
import { ServerConnections } from 'lib/jellyfin-apiclient';
|
||||
import profileBuilder, { canPlaySecondaryAudio } from '../../scripts/browserDeviceProfile';
|
||||
import { getIncludeCorsCredentials } from '../../scripts/settings/webSettings';
|
||||
import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../components/backdrop/backdrop';
|
||||
@@ -37,8 +41,6 @@ import { PluginType } from '../../types/plugin.ts';
|
||||
import Events from '../../utils/events.ts';
|
||||
import { includesAny } from '../../utils/container.ts';
|
||||
import { isHls } from '../../utils/mediaSource.ts';
|
||||
import debounce from 'lodash-es/debounce';
|
||||
import { MediaError } from 'types/mediaError';
|
||||
|
||||
/**
|
||||
* Returns resolved URL.
|
||||
@@ -1667,7 +1669,7 @@ export class HtmlVideoPlayer {
|
||||
const cssClass = 'htmlvideoplayer';
|
||||
|
||||
// Can't autoplay in these browsers so we need to use the full controls, at least until playback starts
|
||||
if (!appHost.supports('htmlvideoautoplay')) {
|
||||
if (!appHost.supports(AppFeature.HtmlVideoAutoplay)) {
|
||||
html += '<video class="' + cssClass + '" preload="metadata" autoplay="autoplay" controls="controls" webkit-playsinline playsinline>';
|
||||
} else if (browser.web0s) {
|
||||
// in webOS, setting preload auto allows resuming videos
|
||||
@@ -1683,7 +1685,7 @@ export class HtmlVideoPlayer {
|
||||
const videoElement = playerDlg.querySelector('video');
|
||||
|
||||
// TODO: Move volume control to PlaybackManager. Player should just be a wrapper that translates commands into API calls.
|
||||
if (!appHost.supports('physicalvolumecontrol')) {
|
||||
if (!appHost.supports(AppFeature.PhysicalVolumeControl)) {
|
||||
videoElement.volume = getSavedVolume();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { appHost } from '../../../components/apphost';
|
||||
import { appHost } from 'components/apphost';
|
||||
import { AppFeature } from 'constants/appFeature';
|
||||
|
||||
/**
|
||||
* Creates an audio element that plays a silent sound.
|
||||
@@ -35,7 +36,7 @@ class PlaybackPermissionManager {
|
||||
* @returns {Promise} Promise that resolves succesfully if playback permission is allowed.
|
||||
*/
|
||||
check () {
|
||||
if (appHost.supports('htmlaudioautoplay')) {
|
||||
if (appHost.supports(AppFeature.HtmlAudioAutoplay)) {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user