@remotion/promo-pages 4.0.364 → 4.0.365
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/dist/Homepage.js +7 -3
- package/dist/Users/jonathanburger/remotion/packages/promo-pages/dist/Homepage.js +7 -3
- package/package.json +10 -10
- package/.turbo/turbo-lint.log +0 -15
- package/.turbo/turbo-make.log +0 -5
- package/bundle.ts +0 -54
- package/eslint.config.mjs +0 -7
- package/server.ts +0 -26
- package/src/cn.ts +0 -6
- package/src/components/Homepage.tsx +0 -87
- package/src/components/TeamPicture.tsx +0 -11
- package/src/components/homepage/BackgroundAnimation.tsx +0 -108
- package/src/components/homepage/ChooseTemplate.tsx +0 -57
- package/src/components/homepage/CommunityStats.tsx +0 -54
- package/src/components/homepage/CommunityStatsItems.tsx +0 -304
- package/src/components/homepage/Counter.tsx +0 -120
- package/src/components/homepage/Demo/Card.tsx +0 -273
- package/src/components/homepage/Demo/Cards.tsx +0 -129
- package/src/components/homepage/Demo/Comp.tsx +0 -157
- package/src/components/homepage/Demo/CurrentCountry.tsx +0 -97
- package/src/components/homepage/Demo/DemoError.tsx +0 -18
- package/src/components/homepage/Demo/DemoErrorIcon.tsx +0 -32
- package/src/components/homepage/Demo/DemoRender.tsx +0 -166
- package/src/components/homepage/Demo/DigitWheel.tsx +0 -179
- package/src/components/homepage/Demo/DisplayedEmoji.tsx +0 -93
- package/src/components/homepage/Demo/DoneCheckmark.tsx +0 -39
- package/src/components/homepage/Demo/DownloadNudge.tsx +0 -62
- package/src/components/homepage/Demo/DragAndDropNudge.tsx +0 -57
- package/src/components/homepage/Demo/EmojiCard.tsx +0 -200
- package/src/components/homepage/Demo/Minus.tsx +0 -21
- package/src/components/homepage/Demo/PlayPauseButton.tsx +0 -66
- package/src/components/homepage/Demo/PlayerControls.tsx +0 -48
- package/src/components/homepage/Demo/PlayerSeekBar.tsx +0 -325
- package/src/components/homepage/Demo/PlayerVolume.tsx +0 -83
- package/src/components/homepage/Demo/Progress.tsx +0 -38
- package/src/components/homepage/Demo/Spinner.tsx +0 -60
- package/src/components/homepage/Demo/Switcher.tsx +0 -54
- package/src/components/homepage/Demo/Temperature.tsx +0 -44
- package/src/components/homepage/Demo/TemperatureNumber.tsx +0 -68
- package/src/components/homepage/Demo/ThemeNudge.tsx +0 -72
- package/src/components/homepage/Demo/TimeDisplay.tsx +0 -43
- package/src/components/homepage/Demo/TrendingRepos.tsx +0 -106
- package/src/components/homepage/Demo/icons.tsx +0 -114
- package/src/components/homepage/Demo/index.tsx +0 -158
- package/src/components/homepage/Demo/math.ts +0 -43
- package/src/components/homepage/Demo/types.ts +0 -6
- package/src/components/homepage/EditorStarterSection.tsx +0 -76
- package/src/components/homepage/EvaluateRemotion.tsx +0 -92
- package/src/components/homepage/FreePricing.tsx +0 -283
- package/src/components/homepage/GetStartedStrip.tsx +0 -77
- package/src/components/homepage/GitHubButton.tsx +0 -23
- package/src/components/homepage/IconForTemplate.tsx +0 -170
- package/src/components/homepage/IfYouKnowReact.tsx +0 -68
- package/src/components/homepage/InfoTooltip.tsx +0 -25
- package/src/components/homepage/MoreTemplatesButton.tsx +0 -29
- package/src/components/homepage/MoreVideoPowerSection.tsx +0 -95
- package/src/components/homepage/MuxVideo.tsx +0 -68
- package/src/components/homepage/NewsletterButton.tsx +0 -89
- package/src/components/homepage/ParameterizeAndEdit.tsx +0 -106
- package/src/components/homepage/Pricing.tsx +0 -49
- package/src/components/homepage/PricingBulletPoint.tsx +0 -50
- package/src/components/homepage/RealMp4Videos.tsx +0 -108
- package/src/components/homepage/Spacer.tsx +0 -5
- package/src/components/homepage/TemplateIcon.tsx +0 -36
- package/src/components/homepage/TextInput.tsx +0 -62
- package/src/components/homepage/TrustedByBanner.tsx +0 -145
- package/src/components/homepage/VideoApps.tsx +0 -231
- package/src/components/homepage/VideoAppsShowcase.tsx +0 -270
- package/src/components/homepage/VideoAppsTitle.tsx +0 -11
- package/src/components/homepage/VideoPlayerWithControls.tsx +0 -189
- package/src/components/homepage/WriteInReact.tsx +0 -34
- package/src/components/homepage/YouAreHere.tsx +0 -30
- package/src/components/homepage/layout/Button.tsx +0 -93
- package/src/components/homepage/layout/colors.ts +0 -17
- package/src/components/homepage/layout/use-color-mode.tsx +0 -44
- package/src/components/homepage/layout/use-el-size.ts +0 -51
- package/src/components/homepage/layout/use-mobile-layout.ts +0 -8
- package/src/components/homepage/video-player.css +0 -24
- package/src/components/icons/blank.tsx +0 -13
- package/src/components/icons/clone.tsx +0 -10
- package/src/components/icons/code-hike.tsx +0 -15
- package/src/components/icons/cubes.tsx +0 -13
- package/src/components/icons/js.tsx +0 -17
- package/src/components/icons/music.tsx +0 -9
- package/src/components/icons/next.tsx +0 -64
- package/src/components/icons/overlay.tsx +0 -24
- package/src/components/icons/recorder.tsx +0 -23
- package/src/components/icons/remix.tsx +0 -27
- package/src/components/icons/skia.tsx +0 -13
- package/src/components/icons/stargazer.tsx +0 -13
- package/src/components/icons/still.tsx +0 -13
- package/src/components/icons/tailwind.tsx +0 -22
- package/src/components/icons/tiktok.tsx +0 -13
- package/src/components/icons/ts.tsx +0 -18
- package/src/components/icons/tts.tsx +0 -13
- package/src/components/icons/undo.tsx +0 -11
- package/src/components/icons/waveform.tsx +0 -13
- package/src/components/team/TeamCards.tsx +0 -167
- package/src/components/team/TitleTeamCards.tsx +0 -22
- package/src/components/team.css +0 -22
- package/src/components/team.tsx +0 -51
- package/src/fonts.css +0 -30
- package/src/index.css +0 -140
- package/src/main.tsx +0 -12
- package/src/team.tsx +0 -12
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -9
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import React, {useEffect, useRef, useState} from 'react';
|
|
2
|
-
|
|
3
|
-
import {IsMutedIcon, NotMutedIcon, PausedIcon, PlayingIcon} from './Demo/icons';
|
|
4
|
-
import {MuxVideo} from './MuxVideo';
|
|
5
|
-
import {SectionTitle} from './VideoAppsTitle';
|
|
6
|
-
|
|
7
|
-
const tabs = [
|
|
8
|
-
'Music visualization',
|
|
9
|
-
'Captions',
|
|
10
|
-
'Screencast',
|
|
11
|
-
'Year in review',
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
const videoApps = [
|
|
15
|
-
{
|
|
16
|
-
title: 'Banger.Show',
|
|
17
|
-
description:
|
|
18
|
-
'The all-in-one 3D visual creation tool for ambitious artists. Seamlessly craft visuals that match your sound and propel your brand forward.',
|
|
19
|
-
link: 'https://banger.show?ref=remotion',
|
|
20
|
-
videoWidth: 1080,
|
|
21
|
-
videoHeight: 1080,
|
|
22
|
-
muxId: 'Kg02XHfkR6x8400BtO4Ica54XlSPimmmTRpqDHHUaeACk',
|
|
23
|
-
buttonText: 'Banger.Show website',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
title: 'Submagic',
|
|
27
|
-
description:
|
|
28
|
-
'A video editor for creating short-form content fast. Designed for creators, teams and agencies, it accelerates video editing with AI-powered features such as descriptions, zooms, sound effects and music.',
|
|
29
|
-
additionalInfo: '',
|
|
30
|
-
link: 'https://www.submagic.co/?ref=remotion',
|
|
31
|
-
videoWidth: 540,
|
|
32
|
-
videoHeight: 1080,
|
|
33
|
-
muxId: 'pxqGEjlBBntnXrEe4v00pYUBw3FPgUPKumfhSym00Vs004',
|
|
34
|
-
buttonText: 'Submagic website',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
title: 'Remotion Recorder',
|
|
38
|
-
description:
|
|
39
|
-
'The Remotion Recorder is a video production tool built entirely in JavaScript. Create high-quality videos that feel native on each platform while only editing them once.',
|
|
40
|
-
link: 'https://www.remotion.dev/recorder',
|
|
41
|
-
videoWidth: 1080,
|
|
42
|
-
videoHeight: 1080,
|
|
43
|
-
muxId: 'pHlwqDZFUH00Aubo9M001ty3gZ6YW8z689XTd9R479ayE',
|
|
44
|
-
buttonText: 'More infos',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
title: 'GitHub Unwrapped',
|
|
48
|
-
description:
|
|
49
|
-
'Your coding year in review. Get a personalized video of your GitHub activity.',
|
|
50
|
-
additionalInfo:
|
|
51
|
-
'Uncover your go-to language, peak productivity hours, and track your GitHub impact – all in one video.',
|
|
52
|
-
link: 'https://githubunwrapped.com/',
|
|
53
|
-
videoWidth: 1080,
|
|
54
|
-
videoHeight: 1080,
|
|
55
|
-
muxId: 'OwQFvqomOR00q6yj5SWwaA7DBg01NaCPKcOvczoZqCty00',
|
|
56
|
-
buttonText: 'GitHub Unwrapped website',
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
const icon: React.CSSProperties = {
|
|
61
|
-
height: 16,
|
|
62
|
-
marginLeft: 10,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const VideoAppsShowcase: React.FC = () => {
|
|
66
|
-
const [activeTab, setActiveTab] = useState(0);
|
|
67
|
-
const [isMuted, setIsMuted] = useState(true);
|
|
68
|
-
const [isPlaying, setIsPlaying] = useState(false);
|
|
69
|
-
const videoRef = useRef<HTMLVideoElement>(null);
|
|
70
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
71
|
-
|
|
72
|
-
// Remove the intersection observer autoplay logic
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
const video = videoRef.current;
|
|
75
|
-
if (video) {
|
|
76
|
-
video.pause();
|
|
77
|
-
setIsPlaying(false);
|
|
78
|
-
video.currentTime = 0;
|
|
79
|
-
video.load();
|
|
80
|
-
}
|
|
81
|
-
}, [activeTab]);
|
|
82
|
-
|
|
83
|
-
const handlePlayPause = () => {
|
|
84
|
-
if (videoRef.current) {
|
|
85
|
-
if (videoRef.current.paused) {
|
|
86
|
-
const playPromise = videoRef.current.play();
|
|
87
|
-
|
|
88
|
-
if (playPromise !== undefined) {
|
|
89
|
-
playPromise
|
|
90
|
-
.then(() => {
|
|
91
|
-
setIsPlaying(true);
|
|
92
|
-
})
|
|
93
|
-
.catch((error) => {
|
|
94
|
-
// eslint-disable-next-line no-console
|
|
95
|
-
console.error('Playback error:', error);
|
|
96
|
-
setIsPlaying(false);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
videoRef.current.pause();
|
|
101
|
-
setIsPlaying(false);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const handleMuteToggle = () => {
|
|
107
|
-
if (videoRef.current) {
|
|
108
|
-
const newMutedState = !videoRef.current.muted;
|
|
109
|
-
videoRef.current.muted = newMutedState;
|
|
110
|
-
setIsMuted(newMutedState);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<div ref={containerRef}>
|
|
116
|
-
<SectionTitle>Use Cases</SectionTitle>
|
|
117
|
-
<div
|
|
118
|
-
className={
|
|
119
|
-
'grid justify-center grid-flow-col grid-rows-1 gap-2.5 justify-self-center mb-4 w-[90vw] md:w-auto -mt-4'
|
|
120
|
-
}
|
|
121
|
-
>
|
|
122
|
-
{tabs.map((tab, index) => (
|
|
123
|
-
<button
|
|
124
|
-
key={tab}
|
|
125
|
-
type="button"
|
|
126
|
-
data-active={index === activeTab}
|
|
127
|
-
className={`bg-transparent border-none m-0 p-0 lg:mx-3 my-4 cursor-pointer text-base fontbrand font-bold transition-colors text-muted data-[active=true]:text-brand`}
|
|
128
|
-
onClick={() => setActiveTab(index)}
|
|
129
|
-
>
|
|
130
|
-
{tab}
|
|
131
|
-
</button>
|
|
132
|
-
))}
|
|
133
|
-
</div>
|
|
134
|
-
<div className={'card flex p-0 overflow-hidden'}>
|
|
135
|
-
<div className={'flex-1 flex flex-col lg:flex-row justify-center'}>
|
|
136
|
-
<div
|
|
137
|
-
className={
|
|
138
|
-
'w-full max-w-[500px] aspect-square relative overflow-hidden bg-[#eee] cursor-pointer'
|
|
139
|
-
}
|
|
140
|
-
onClick={handlePlayPause}
|
|
141
|
-
>
|
|
142
|
-
<MuxVideo
|
|
143
|
-
ref={videoRef}
|
|
144
|
-
muxId={videoApps[activeTab].muxId}
|
|
145
|
-
className={
|
|
146
|
-
'absolute left-0 top-0 w-full h-full object-contain rounded-sm rounded-tr-none rounded-br-none'
|
|
147
|
-
}
|
|
148
|
-
loop
|
|
149
|
-
playsInline
|
|
150
|
-
muted={isMuted}
|
|
151
|
-
/>
|
|
152
|
-
|
|
153
|
-
{/* Play/Pause Button - bottom left corner */}
|
|
154
|
-
<button
|
|
155
|
-
type="button"
|
|
156
|
-
className={
|
|
157
|
-
'absolute bottom-2.5 left-2.5 bg-white text-black rounded-full w-8 h-8 flex justify-center items-center text-base cursor-pointer transition-colors border-2 border-black border-solid'
|
|
158
|
-
}
|
|
159
|
-
onClick={(e) => {
|
|
160
|
-
e.stopPropagation();
|
|
161
|
-
handlePlayPause();
|
|
162
|
-
}}
|
|
163
|
-
>
|
|
164
|
-
{isPlaying ? (
|
|
165
|
-
<PlayingIcon
|
|
166
|
-
style={{
|
|
167
|
-
width: 12,
|
|
168
|
-
height: 20,
|
|
169
|
-
marginLeft: '2px',
|
|
170
|
-
marginTop: '1px',
|
|
171
|
-
}}
|
|
172
|
-
/>
|
|
173
|
-
) : (
|
|
174
|
-
<PausedIcon
|
|
175
|
-
style={{
|
|
176
|
-
width: 14,
|
|
177
|
-
height: 16,
|
|
178
|
-
marginLeft: '2px',
|
|
179
|
-
marginTop: '0.5px',
|
|
180
|
-
}}
|
|
181
|
-
/>
|
|
182
|
-
)}
|
|
183
|
-
</button>
|
|
184
|
-
|
|
185
|
-
{/* Mute/Unmute Button - bottom right corner */}
|
|
186
|
-
<button
|
|
187
|
-
type="button"
|
|
188
|
-
className={
|
|
189
|
-
'absolute bottom-2.5 right-2.5 bg-white text-black rounded-full w-8 h-8 flex justify-center items-center text-base cursor-pointer transition-colors border-2 border-black border-solid'
|
|
190
|
-
}
|
|
191
|
-
onClick={(e) => {
|
|
192
|
-
e.stopPropagation();
|
|
193
|
-
handleMuteToggle();
|
|
194
|
-
}}
|
|
195
|
-
>
|
|
196
|
-
{isMuted ? (
|
|
197
|
-
<IsMutedIcon
|
|
198
|
-
style={{
|
|
199
|
-
width: 16,
|
|
200
|
-
height: 16,
|
|
201
|
-
marginTop: '1px',
|
|
202
|
-
}}
|
|
203
|
-
/>
|
|
204
|
-
) : (
|
|
205
|
-
<NotMutedIcon
|
|
206
|
-
style={{
|
|
207
|
-
width: 16,
|
|
208
|
-
height: 16,
|
|
209
|
-
marginTop: '1px',
|
|
210
|
-
}}
|
|
211
|
-
/>
|
|
212
|
-
)}
|
|
213
|
-
</button>
|
|
214
|
-
</div>
|
|
215
|
-
<div className={'p-6 flex-1 flex flex-col h-full'}>
|
|
216
|
-
<div className="text-4xl font-bold fontbrand mt-0">
|
|
217
|
-
{videoApps[activeTab].title}
|
|
218
|
-
</div>
|
|
219
|
-
<div className="text-muted mt-4 text-base fontbrand">
|
|
220
|
-
{videoApps[activeTab].description}
|
|
221
|
-
</div>
|
|
222
|
-
{videoApps[activeTab].additionalInfo ? (
|
|
223
|
-
<div className="text-muted mt-4 text-base fontbrand">
|
|
224
|
-
{videoApps[activeTab].additionalInfo}
|
|
225
|
-
</div>
|
|
226
|
-
) : null}
|
|
227
|
-
<div className="h-5" />
|
|
228
|
-
<a
|
|
229
|
-
className="no-underline text-brand font-brand font-bold inline-flex flex-row items-center"
|
|
230
|
-
href={videoApps[activeTab].link}
|
|
231
|
-
>
|
|
232
|
-
{videoApps[activeTab].buttonText}
|
|
233
|
-
<svg
|
|
234
|
-
style={icon}
|
|
235
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
236
|
-
viewBox="0 0 448 512"
|
|
237
|
-
>
|
|
238
|
-
<path
|
|
239
|
-
fill="currentColor"
|
|
240
|
-
d="M438.6 278.6l-160 160C272.4 444.9 264.2 448 256 448s-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L338.8 288H32C14.33 288 .0016 273.7 .0016 256S14.33 224 32 224h306.8l-105.4-105.4c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l160 160C451.1 245.9 451.1 266.1 438.6 278.6z"
|
|
241
|
-
/>
|
|
242
|
-
</svg>
|
|
243
|
-
</a>
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
</div>
|
|
247
|
-
<div
|
|
248
|
-
style={{
|
|
249
|
-
marginTop: '1rem',
|
|
250
|
-
justifyContent: 'center',
|
|
251
|
-
display: 'flex',
|
|
252
|
-
}}
|
|
253
|
-
>
|
|
254
|
-
<div
|
|
255
|
-
style={{
|
|
256
|
-
fontFamily: 'GTPlanar',
|
|
257
|
-
}}
|
|
258
|
-
>
|
|
259
|
-
For more examples see our{' '}
|
|
260
|
-
<a href="/showcase" className="bluelink">
|
|
261
|
-
Showcase page
|
|
262
|
-
</a>
|
|
263
|
-
.
|
|
264
|
-
</div>
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
);
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
export default VideoAppsShowcase;
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
/* eslint-disable react/require-default-props */
|
|
3
|
-
import Hls from 'hls.js';
|
|
4
|
-
import type Plyr from 'plyr';
|
|
5
|
-
// eslint-disable-next-line no-restricted-imports
|
|
6
|
-
import 'plyr/dist/plyr.css';
|
|
7
|
-
import type {MutableRefObject} from 'react';
|
|
8
|
-
import {forwardRef, useCallback, useEffect, useRef, useState} from 'react';
|
|
9
|
-
import './video-player.css';
|
|
10
|
-
|
|
11
|
-
export interface HTMLVideoElementWithPlyr extends HTMLVideoElement {
|
|
12
|
-
plyr: Plyr;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const useCombinedRefs = function (
|
|
16
|
-
...refs: (
|
|
17
|
-
| ((instance: HTMLVideoElementWithPlyr | null) => void)
|
|
18
|
-
| MutableRefObject<HTMLVideoElementWithPlyr | null>
|
|
19
|
-
| null
|
|
20
|
-
)[]
|
|
21
|
-
): MutableRefObject<HTMLVideoElementWithPlyr | null> {
|
|
22
|
-
const targetRef = useRef(null);
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
refs.forEach((ref) => {
|
|
26
|
-
if (!ref) return;
|
|
27
|
-
|
|
28
|
-
if (typeof ref === 'function') {
|
|
29
|
-
ref(targetRef.current);
|
|
30
|
-
} else {
|
|
31
|
-
ref.current = targetRef.current;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}, [refs]);
|
|
35
|
-
|
|
36
|
-
return targetRef;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/*
|
|
40
|
-
* We need to set the width/height of the player depending on what the dimensions of
|
|
41
|
-
* the underlying video source is.
|
|
42
|
-
*
|
|
43
|
-
* On most platforms we know the dimensions on 'loadedmetadata'
|
|
44
|
-
* On Desktop Safari we don't know the dimensions until 'canplay'
|
|
45
|
-
*
|
|
46
|
-
* At first, I tried to get the dimensions of the video from these callbacks, that worked
|
|
47
|
-
* great except for on moble Safari. On Mobile Safari none of those callbacks fire until
|
|
48
|
-
* there is some user interaction :(
|
|
49
|
-
*
|
|
50
|
-
* BUT! There is a brilliant hack here. We can create a `display: none` `img` element in the
|
|
51
|
-
* DOM, load up the poster image.
|
|
52
|
-
*
|
|
53
|
-
* Since the poster image will have the same dimensions of the video, now we know if the video
|
|
54
|
-
* is vertical and now we can style the proper width/height so the layout doesn't have a sudden
|
|
55
|
-
* jump or resize.
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
type Props = {
|
|
60
|
-
readonly playbackId: string;
|
|
61
|
-
readonly poster: string;
|
|
62
|
-
readonly currentTime?: number;
|
|
63
|
-
readonly onLoaded: () => void;
|
|
64
|
-
readonly onError: (error: ErrorEvent) => void;
|
|
65
|
-
readonly onSize: (dim: {width: number; height: number}) => void;
|
|
66
|
-
readonly autoPlay?: boolean;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
type SizedEvent = {
|
|
70
|
-
target: {
|
|
71
|
-
width: number;
|
|
72
|
-
height: number;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const VideoPlayerWithControls = forwardRef<
|
|
77
|
-
HTMLVideoElementWithPlyr,
|
|
78
|
-
Props
|
|
79
|
-
>(
|
|
80
|
-
(
|
|
81
|
-
{playbackId, poster, currentTime, onLoaded, onError, onSize, autoPlay},
|
|
82
|
-
ref,
|
|
83
|
-
) => {
|
|
84
|
-
const videoRef = useRef<HTMLVideoElementWithPlyr>(null);
|
|
85
|
-
const metaRef = useCombinedRefs(ref, videoRef);
|
|
86
|
-
const playerRef = useRef<Plyr | null>(null);
|
|
87
|
-
const [playerInitTime] = useState(Date.now());
|
|
88
|
-
|
|
89
|
-
const videoError = useCallback(
|
|
90
|
-
(event: ErrorEvent) => onError(event),
|
|
91
|
-
[onError],
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
const onImageLoad = useCallback(
|
|
95
|
-
(event: SizedEvent) => {
|
|
96
|
-
const [w, h] = [event.target.width, event.target.height];
|
|
97
|
-
if (w && h) {
|
|
98
|
-
onSize({width: w, height: h});
|
|
99
|
-
onLoaded();
|
|
100
|
-
} else {
|
|
101
|
-
onLoaded();
|
|
102
|
-
|
|
103
|
-
console.error('Error getting img dimensions', event);
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
[onLoaded, onSize],
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
/*
|
|
110
|
-
* See comment above -- we're loading the poster image just so we can grab the dimensions
|
|
111
|
-
* which determines styles for the player
|
|
112
|
-
*/
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
const img = new Image();
|
|
115
|
-
img.onload = (evt) => onImageLoad(evt as unknown as SizedEvent);
|
|
116
|
-
img.src = poster;
|
|
117
|
-
}, [onImageLoad, poster]);
|
|
118
|
-
|
|
119
|
-
useEffect(() => {
|
|
120
|
-
const video = videoRef.current;
|
|
121
|
-
const src = `https://stream.mux.com/${playbackId}.m3u8`;
|
|
122
|
-
let hls: Hls | null;
|
|
123
|
-
hls = null;
|
|
124
|
-
if (video) {
|
|
125
|
-
video.addEventListener('error', videoError);
|
|
126
|
-
const Plyr = require('plyr');
|
|
127
|
-
playerRef.current = new Plyr(video, {
|
|
128
|
-
previewThumbnails: {
|
|
129
|
-
enabled: true,
|
|
130
|
-
src: `https://image.mux.com/${playbackId}/storyboard.vtt`,
|
|
131
|
-
},
|
|
132
|
-
storage: {enabled: false},
|
|
133
|
-
fullscreen: {
|
|
134
|
-
iosNative: true,
|
|
135
|
-
},
|
|
136
|
-
captions: {active: true, language: 'auto', update: true},
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
|
140
|
-
// This will run in safari, where HLS is supported natively
|
|
141
|
-
video.src = src;
|
|
142
|
-
} else if (Hls.isSupported()) {
|
|
143
|
-
// This will run in all other modern browsers
|
|
144
|
-
hls = new Hls();
|
|
145
|
-
hls.loadSource(src);
|
|
146
|
-
hls.attachMedia(video);
|
|
147
|
-
hls.on(Hls.Events.ERROR, (_event, data) => {
|
|
148
|
-
if (data.fatal) {
|
|
149
|
-
videoError(new ErrorEvent('HLS.js fatal error'));
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
} else {
|
|
153
|
-
console.error(
|
|
154
|
-
'This is an old browser that does not support MSE https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API',
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return () => {
|
|
160
|
-
if (video) {
|
|
161
|
-
video.removeEventListener('error', videoError);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (hls) {
|
|
165
|
-
hls.destroy();
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}, [playbackId, playerInitTime, videoError, videoRef]);
|
|
169
|
-
|
|
170
|
-
useEffect(() => {
|
|
171
|
-
const video = videoRef.current;
|
|
172
|
-
if (currentTime && video) {
|
|
173
|
-
video.currentTime = currentTime;
|
|
174
|
-
}
|
|
175
|
-
}, [currentTime]);
|
|
176
|
-
|
|
177
|
-
return (
|
|
178
|
-
<div className="video-container">
|
|
179
|
-
<video
|
|
180
|
-
ref={metaRef}
|
|
181
|
-
autoPlay={autoPlay}
|
|
182
|
-
poster={poster}
|
|
183
|
-
controls
|
|
184
|
-
playsInline
|
|
185
|
-
/>
|
|
186
|
-
</div>
|
|
187
|
-
);
|
|
188
|
-
},
|
|
189
|
-
);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {ChooseTemplate} from './ChooseTemplate';
|
|
3
|
-
import {GetStarted} from './GetStartedStrip';
|
|
4
|
-
|
|
5
|
-
export const WriteInReact: React.FC = () => {
|
|
6
|
-
return (
|
|
7
|
-
<div>
|
|
8
|
-
<h1
|
|
9
|
-
className="text-5xl lg:text-[5em] text-center fontbrand font-black leading-none "
|
|
10
|
-
style={{
|
|
11
|
-
textShadow: '0 5px 30px var(--background)',
|
|
12
|
-
}}
|
|
13
|
-
>
|
|
14
|
-
Make videos programmatically.
|
|
15
|
-
</h1>
|
|
16
|
-
<p
|
|
17
|
-
style={{
|
|
18
|
-
textShadow: '0 5px 30px var(--background)',
|
|
19
|
-
}}
|
|
20
|
-
className="font-medium text-center text-lg"
|
|
21
|
-
>
|
|
22
|
-
Create real MP4 videos with React. <br />
|
|
23
|
-
Parametrize content, render server-side and build applications.
|
|
24
|
-
</p>
|
|
25
|
-
<br />
|
|
26
|
-
<div>
|
|
27
|
-
<GetStarted />
|
|
28
|
-
</div>
|
|
29
|
-
<br />
|
|
30
|
-
<br />
|
|
31
|
-
<ChooseTemplate />
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const container: React.CSSProperties = {
|
|
4
|
-
width: '100%',
|
|
5
|
-
display: 'inline-flex',
|
|
6
|
-
justifyContent: 'center',
|
|
7
|
-
position: 'relative',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const label: React.CSSProperties = {
|
|
11
|
-
backgroundColor: 'var(--ifm-color-primary)',
|
|
12
|
-
fontWeight: 'bold',
|
|
13
|
-
color: 'white',
|
|
14
|
-
paddingLeft: 8,
|
|
15
|
-
paddingRight: 8,
|
|
16
|
-
paddingTop: 4,
|
|
17
|
-
paddingBottom: 4,
|
|
18
|
-
borderRadius: 6,
|
|
19
|
-
fontSize: 13,
|
|
20
|
-
position: 'absolute',
|
|
21
|
-
marginTop: -25,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const YouAreHere: React.FC = () => {
|
|
25
|
-
return (
|
|
26
|
-
<div style={container}>
|
|
27
|
-
<div style={label}>YOU ARE HERE</div>
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {opacify} from 'polished';
|
|
2
|
-
import type {ButtonHTMLAttributes, DetailedHTMLProps} from 'react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import {cn} from '../../../cn';
|
|
5
|
-
import {RED, UNDERLAY_RED} from './colors';
|
|
6
|
-
|
|
7
|
-
type ExtraProps = {
|
|
8
|
-
readonly size: Size;
|
|
9
|
-
readonly background: string;
|
|
10
|
-
readonly hoverColor?: string;
|
|
11
|
-
readonly color: string;
|
|
12
|
-
readonly loading: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type Size = 'sm' | 'bg';
|
|
16
|
-
|
|
17
|
-
type Props = DetailedHTMLProps<
|
|
18
|
-
ButtonHTMLAttributes<HTMLButtonElement>,
|
|
19
|
-
HTMLButtonElement
|
|
20
|
-
> &
|
|
21
|
-
ExtraProps;
|
|
22
|
-
type MandatoryProps = Omit<ExtraProps, 'background' | 'color' | 'hoverColor'>;
|
|
23
|
-
type PrestyledProps = DetailedHTMLProps<
|
|
24
|
-
ButtonHTMLAttributes<HTMLButtonElement>,
|
|
25
|
-
HTMLButtonElement
|
|
26
|
-
> &
|
|
27
|
-
MandatoryProps;
|
|
28
|
-
|
|
29
|
-
export const Button: React.FC<Props> = (props) => {
|
|
30
|
-
const {children, loading, hoverColor, color, size, className, ...other} =
|
|
31
|
-
props;
|
|
32
|
-
const actualDisabled = other.disabled || loading;
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<button
|
|
36
|
-
type="button"
|
|
37
|
-
className={cn(
|
|
38
|
-
'text-base rounded-lg font-bold appearance-none border-2 border-solid border-black border-b-4 font-sans flex flex-row items-center justify-center ',
|
|
39
|
-
className,
|
|
40
|
-
)}
|
|
41
|
-
disabled={actualDisabled}
|
|
42
|
-
{...other}
|
|
43
|
-
style={{
|
|
44
|
-
...(props.style ?? {}),
|
|
45
|
-
padding:
|
|
46
|
-
props.style?.padding ??
|
|
47
|
-
(props.size === 'sm' ? '10px 16px' : '16px 22px'),
|
|
48
|
-
color: props.color,
|
|
49
|
-
cursor: props.disabled ? 'default' : 'pointer',
|
|
50
|
-
backgroundColor: props.background,
|
|
51
|
-
opacity: props.disabled ? 0.7 : 1,
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
{children}
|
|
55
|
-
</button>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const BlueButton: React.FC<PrestyledProps> = (props) => {
|
|
60
|
-
return <Button {...props} background="var(--blue-underlay)" color="white" />;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const PlainButton: React.FC<PrestyledProps> = (props) => {
|
|
64
|
-
return (
|
|
65
|
-
<Button
|
|
66
|
-
{...props}
|
|
67
|
-
background="var(--plain-button)"
|
|
68
|
-
color="var(--text-color)"
|
|
69
|
-
/>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const RedButton: React.FC<PrestyledProps> = (props) => {
|
|
74
|
-
return (
|
|
75
|
-
<Button
|
|
76
|
-
{...props}
|
|
77
|
-
background={UNDERLAY_RED}
|
|
78
|
-
hoverColor={opacify(0.1, UNDERLAY_RED)}
|
|
79
|
-
color={RED}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const ClearButton: React.FC<PrestyledProps> = (props) => {
|
|
85
|
-
return (
|
|
86
|
-
<Button
|
|
87
|
-
{...props}
|
|
88
|
-
background="transparent"
|
|
89
|
-
color="var(--text-color)"
|
|
90
|
-
hoverColor="var(--clear-hover)"
|
|
91
|
-
/>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {darken, transparentize} from 'polished';
|
|
2
|
-
|
|
3
|
-
export const PALETTE = {
|
|
4
|
-
BOX_STROKE: 'var(--box-stroke)',
|
|
5
|
-
TEXT_COLOR: 'var(--text-color)',
|
|
6
|
-
BORDER_COLOR: 'var(--border-color)',
|
|
7
|
-
BRAND: 'var(--ifm-color-primary)',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const FONTS = {
|
|
11
|
-
GTPLANAR: 'GTPlanar',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const UNDERLAY_BLUE = transparentize(0.85, '#42e9f5');
|
|
15
|
-
export const RED = '#e74c3c';
|
|
16
|
-
export const UNDERLAY_RED = transparentize(0.9, RED);
|
|
17
|
-
export const BLUE_TEXT = darken(0.3, '#42e9f5');
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, {useContext, useMemo, type ReactNode} from 'react';
|
|
9
|
-
|
|
10
|
-
type ContextValue = {
|
|
11
|
-
/** Current color mode. */
|
|
12
|
-
readonly colorMode: ColorMode;
|
|
13
|
-
/** Set new color mode. */
|
|
14
|
-
readonly setColorMode: (colorMode: ColorMode) => void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Context = React.createContext<ContextValue | undefined>(undefined);
|
|
18
|
-
|
|
19
|
-
export type ColorMode = 'light' | 'dark';
|
|
20
|
-
|
|
21
|
-
export const ColorModeProvider = ({
|
|
22
|
-
children,
|
|
23
|
-
colorMode,
|
|
24
|
-
setColorMode,
|
|
25
|
-
}: {
|
|
26
|
-
readonly children: React.ReactNode;
|
|
27
|
-
readonly setColorMode: (colorMode: ColorMode) => void;
|
|
28
|
-
readonly colorMode: ColorMode;
|
|
29
|
-
}): ReactNode => {
|
|
30
|
-
const value: ContextValue = useMemo(() => {
|
|
31
|
-
return {colorMode, setColorMode};
|
|
32
|
-
}, [colorMode, setColorMode]);
|
|
33
|
-
|
|
34
|
-
return <Context.Provider value={value}>{children}</Context.Provider>;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export function useColorMode(): ContextValue {
|
|
38
|
-
const context = useContext(Context);
|
|
39
|
-
if (context === null || context === undefined) {
|
|
40
|
-
throw new Error('ColorModeProvider');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return context;
|
|
44
|
-
}
|