Use PlayerEvent constant

This commit is contained in:
viown 2024-10-24 12:37:38 +03:00
parent 459d0d7d9a
commit 11e4549b48
2 changed files with 5 additions and 3 deletions

View File

@ -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]);
}
};

View File

@ -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);