1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add prefer optional chaining rule

This commit is contained in:
Bill Thornton 2023-07-06 13:39:48 -04:00
parent ec0adb895b
commit f35a8151e0
61 changed files with 152 additions and 152 deletions

View file

@ -1010,7 +1010,7 @@ export class HtmlVideoPlayer {
}
if (elem.videoWidth === 0 && elem.videoHeight === 0) {
const mediaSource = (this._currentPlayOptions || {}).mediaSource;
const mediaSource = this._currentPlayOptions?.mediaSource;
// Only trigger this if there is media info
// Avoid triggering in situations where it might not actually have a video stream (audio only live tv channel)
@ -1536,7 +1536,7 @@ export class HtmlVideoPlayer {
}
}
if (selectedTrackEvent && selectedTrackEvent.Text) {
if (selectedTrackEvent?.Text) {
subtitleTextElement.innerHTML = DOMPurify.sanitize(
normalizeTrackEventText(selectedTrackEvent.Text, true));
subtitleTextElement.classList.remove('hide');
@ -1812,7 +1812,7 @@ export class HtmlVideoPlayer {
Windows.UI.ViewManagement.ApplicationView.getForCurrentView().tryEnterViewModeAsync(Windows.UI.ViewManagement.ApplicationViewMode.default);
}
} else {
if (video && video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === 'function') {
if (video?.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === 'function') {
video.webkitSetPresentationMode(isEnabled ? 'picture-in-picture' : 'inline');
}
}
@ -1891,7 +1891,7 @@ export class HtmlVideoPlayer {
const mediaElement = this.#mediaElement;
if (mediaElement) {
const seekable = mediaElement.seekable;
if (seekable && seekable.length) {
if (seekable?.length) {
let start = seekable.start(0);
let end = seekable.end(0);