Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/onboarding/VideoSection.tsx
2500 views
1
/**
2
* Copyright (c) 2024 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { MuxPlayerProps } from "@mux/mux-player-react";
8
import { cn } from "@podkit/lib/cn";
9
import { SkeletonBlock } from "@podkit/loading/Skeleton";
10
import { lazy, Suspense, FC } from "react";
11
12
const MuxPlayer = lazy(() => import("@mux/mux-player-react"));
13
14
type Props = {
15
playbackId: string;
16
metadataVideoTitle: string;
17
poster?: string;
18
className?: string;
19
playerProps?: MuxPlayerProps;
20
};
21
export const VideoSection: FC<Props> = ({ playbackId, metadataVideoTitle, poster, className, playerProps }) => (
22
<div
23
className={cn(
24
"flex w-full flex-col items-start justify-start overflow-hidden rounded-md drop-shadow-xl",
25
className,
26
)}
27
>
28
<Suspense fallback={<SkeletonBlock ready={false} className="max-h-[300px] w-full" />}>
29
<MuxPlayer
30
aria-label={"Video: " + metadataVideoTitle}
31
streamType="on-demand"
32
playbackId={playbackId}
33
metadataVideoTitle={metadataVideoTitle}
34
primaryColor="#FFFFFF"
35
secondaryColor="#000000"
36
accentColor="#FF8A00"
37
defaultHiddenCaptions={playerProps?.defaultHiddenCaptions ?? true}
38
poster={poster}
39
style={{
40
aspectRatio: "16 / 9",
41
backgroundColor: "var(--surface-tertiary)",
42
borderRadius: "6px",
43
}}
44
preload={"metadata"}
45
disableCookies
46
disableTracking
47
{...playerProps}
48
/>
49
</Suspense>
50
</div>
51
);
52
53