From 11e4549b487b2fb643b877672c7255de2174b550 Mon Sep 17 00:00:00 2001 From: viown <48097677+viown@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:37:38 +0300 Subject: [PATCH] Use PlayerEvent constant --- src/components/playback/playbackmanager.js | 3 ++- src/controllers/playback/video/index.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index b50e3fa04e..25b3e32a73 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -22,6 +22,7 @@ import { getItems } from '../../utils/jellyfin-apiclient/getItems.ts'; import { getItemBackdropImageUrl } from '../../utils/jellyfin-apiclient/backdropImage'; import { bindMediaSegmentManager } from 'apps/stable/features/playback/utils/mediaSegmentManager'; +import { PlayerEvent } from 'apps/stable/features/playback/constants/playerEvent'; import { MediaError } from 'types/mediaError'; import { getMediaError } from 'utils/mediaError'; import { toApi } from 'utils/jellyfin-apiclient/compat'; @@ -939,7 +940,7 @@ export class PlaybackManager { player = player || self._currentPlayer; if (mediaSegment && this._skipSegment) { - Events.trigger(player, 'promptskip', [mediaSegment]); + Events.trigger(player, PlayerEvent.PromptSkip, [mediaSegment]); } }; diff --git a/src/controllers/playback/video/index.js b/src/controllers/playback/video/index.js index 740b80afb0..0d230a5c32 100644 --- a/src/controllers/playback/video/index.js +++ b/src/controllers/playback/video/index.js @@ -31,6 +31,7 @@ import { PluginType } from '../../../types/plugin.ts'; import { EventType } from 'types/eventType'; import { MediaSegmentType } from '@jellyfin/sdk/lib/generated-client'; import { TICKS_PER_MINUTE, TICKS_PER_SECOND } from 'constants/time'; +import { PlayerEvent } from 'apps/stable/features/playback/constants/playerEvent'; function getOpenedDialog() { return document.querySelector('.dialogContainer .dialog.opened'); @@ -578,7 +579,7 @@ export default function (view) { }, state); Events.on(player, 'playbackstart', onPlaybackStart); Events.on(player, 'playbackstop', onPlaybackStopped); - Events.on(player, 'promptskip', onPromptSkip); + Events.on(player, PlayerEvent.PromptSkip, onPromptSkip); Events.on(player, 'volumechange', onVolumeChanged); Events.on(player, 'pause', onPlayPauseStateChanged); Events.on(player, 'unpause', onPlayPauseStateChanged); @@ -603,7 +604,7 @@ export default function (view) { if (player) { Events.off(player, 'playbackstart', onPlaybackStart); Events.off(player, 'playbackstop', onPlaybackStopped); - Events.off(player, 'promptskip', onPromptSkip); + Events.off(player, PlayerEvent.PromptSkip, onPromptSkip); Events.off(player, 'volumechange', onVolumeChanged); Events.off(player, 'pause', onPlayPauseStateChanged); Events.off(player, 'unpause', onPlayPauseStateChanged);