feat(player): pass playlist headers to external players

This commit is contained in:
4gray committed 2025-11-08 10:22:27 +01:00
1 parent 3eed15d806
commit 6f9e8aa64e
5 files changed
+54 -7

No files matched your search

+10 -1
View File
@@ -26,7 +26,10 @@ export class PlayerService {
title: string,
thumbnail?: string,
hideExternalInfoDialog = true,
isLiveContent = false
isLiveContent = false,
userAgent?: string,
referer?: string,
origin?: string
) {
const player = this.settingsStore.player() ?? VideoPlayer.VideoJs;
@@ -39,6 +42,9 @@ export class PlayerService {
mpvPlayerPath: this.settingsStore.mpvPlayerPath(),
title,
thumbnail,
'user-agent': userAgent,
referer: referer,
origin: origin,
});
} else if (player === VideoPlayer.VLC) {
if (!hideExternalInfoDialog) {
@@ -49,6 +55,9 @@ export class PlayerService {
vlcPlayerPath: this.settingsStore.vlcPlayerPath(),
title,
thumbnail,
'user-agent': userAgent,
referer: referer,
origin: origin,
});
} else if (!isLiveContent) {
this.dialog.open<PlayerDialogComponent, PlayerDialogData>(
+11 -1
View File
@@ -479,7 +479,17 @@ export const StalkerStore = signalStore(
cover: thumbnail,
title,
});
playerService.openPlayer(url, title, thumbnail);
const playlist = this.currentPlaylist();
playerService.openPlayer(
url,
title,
thumbnail,
true,
false,
playlist?.userAgent,
playlist?.referrer,
playlist?.origin
);
},
addToRecentlyViewed(item: any) {
console.log('Adding to recently viewed', item);
@@ -844,13 +844,17 @@ export const XtreamStore = signalStore(
title: string,
thumbnail: string = null
) {
const playlist = store.currentPlaylist();
playerService.openPlayer(
streamUrl,
title,
thumbnail,
localStorage.getItem('hideExternalInfoDialog') ===
'true',
store.selectedContentType() === 'live'
store.selectedContentType() === 'live',
playlist?.userAgent,
playlist?.referrer,
playlist?.origin
);
},
addToFavorites(item: any) {
@@ -345,12 +345,18 @@ export class XtreamMainContainerComponent implements OnInit, OnDestroy {
openPlayer(streamUrl: string, title: string) {
this.streamUrl = streamUrl;
this.player = this.settingsStore.player() ?? VideoPlayer.VideoJs;
const playlist = this.currentPlaylist() as Playlist;
if (this.player === VideoPlayer.MPV) {
if (!this.hideExternalInfoDialog())
this.dialog.open(ExternalPlayerInfoDialogComponent);
this.dataService.sendIpcEvent(OPEN_MPV_PLAYER, {
url: streamUrl,
mpvPlayerPath: this.settingsStore.mpvPlayerPath(),
title,
'user-agent': playlist?.userAgent,
referer: playlist?.referrer,
origin: playlist?.origin,
});
} else if (this.player === VideoPlayer.VLC) {
if (!this.hideExternalInfoDialog())
@@ -358,6 +364,10 @@ export class XtreamMainContainerComponent implements OnInit, OnDestroy {
this.dataService.sendIpcEvent(OPEN_VLC_PLAYER, {
url: streamUrl,
vlcPlayerPath: this.settingsStore.vlcPlayerPath(),
title,
'user-agent': playlist?.userAgent,
referer: playlist?.referrer,
origin: playlist?.origin,
});
} else {
if (this.selectedContentType !== ContentType.ITV) {
@@ -384,14 +394,26 @@ export class XtreamMainContainerComponent implements OnInit, OnDestroy {
}
playEpisode(episode: XtreamSerieEpisode) {
const { serverUrl, username, password } =
this.currentPlaylist() as Playlist;
const playlist = this.currentPlaylist() as Playlist;
const { serverUrl, username, password, userAgent, referrer, origin } = playlist;
const player = this.settingsStore.player();
const streamUrl = `${serverUrl}/series/${username}/${password}/${episode.id}.${episode.container_extension}`;
if (player === VideoPlayer.MPV) {
this.dataService.sendIpcEvent(OPEN_MPV_PLAYER, { url: streamUrl });
this.dataService.sendIpcEvent(OPEN_MPV_PLAYER, {
url: streamUrl,
title: episode.title,
'user-agent': userAgent,
referer: referrer,
origin: origin,
});
} else if (player === VideoPlayer.VLC) {
this.dataService.sendIpcEvent(OPEN_VLC_PLAYER, { url: streamUrl });
this.dataService.sendIpcEvent(OPEN_VLC_PLAYER, {
url: streamUrl,
title: episode.title,
'user-agent': userAgent,
referer: referrer,
origin: origin,
});
} else {
this.dialog.open(PlayerDialogComponent, {
data: { streamUrl, player, title: episode.title },
@@ -23,6 +23,8 @@ export interface Playlist {
count: number;
url?: string;
userAgent?: string;
referrer?: string;
origin?: string;
filePath?: string;
autoRefresh: boolean;
updateDate?: number;