-
Notifications
You must be signed in to change notification settings - Fork 67
feat(core,html,react): vimeo provider with configurable embed params #1538
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
Draft
ronald-urbina
wants to merge
9
commits into
main
Choose a base branch
from
feat/vimeo-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
329407f
feat(core,html,react): vimeo provider with configurable embed params …
ronald-urbina d414050
fix: vimeo sandbox moved to template
ronald-urbina 2d7c72f
fix(core,sandbox): remove stale firefox pip guard and exclude vimeo f…
ronald-urbina cd639d7
fix(core): add missing ready() mock to vimeo makeMockPlayer helper
ronald-urbina 885be05
fix(core): guard state-seeding Promise.all against stale vimeo player
ronald-urbina 9ac9b41
fix(sandbox): add missing vimeo media classes and w-full to minimal t…
ronald-urbina c0c36d6
fix(core): fix vimeo paused seek recovery and missing duration on load
ronald-urbina ce1ef77
fix(core): fix vimeo muted corruption and remount on embed-only param…
ronald-urbina 14ac63f
fix(core): fix vimeo responsive default and remove no-op remount from…
ronald-urbina 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
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
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Sandbox — HTML Vimeo Video</title> | ||
| <link rel="preconnect" href="https://rsms.me/" /> | ||
| <link rel="stylesheet" href="https://rsms.me/inter/inter.css" /> | ||
| </head> | ||
| <body class="font-sans p-2"> | ||
| <div id="root" class="flex justify-center items-center min-h-screen"></div> | ||
| <script type="module" src="./main.ts"></script> | ||
| </body> | ||
| </html> |
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 |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import '@app/styles.css'; | ||
| import '@videojs/html/video/player'; | ||
| import '@videojs/html/media/vimeo-video'; | ||
| import { createHtmlSandboxState, createLatestLoader } from '@app/shared/html/sandbox-state'; | ||
| import { loadVideoSkinTag } from '@app/shared/html/skins'; | ||
| import { | ||
| onAutoplayChange, | ||
| onLoopChange, | ||
| onMutedChange, | ||
| onSkinChange, | ||
| onSourceChange, | ||
| } from '@app/shared/sandbox-listener'; | ||
| import { SOURCES } from '@app/shared/sources'; | ||
|
|
||
| const html = String.raw; | ||
|
|
||
| const state = createHtmlSandboxState(false, true); | ||
| const loadLatest = createLatestLoader(); | ||
|
|
||
| async function render() { | ||
| const tag = await loadLatest(() => loadVideoSkinTag(state.skin, state.styling)); | ||
| if (!tag) return; | ||
|
|
||
| const autoplay = state.autoplay ? 'autoplay' : ''; | ||
| const muted = state.muted ? 'muted' : ''; | ||
| const loop = state.loop ? 'loop' : ''; | ||
|
|
||
| document.getElementById('root')!.innerHTML = html` | ||
| <video-player> | ||
| <${tag} class="aspect-video max-w-4xl mx-auto"> | ||
| <vimeo-video | ||
| src="${SOURCES[state.source].url}" | ||
| ${autoplay} | ||
| ${muted} | ||
| ${loop} | ||
| ></vimeo-video> | ||
| </${tag}> | ||
| </video-player> | ||
| `; | ||
| } | ||
|
|
||
| render(); | ||
|
|
||
| onSkinChange((skin) => { | ||
| state.skin = skin; | ||
| render(); | ||
| }); | ||
|
|
||
| onSourceChange((source) => { | ||
| state.source = source; | ||
| render(); | ||
| }); | ||
|
|
||
| onAutoplayChange((autoplay) => { | ||
| state.autoplay = autoplay; | ||
| render(); | ||
| }); | ||
|
|
||
| onMutedChange((muted) => { | ||
| state.muted = muted; | ||
| render(); | ||
| }); | ||
|
|
||
| onLoopChange((loop) => { | ||
| state.loop = loop; | ||
| render(); | ||
| }); |
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Sandbox — React Vimeo Video</title> | ||
| <link rel="preconnect" href="https://rsms.me/" /> | ||
| <link rel="stylesheet" href="https://rsms.me/inter/inter.css" /> | ||
| </head> | ||
| <body class="font-sans p-2"> | ||
| <div id="root" class="flex justify-center items-center min-h-screen"></div> | ||
| <script type="module" src="./main.tsx"></script> | ||
| </body> | ||
| </html> |
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 |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import '@app/styles.css'; | ||
| import { VideoProvider } from '@app/shared/react/providers'; | ||
| import { VideoSkinComponent } from '@app/shared/react/skins'; | ||
| import { useAutoplay } from '@app/shared/react/use-autoplay'; | ||
| import { useLoop } from '@app/shared/react/use-loop'; | ||
| import { useMuted } from '@app/shared/react/use-muted'; | ||
| import { useSkin } from '@app/shared/react/use-skin'; | ||
| import { useSource } from '@app/shared/react/use-source'; | ||
| import { SOURCES } from '@app/shared/sources'; | ||
| import type { Styling } from '@app/types'; | ||
| import { VimeoVideo } from '@videojs/react/media/vimeo-video'; | ||
| import { useMemo } from 'react'; | ||
| import { createRoot } from 'react-dom/client'; | ||
|
|
||
| function readStyling(): Styling { | ||
| return new URLSearchParams(location.search).get('styling') === 'tailwind' ? 'tailwind' : 'css'; | ||
| } | ||
|
|
||
| function App() { | ||
| const skin = useSkin(); | ||
| const source = useSource(false, true); | ||
| const styling = useMemo(readStyling, []); | ||
| const autoplay = useAutoplay(); | ||
| const muted = useMuted(); | ||
| const loop = useLoop(); | ||
|
|
||
| return ( | ||
| <VideoProvider> | ||
| <VideoSkinComponent skin={skin} styling={styling} className="aspect-video max-w-4xl mx-auto"> | ||
| <VimeoVideo src={SOURCES[source].url} autoplay={autoplay} muted={muted} loop={loop} controls={false} /> | ||
| </VideoSkinComponent> | ||
| </VideoProvider> | ||
| ); | ||
| } | ||
|
|
||
| createRoot(document.getElementById('root')!).render(<App />); |
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
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.
Uh oh!
There was an error while loading. Please reload this page.