mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(packages): add PlaybackRateButton to core, html, and react (#642)
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,25 @@
|
||||
.html-playback-rate-button-basic {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.html-playback-rate-button-basic video {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.html-playback-rate-button-basic__button {
|
||||
padding-block: 8px;
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
color: black;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
border-radius: 9999px;
|
||||
padding-inline: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.html-playback-rate-button-basic__button::after {
|
||||
content: attr(data-rate) "\00D7";
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<video-player class="html-playback-rate-button-basic">
|
||||
<video
|
||||
src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4"
|
||||
autoplay
|
||||
muted
|
||||
playsinline
|
||||
loop
|
||||
></video>
|
||||
<media-playback-rate-button class="html-playback-rate-button-basic__button">
|
||||
</media-playback-rate-button>
|
||||
</video-player>
|
||||
@@ -0,0 +1,2 @@
|
||||
import '@videojs/html/video/player';
|
||||
import '@videojs/html/ui/playback-rate-button';
|
||||
@@ -0,0 +1,21 @@
|
||||
.react-playback-rate-button-basic {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.react-playback-rate-button-basic video {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.react-playback-rate-button-basic__button {
|
||||
padding-block: 8px;
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
color: black;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
border-radius: 9999px;
|
||||
padding-inline: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { createPlayer, features, PlaybackRateButton } from '@videojs/react';
|
||||
import { Video } from '@videojs/react/video';
|
||||
|
||||
import './BasicUsage.css';
|
||||
|
||||
const Player = createPlayer({ features: [...features.video] });
|
||||
|
||||
export default function BasicUsage() {
|
||||
return (
|
||||
<Player.Provider>
|
||||
<Player.Container className="react-playback-rate-button-basic">
|
||||
<Video
|
||||
src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4"
|
||||
autoPlay
|
||||
muted
|
||||
playsInline
|
||||
loop
|
||||
/>
|
||||
<PlaybackRateButton
|
||||
className="react-playback-rate-button-basic__button"
|
||||
render={(props, state) => <button {...props}>{Math.round(state.rate * 10) / 10}×</button>}
|
||||
/>
|
||||
</Player.Container>
|
||||
</Player.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user