mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(site): add buffering indicator api reference
closes #532 closes #533
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
---
|
||||
import HtmlDemo from '@/components/docs/demos/HtmlDemo.astro';
|
||||
import html from './BasicUsage.html?raw';
|
||||
import './BasicUsage.css';
|
||||
---
|
||||
|
||||
<HtmlDemo html={html} />
|
||||
<script>
|
||||
import './BasicUsage.ts';
|
||||
</script>
|
||||
@@ -0,0 +1,39 @@
|
||||
.buffering-indicator-basic {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.buffering-indicator-basic__overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.buffering-indicator-basic__overlay .buffering-indicator-basic__spinner {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.buffering-indicator-basic__overlay[data-visible] .buffering-indicator-basic__spinner {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.buffering-indicator-basic__spinner {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.3);
|
||||
border-top-color: white;
|
||||
border-radius: 50%;
|
||||
animation: buffering-spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes buffering-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<video-player class="buffering-indicator-basic">
|
||||
<video
|
||||
src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4"
|
||||
autoplay
|
||||
muted
|
||||
playsinline
|
||||
loop
|
||||
></video>
|
||||
<media-buffering-indicator class="buffering-indicator-basic__overlay">
|
||||
<div class="buffering-indicator-basic__spinner"></div>
|
||||
</media-buffering-indicator>
|
||||
</video-player>
|
||||
@@ -0,0 +1,2 @@
|
||||
import '@videojs/html/video/player';
|
||||
import '@videojs/html/ui/buffering-indicator';
|
||||
@@ -0,0 +1,39 @@
|
||||
.buffering-indicator-basic {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.buffering-indicator-basic__overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.buffering-indicator-basic__overlay .buffering-indicator-basic__spinner {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.buffering-indicator-basic__overlay[data-visible] .buffering-indicator-basic__spinner {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.buffering-indicator-basic__spinner {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.3);
|
||||
border-top-color: white;
|
||||
border-radius: 50%;
|
||||
animation: buffering-spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes buffering-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { BufferingIndicator, createPlayer, features, Video } from '@videojs/react';
|
||||
|
||||
import './BasicUsage.css';
|
||||
|
||||
const Player = createPlayer({ features: [...features.video] });
|
||||
|
||||
export default function BasicUsage() {
|
||||
return (
|
||||
<Player.Provider>
|
||||
<Player.Container className="buffering-indicator-basic">
|
||||
<Video
|
||||
src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4"
|
||||
autoPlay
|
||||
muted
|
||||
playsInline
|
||||
loop
|
||||
/>
|
||||
<BufferingIndicator
|
||||
className="buffering-indicator-basic__overlay"
|
||||
render={(props, state) => (
|
||||
<div {...props}>{state.visible && <div className="buffering-indicator-basic__spinner" />}</div>
|
||||
)}
|
||||
/>
|
||||
</Player.Container>
|
||||
</Player.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user