mirror of
https://github.com/jellyfin/jellyfin-chromecast.git
synced 2024-12-04 20:27:35 +00:00
Extend MediaInformationCustomData for Jellyfin custom data
This commit is contained in:
parent
9c767429a5
commit
b29d732706
@ -247,7 +247,7 @@ window.playerManager.addEventListener(
|
||||
() => {
|
||||
setTextTrack(
|
||||
window.playerManager.getMediaInformation()?.customData
|
||||
.subtitleStreamIndex
|
||||
?.subtitleStreamIndex ?? null
|
||||
);
|
||||
}
|
||||
);
|
||||
@ -494,7 +494,7 @@ export async function changeStream(
|
||||
params: any = undefined // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
): Promise<void> {
|
||||
if (
|
||||
window.playerManager.getMediaInformation()?.customData.canClientSeek &&
|
||||
window.playerManager.getMediaInformation()?.customData?.canClientSeek &&
|
||||
params == null
|
||||
) {
|
||||
window.playerManager.seek(ticksToSeconds(ticks));
|
||||
@ -847,7 +847,6 @@ export function createMediaInformation(
|
||||
|
||||
mediaInfo.contentId = streamInfo.url;
|
||||
mediaInfo.contentType = streamInfo.contentType;
|
||||
// TODO make a type for this
|
||||
mediaInfo.customData = {
|
||||
audioStreamIndex: streamInfo.audioStreamIndex,
|
||||
canClientSeek: streamInfo.canClientSeek,
|
||||
|
@ -22,7 +22,7 @@ export function getCurrentPositionTicks(state: PlaybackState): number {
|
||||
window.playerManager.getCurrentTimeSec() * TicksPerSecond;
|
||||
const mediaInformation = window.playerManager.getMediaInformation();
|
||||
|
||||
if (mediaInformation && !mediaInformation.customData.canClientSeek) {
|
||||
if (mediaInformation && !mediaInformation.customData?.canClientSeek) {
|
||||
positionTicks += state.startPositionTicks || 0;
|
||||
}
|
||||
|
||||
|
16
src/types/global.d.ts
vendored
16
src/types/global.d.ts
vendored
@ -103,3 +103,19 @@ declare global {
|
||||
volume: SystemVolumeData;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'chromecast-caf-receiver/cast.framework.messages' {
|
||||
interface MediaInformationCustomData {
|
||||
audioStreamIndex: string;
|
||||
canClientSeek: boolean;
|
||||
canSeek: boolean;
|
||||
itemId: string | undefined;
|
||||
liveStreamId: number;
|
||||
mediaSourceId: number;
|
||||
playMethod: 'DirectStream' | 'Transcode';
|
||||
playSessionId: string;
|
||||
runtimeTicks: number;
|
||||
startPositionTicks: number;
|
||||
subtitleStreamIndex: number;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user