-
Notifications
You must be signed in to change notification settings - Fork 59
feat(site): replace home page tech preview player with real player #580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,23 @@ | ||
| import { useStore } from '@nanostores/react'; | ||
| import { FrostedSkin, HlsVideo, MinimalSkin, VideoProvider } from '@videojs/react-preview'; | ||
| import { createPlayer, features, Poster } from '@videojs/react'; | ||
| import { MinimalVideoSkin, Video, VideoSkin } from '@videojs/react/video'; | ||
| import { VJS8_DEMO_VIDEO } from '@/consts'; | ||
| import { skin } from '@/stores/homePageDemos'; | ||
| import '@videojs/react-preview/skins/frosted.css'; | ||
| import '@videojs/react-preview/skins/minimal.css'; | ||
| import '@videojs/react/video/skin.css'; | ||
| import '@videojs/react/video/minimal-skin.css'; | ||
|
|
||
| const Player = createPlayer({ features: [...features.video] }); | ||
|
|
||
| export default function HeroVideo({ className, poster }: { className?: string; poster: string }) { | ||
| const $skin = useStore(skin); | ||
| const SkinComponent = $skin === 'frosted' ? FrostedSkin : MinimalSkin; | ||
| const SkinComponent = $skin === 'frosted' ? VideoSkin : MinimalVideoSkin; | ||
|
|
||
| return ( | ||
| <VideoProvider> | ||
| <Player.Provider> | ||
| <SkinComponent className={className}> | ||
| <HlsVideo | ||
| // @ts-expect-error -- types are incorrect | ||
| src={VJS8_DEMO_VIDEO.hls} | ||
| poster={poster} | ||
| playsInline | ||
| /> | ||
| <Video src={VJS8_DEMO_VIDEO.mp4} playsInline /> | ||
| <Poster src={poster} /> | ||
| </SkinComponent> | ||
| </VideoProvider> | ||
| </Player.Provider> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,100 +1,8 @@ | ||
| --- | ||
| title: Customize skins | ||
| description: Learn how to customize Video.js v10 skins by copying and modifying them | ||
| description: Learn how to customize Video.js skins | ||
| --- | ||
|
|
||
| import FrameworkCase from '@/components/docs/FrameworkCase.astro'; | ||
| import ServerCode from '@/components/Code/ServerCode.astro'; | ||
| import { TabsRoot, TabsList, TabsPanel, Tab } from '@/components/Tabs.tsx'; | ||
| import { | ||
| generateHTMLCSS, | ||
| generateHTMLJS, | ||
| generateHTMLMarkup, | ||
| generateReactComponent, | ||
| generateReactCSS, | ||
| } from '@/utils/ejectCodeGenerator'; | ||
|
|
||
|
|
||
| Video.js v10 comes with pre-built skins like Frosted and Minimal, but you can fully customize them by "ejecting" the code and making it your own. | ||
|
|
||
| While eventually we'll have a CLI that'll eject skins in your preferred framework and style, for now we invite you to try it out with these copy-paste-ready implementations. | ||
|
|
||
| ## Frosted skin | ||
|
|
||
| <FrameworkCase frameworks={["react"]}> | ||
|
|
||
| <TabsRoot client:idle> | ||
| <TabsList client:idle label="Frosted React implementation"> | ||
| <Tab client:idle value="component" initial>FrostedSkin.tsx</Tab> | ||
| <Tab client:idle value="css">frosted.css</Tab> | ||
| </TabsList> | ||
| <TabsPanel client:idle value="component" initial> | ||
| <ServerCode code={generateReactComponent('frosted')} lang="tsx" /> | ||
| </TabsPanel> | ||
| <TabsPanel client:idle value="css"> | ||
| <ServerCode code={generateReactCSS('frosted')} lang="css" /> | ||
| </TabsPanel> | ||
| </TabsRoot> | ||
|
|
||
| </FrameworkCase> | ||
|
|
||
| <FrameworkCase frameworks={["html"]}> | ||
|
|
||
| <TabsRoot client:idle> | ||
| <TabsList client:idle label="Frosted HTML implementation"> | ||
| <Tab client:idle value="markup" initial>HTML</Tab> | ||
| <Tab client:idle value="js">JS</Tab> | ||
| <Tab client:idle value="css">CSS</Tab> | ||
| </TabsList> | ||
| <TabsPanel client:idle value="markup" initial> | ||
| <ServerCode code={generateHTMLMarkup('frosted')} lang="html" /> | ||
| </TabsPanel> | ||
| <TabsPanel client:idle value="js"> | ||
| <ServerCode code={generateHTMLJS('frosted')} lang="typescript" /> | ||
| </TabsPanel> | ||
| <TabsPanel client:idle value="css"> | ||
| <ServerCode code={generateHTMLCSS('frosted')} lang="css" /> | ||
| </TabsPanel> | ||
| </TabsRoot> | ||
|
|
||
| </FrameworkCase> | ||
|
|
||
| ## Minimal skin | ||
|
|
||
| <FrameworkCase frameworks={["react"]}> | ||
|
|
||
| <TabsRoot client:idle> | ||
| <TabsList client:idle label="Minimal React implementation"> | ||
| <Tab client:idle value="react" initial>MinimalSkin.tsx</Tab> | ||
| <Tab client:idle value="css">minimal.css</Tab> | ||
| </TabsList> | ||
| <TabsPanel client:idle value="react" initial> | ||
| <ServerCode code={generateReactComponent('minimal')} lang="tsx" /> | ||
| </TabsPanel> | ||
| <TabsPanel client:idle value="css"> | ||
| <ServerCode code={generateReactCSS('minimal')} lang="css" /> | ||
| </TabsPanel> | ||
| </TabsRoot> | ||
|
|
||
| </FrameworkCase> | ||
|
|
||
| <FrameworkCase frameworks={["html"]}> | ||
|
|
||
| <TabsRoot client:idle> | ||
| <TabsList client:idle label="Minimal HTML implementation"> | ||
| <Tab client:idle value="html" initial>HTML</Tab> | ||
| <Tab client:idle value="js">JS</Tab> | ||
| <Tab client:idle value="css">CSS</Tab> | ||
| </TabsList> | ||
| <TabsPanel client:idle value="html" initial> | ||
| <ServerCode code={generateHTMLMarkup('minimal')} lang="html" /> | ||
| </TabsPanel> | ||
| <TabsPanel client:idle value="js"> | ||
| <ServerCode code={generateHTMLJS('minimal')} lang="typescript" /> | ||
| </TabsPanel> | ||
| <TabsPanel client:idle value="css"> | ||
| <ServerCode code={generateHTMLCSS('minimal')} lang="css" /> | ||
| </TabsPanel> | ||
| </TabsRoot> | ||
|
|
||
| </FrameworkCase> | ||
| 🚧 Under construction 🚧 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting jQuery vibes with the
$😄