mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
33 lines
956 B
TypeScript
33 lines
956 B
TypeScript
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 { onSkinChange } from '@app/shared/sandbox-listener';
|
|
import { VIMEO_VIDEO_SRC } from '@app/shared/sources';
|
|
|
|
const html = String.raw;
|
|
|
|
const state = createHtmlSandboxState();
|
|
const loadLatest = createLatestLoader();
|
|
|
|
async function render() {
|
|
const tag = await loadLatest(() => loadVideoSkinTag(state.skin, state.styling));
|
|
if (!tag) return;
|
|
|
|
document.getElementById('root')!.innerHTML = html`
|
|
<video-player>
|
|
<${tag} class="aspect-video max-w-4xl mx-auto">
|
|
<vimeo-video class="block w-full h-full" src="${VIMEO_VIDEO_SRC}" playsinline></vimeo-video>
|
|
</${tag}>
|
|
</video-player>
|
|
`;
|
|
}
|
|
|
|
render();
|
|
|
|
onSkinChange((skin) => {
|
|
state.skin = skin;
|
|
render();
|
|
});
|