@instructure/studio-player 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/StudioPlayer/StudioPlayer.d.ts +10 -0
- package/dist/StudioPlayer/StudioPlayerContext.d.ts +11 -0
- package/dist/StudioPlayer/components/BufferingIndicator/BufferingIndicator.d.ts +1 -0
- package/dist/StudioPlayer/components/CaptionsButton/CaptionsButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CaptionsOverlay/CaptionsOverlay.d.ts +5 -0
- package/dist/StudioPlayer/components/ControlsLayout/ControlsLayout.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/CustomSettingsMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/CustomSettingsMenuContext.d.ts +8 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/CaptionsMenu/CaptionsFontSizeMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/CaptionsMenu/CaptionsLanguageMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/CaptionsMenu/CaptionsMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/MainMenu/MainMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/QualityMenu/QualityMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/SpeedMenu/SpeedMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/BaseButton.d.ts +8 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/CaptionsButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/CaptionsFontSizeButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/CaptionsLanguageButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/QualityButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/SpeedButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/useCallbackOnEsc.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/useCustomSettingsMenu.d.ts +18 -0
- package/dist/StudioPlayer/components/FeedbackOverlay/FeedbackIcon.d.ts +1 -0
- package/dist/StudioPlayer/components/FeedbackOverlay/FeedbackMessage.d.ts +1 -0
- package/dist/StudioPlayer/components/FeedbackOverlay/FeedbackOverlay.d.ts +1 -0
- package/dist/StudioPlayer/components/FeedbackOverlay/createFeedbackComponent.d.ts +1 -0
- package/dist/StudioPlayer/components/FullscreenButton/FullscreenButton.d.ts +1 -0
- package/dist/StudioPlayer/components/GesturesContainer/GesturesContainer.d.ts +1 -0
- package/dist/StudioPlayer/components/PlayPauseButton/PlayPauseButton.d.ts +1 -0
- package/dist/StudioPlayer/components/PosterContainer/PosterContainer.d.ts +4 -0
- package/dist/StudioPlayer/components/SmallLayoutOverlay/SmallLayoutOverlay.d.ts +1 -0
- package/dist/StudioPlayer/components/TimeIndicator/TimeIndicator.d.ts +1 -0
- package/dist/StudioPlayer/components/TimeLine/TimeLine.d.ts +4 -0
- package/dist/StudioPlayer/components/VolumeMenu/VolumeMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/index.d.ts +14 -0
- package/dist/StudioPlayer/shortcuts.d.ts +2 -0
- package/dist/constants.d.ts +5 -0
- package/dist/errors-DCJKAXTz.js +70 -0
- package/dist/index-BM9a_WKH.js +33480 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/prod-DTLJXtPo.js +994 -0
- package/dist/srt-parser-CWqahKwO.js +27 -0
- package/dist/ssa-parser-BqjjKy4M.js +209 -0
- package/dist/studio-player.es.js +6 -0
- package/dist/types.d.ts +6 -0
- package/dist/vidstack-B-YW57m0-DZMwUKSQ.js +140 -0
- package/dist/vidstack-BFbyAy5g-DqVWIlTG.js +378 -0
- package/dist/vidstack-BGEqnOoX-BiZsT73r.js +434 -0
- package/dist/vidstack-CC0Rsbn0-Cf76Gp3K.js +32 -0
- package/dist/vidstack-CbSFenOv-DX2VhxT6.js +60 -0
- package/dist/vidstack-D2cUZes0-BnrvKkrf.js +237 -0
- package/dist/vidstack-Xu8hy52p-DHV2kI-e.js +323 -0
- package/dist/vidstack-Zc3I7oOd-DDsBgkhs.js +31 -0
- package/dist/vidstack-krOAtKMi-B4IZWKdc.js +29 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Instructure, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# studio-player
|
|
2
|
+
|
|
3
|
+
## Sources
|
|
4
|
+
|
|
5
|
+
- `sources` renamed to `src`: can be an url or an array of objects with the following props:
|
|
6
|
+
- `src` `type` `width` `height`
|
|
7
|
+
- instead of `label` you have to provide the `width` and `height`, this is important, because the player will be able to collect the qualities based on these.
|
|
8
|
+
|
|
9
|
+
example:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
src: 'my-video1.mp4',
|
|
15
|
+
type: 'video/mp4',
|
|
16
|
+
width: 1920,
|
|
17
|
+
height: 1080,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
src: 'my-video2.mp4',
|
|
21
|
+
type: 'video/mp4',
|
|
22
|
+
width: 1280,
|
|
23
|
+
height: 720,
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Captions
|
|
29
|
+
|
|
30
|
+
- `tracks` has been renamed to `captions`
|
|
31
|
+
- `id` and `kind` is not used
|
|
32
|
+
- `type` should be the subtitle format, `vtt` or `srt`
|
|
33
|
+
|
|
34
|
+
example:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
[
|
|
38
|
+
{
|
|
39
|
+
src: 'my-captions-en.srt',
|
|
40
|
+
label: 'English',
|
|
41
|
+
language: 'en',
|
|
42
|
+
type: 'srt',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
src: 'my-captions-es.srt',
|
|
46
|
+
label: 'Spanish',
|
|
47
|
+
language: 'es',
|
|
48
|
+
type: 'srt',
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Deprecated props compared to old Media Player
|
|
54
|
+
|
|
55
|
+
these props are no longer used and you can remove them from the code:
|
|
56
|
+
|
|
57
|
+
- `onLoadedMetadata`
|
|
58
|
+
- `captionPosition`
|
|
59
|
+
- `autoShowCaption`
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MediaPlayerProps } from '@vidstack/react';
|
|
2
|
+
import { CaptionMetaData } from '@/types';
|
|
3
|
+
export type StudioPlayerProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
src: MediaPlayerProps['src'];
|
|
6
|
+
captions?: CaptionMetaData[];
|
|
7
|
+
thumbnail?: string;
|
|
8
|
+
hideFullScreen?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function StudioPlayer({ title, src, captions, thumbnail, hideFullScreen, }: StudioPlayerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { CAPTION_FONT_SIZE_MULTIPLIERS } from '@/constants';
|
|
3
|
+
export type StudioPlayerState = {
|
|
4
|
+
captionsFontSizeMultiplier: (typeof CAPTION_FONT_SIZE_MULTIPLIERS)[number];
|
|
5
|
+
};
|
|
6
|
+
export type StudioPlayerContextType = {
|
|
7
|
+
hideFullScreen: boolean;
|
|
8
|
+
state: StudioPlayerState;
|
|
9
|
+
setState: Dispatch<SetStateAction<StudioPlayerState>>;
|
|
10
|
+
};
|
|
11
|
+
export declare const StudioPlayerContext: import('react').Context<StudioPlayerContextType | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function BufferingIndicator(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptionsButton(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ControlsLayout(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CustomSettingsMenu(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SettingsMenuState } from './useCustomSettingsMenu';
|
|
2
|
+
export type CustomSettingsMenuContextType = {
|
|
3
|
+
setPage: (page: SettingsMenuState) => void;
|
|
4
|
+
backToMain: () => void;
|
|
5
|
+
backToCaptions: () => void;
|
|
6
|
+
toggle: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const CustomSettingsMenuContext: import('react').Context<CustomSettingsMenuContextType | null>;
|
package/dist/StudioPlayer/components/CustomSettingsMenu/menus/CaptionsMenu/CaptionsFontSizeMenu.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptionsFontSizeMenu(): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/StudioPlayer/components/CustomSettingsMenu/menus/CaptionsMenu/CaptionsLanguageMenu.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptionsLanguageMenu(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptionsMenu(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MainMenu(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function QualityMenu(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SpeedMenu(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type BaseButtonProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
hint: string;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
Icon?: (props: React.SVGProps<SVGSVGElement>) => React.ReactElement;
|
|
6
|
+
};
|
|
7
|
+
export declare function BaseButton({ label, hint, onClick, Icon }: BaseButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptionsButton(): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/CaptionsFontSizeButton.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptionsFontSizeButton(): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/CaptionsLanguageButton.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptionsLanguageButton(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function QualityButton(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SpeedButton(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCallbackOnEsc(callback?: () => void): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useFloating, useInteractions } from '@floating-ui/react';
|
|
2
|
+
export type SettingsMenuState = 'main' | 'speed' | 'captions' | 'captionLanguage' | 'captionFontSize' | 'quality';
|
|
3
|
+
type useCustomSettingsMenuReturnType = {
|
|
4
|
+
Page: React.FunctionComponent;
|
|
5
|
+
open: boolean;
|
|
6
|
+
toggle: () => void;
|
|
7
|
+
setPage: (page: SettingsMenuState) => void;
|
|
8
|
+
backToCaptions: () => void;
|
|
9
|
+
backToMain: () => void;
|
|
10
|
+
arrowRef: React.LegacyRef<SVGSVGElement> | undefined;
|
|
11
|
+
refs: ReturnType<typeof useFloating>['refs'];
|
|
12
|
+
floatingStyles: ReturnType<typeof useFloating>['floatingStyles'];
|
|
13
|
+
context: ReturnType<typeof useFloating>['context'];
|
|
14
|
+
getReferenceProps: ReturnType<typeof useInteractions>['getReferenceProps'];
|
|
15
|
+
getFloatingProps: ReturnType<typeof useInteractions>['getFloatingProps'];
|
|
16
|
+
};
|
|
17
|
+
export declare function useCustomSettingsMenu(): useCustomSettingsMenuReturnType;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FeedbackIcon(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FeedbackMessage(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FeedbackOverlay(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createFeedbackComponent(Component: React.FunctionComponent, timeout?: number): () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FullscreenButton(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function GesturesContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PlayPauseButton(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SmallLayoutOverlay(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TimeIndicator(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function VolumeMenu(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './BufferingIndicator/BufferingIndicator';
|
|
2
|
+
export * from './CaptionsButton/CaptionsButton';
|
|
3
|
+
export * from './CaptionsOverlay/CaptionsOverlay';
|
|
4
|
+
export * from './ControlsLayout/ControlsLayout';
|
|
5
|
+
export * from './CustomSettingsMenu/CustomSettingsMenu';
|
|
6
|
+
export * from './FeedbackOverlay/FeedbackOverlay';
|
|
7
|
+
export * from './FullscreenButton/FullscreenButton';
|
|
8
|
+
export * from './GesturesContainer/GesturesContainer';
|
|
9
|
+
export * from './PlayPauseButton/PlayPauseButton';
|
|
10
|
+
export * from './PosterContainer/PosterContainer';
|
|
11
|
+
export * from './SmallLayoutOverlay/SmallLayoutOverlay';
|
|
12
|
+
export * from './TimeIndicator/TimeIndicator';
|
|
13
|
+
export * from './TimeLine/TimeLine';
|
|
14
|
+
export * from './VolumeMenu/VolumeMenu';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { P as a, c as t } from "./prod-DTLJXtPo.js";
|
|
2
|
+
const i = {
|
|
3
|
+
r() {
|
|
4
|
+
return new a({
|
|
5
|
+
code: t.BadSignature,
|
|
6
|
+
reason: "missing WEBVTT file header",
|
|
7
|
+
line: 1
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
s(n, e) {
|
|
11
|
+
return new a({
|
|
12
|
+
code: t.BadTimestamp,
|
|
13
|
+
reason: `cue start timestamp \`${n}\` is invalid on line ${e}`,
|
|
14
|
+
line: e
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
t(n, e) {
|
|
18
|
+
return new a({
|
|
19
|
+
code: t.BadTimestamp,
|
|
20
|
+
reason: `cue end timestamp \`${n}\` is invalid on line ${e}`,
|
|
21
|
+
line: e
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
u(n, e, r) {
|
|
25
|
+
return new a({
|
|
26
|
+
code: t.BadTimestamp,
|
|
27
|
+
reason: `cue end timestamp \`${e}\` is greater than start \`${n}\` on line ${r}`,
|
|
28
|
+
line: r
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
y(n, e, r) {
|
|
32
|
+
return new a({
|
|
33
|
+
code: t.BadSettingValue,
|
|
34
|
+
reason: `invalid value for cue setting \`${n}\` on line ${r} (value: ${e})`,
|
|
35
|
+
line: r
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
x(n, e, r) {
|
|
39
|
+
return new a({
|
|
40
|
+
code: t.UnknownSetting,
|
|
41
|
+
reason: `unknown cue setting \`${n}\` on line ${r} (value: ${e})`,
|
|
42
|
+
line: r
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
w(n, e, r) {
|
|
46
|
+
return new a({
|
|
47
|
+
code: t.BadSettingValue,
|
|
48
|
+
reason: `invalid value for region setting \`${n}\` on line ${r} (value: ${e})`,
|
|
49
|
+
line: r
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
v(n, e, r) {
|
|
53
|
+
return new a({
|
|
54
|
+
code: t.UnknownSetting,
|
|
55
|
+
reason: `unknown region setting \`${n}\` on line ${r} (value: ${e})`,
|
|
56
|
+
line: r
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
// SSA-specific errors
|
|
60
|
+
T(n, e) {
|
|
61
|
+
return new a({
|
|
62
|
+
code: t.BadFormat,
|
|
63
|
+
reason: `format missing for \`${n}\` block on line ${e}`,
|
|
64
|
+
line: e
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
i as ParseErrorBuilder
|
|
70
|
+
};
|