Bug: Mismatch between docs, TS types, and behavior for cuepoints and chapters #947
Closed
1 task done
Labels
bug
Something isn't working
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
Is there an existing issue for this?
Which Mux Elements/Packages does this apply to? Select all that apply
mux-player-react
Which browsers are you using?
Safari
Which operating systems are you using?
macOS
Description
The types described in the docs don't match up with the types in TypeScript for
addCuePoints
andaddChapters
in@mux/mux-player-react
Reduced test case
https://codesandbox.io/p/sandbox/dreamy-pascal-637nl9?file=%2Fsrc%2FApp.tsx%3A9%2C45
Steps to reproduce
Cue points
{ startTime: number; endTime?: number; value: any; }
toaddCuePoints
. TypeScript yells (even though this type is in the Mux Docs).{ time: number; value: any }
toaddCuePoints
. TypeScript does not yell (even though this type is not in the Mux Docs)Chapters
{ startTime: number; endTime?: number; value: any; }
toaddChapters
. TypeScript yells (even though this type is in the Mux Docs).{ startTime: number; endTime: number; value: any; }
toaddChapters
. TypeScript does not yell.Current Behavior
Cue points
{ startTime: number; endTime?: number; value: any; }
addCuePoints<T = any>(cuePoints: { time: number; value: T; }[]): Promise<TextTrack | undefined>;
{ time: number; value: any }
and it's working as expectedChapters
{ startTime: number; endTime?: number; value: any; }
addChapters(chapters: { startTime: number; endTime: number; value: string; }[]): Promise<TextTrack> | undefined;
. (Notice thatendTime
is required in TS){ startTime: number; value: string }
and it's working as expectedExpected Behavior
I'm assuming the docs are correct here. So...
Cue Points
addCuePoints<T = any>(cuePoints: { startTime: number; endTime?: number; value: T; }[]): Promise<TextTrack | undefined>;
{ time: number; value: T }
should be supported as a legacy option, since that's how Cue Points used to work, right?Chapters
addChapters(chapters: { startTime: number; endTime?: number; value: string; }[]): Promise<TextTrack> | undefined;
Errors
What version of the package are you using?
2.8.0
The text was updated successfully, but these errors were encountered: