mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
docs(site): add thumbnail reference page (#654)
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,24 @@
|
||||
.html-thumbnail-text-track {
|
||||
position: relative;
|
||||
display: block;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
.html-thumbnail-text-track__media {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.html-thumbnail-text-track__thumbnail {
|
||||
display: block;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.html-thumbnail-text-track__thumbnail[data-hidden] {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<section class="html-thumbnail-text-track">
|
||||
<video-player>
|
||||
<media-container>
|
||||
<video
|
||||
class="html-thumbnail-text-track__media"
|
||||
src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4"
|
||||
preload="auto"
|
||||
muted
|
||||
playsinline
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
<track
|
||||
kind="metadata"
|
||||
label="thumbnails"
|
||||
src="/docs/demos/thumbnail/basic.vtt"
|
||||
default
|
||||
/>
|
||||
</video>
|
||||
<media-thumbnail class="html-thumbnail-text-track__thumbnail" time="12"></media-thumbnail>
|
||||
</media-container>
|
||||
</video-player>
|
||||
</section>
|
||||
@@ -0,0 +1,2 @@
|
||||
import '@videojs/html/video/player';
|
||||
import '@videojs/html/ui/thumbnail';
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
import HtmlDemo from '@/components/docs/demos/HtmlDemo.astro';
|
||||
import html from './JsonSpriteUsage.html?raw';
|
||||
---
|
||||
|
||||
<HtmlDemo html={html} />
|
||||
<script>
|
||||
import './JsonSpriteUsage.ts';
|
||||
</script>
|
||||
@@ -0,0 +1 @@
|
||||
<media-thumbnail time="12" style="max-width: 240px;"></media-thumbnail>
|
||||
@@ -0,0 +1,41 @@
|
||||
import '@videojs/html/ui/thumbnail';
|
||||
|
||||
type DemoThumbnailImage = {
|
||||
url: string;
|
||||
startTime: number;
|
||||
endTime?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
coords?: { x: number; y: number };
|
||||
};
|
||||
|
||||
type ThumbnailDemoElement = HTMLElement & { thumbnails?: DemoThumbnailImage[] };
|
||||
|
||||
const thumbnail = document.querySelector<ThumbnailDemoElement>('media-thumbnail');
|
||||
if (thumbnail) {
|
||||
thumbnail.thumbnails = [
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/storyboard.jpg',
|
||||
startTime: 0,
|
||||
endTime: 10,
|
||||
width: 284,
|
||||
height: 160,
|
||||
coords: { x: 0, y: 0 },
|
||||
},
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/storyboard.jpg',
|
||||
startTime: 10,
|
||||
endTime: 20,
|
||||
width: 284,
|
||||
height: 160,
|
||||
coords: { x: 284, y: 0 },
|
||||
},
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/storyboard.jpg',
|
||||
startTime: 20,
|
||||
width: 284,
|
||||
height: 160,
|
||||
coords: { x: 568, y: 0 },
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
import HtmlDemo from '@/components/docs/demos/HtmlDemo.astro';
|
||||
import html from './JsonUsage.html?raw';
|
||||
---
|
||||
|
||||
<HtmlDemo html={html} />
|
||||
<script>
|
||||
import './JsonUsage.ts';
|
||||
</script>
|
||||
@@ -0,0 +1 @@
|
||||
<media-thumbnail time="12" style="max-width: 240px;"></media-thumbnail>
|
||||
@@ -0,0 +1,29 @@
|
||||
import '@videojs/html/ui/thumbnail';
|
||||
|
||||
type DemoThumbnailImage = {
|
||||
url: string;
|
||||
startTime: number;
|
||||
endTime?: number;
|
||||
};
|
||||
|
||||
type ThumbnailDemoElement = HTMLElement & { thumbnails?: DemoThumbnailImage[] };
|
||||
|
||||
const thumbnail = document.querySelector<ThumbnailDemoElement>('media-thumbnail');
|
||||
if (thumbnail) {
|
||||
thumbnail.thumbnails = [
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/thumbnail.jpg?time=0',
|
||||
startTime: 0,
|
||||
endTime: 10,
|
||||
},
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/thumbnail.jpg?time=10',
|
||||
startTime: 10,
|
||||
endTime: 20,
|
||||
},
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/thumbnail.jpg?time=20',
|
||||
startTime: 20,
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
.react-thumbnail-text-track {
|
||||
position: relative;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
.react-thumbnail-text-track__media {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.react-thumbnail-text-track__thumbnail {
|
||||
display: block;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.react-thumbnail-text-track__thumbnail[data-hidden] {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { createPlayer, Thumbnail } from '@videojs/react';
|
||||
import { Video, videoFeatures } from '@videojs/react/video';
|
||||
|
||||
import './BasicUsage.css';
|
||||
|
||||
const Player = createPlayer({ features: videoFeatures });
|
||||
|
||||
export default function TextTrackUsage() {
|
||||
return (
|
||||
<Player.Provider>
|
||||
<Player.Container className="react-thumbnail-text-track">
|
||||
<Video
|
||||
className="react-thumbnail-text-track__media"
|
||||
src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4"
|
||||
preload="auto"
|
||||
muted
|
||||
playsInline
|
||||
crossOrigin="anonymous"
|
||||
>
|
||||
<track kind="metadata" label="thumbnails" src="/docs/demos/thumbnail/basic.vtt" default />
|
||||
</Video>
|
||||
<Thumbnail className="react-thumbnail-text-track__thumbnail" time={12} />
|
||||
</Player.Container>
|
||||
</Player.Provider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Thumbnail } from '@videojs/react';
|
||||
|
||||
const THUMBNAILS = [
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/storyboard.jpg',
|
||||
startTime: 0,
|
||||
endTime: 10,
|
||||
width: 284,
|
||||
height: 160,
|
||||
coords: { x: 0, y: 0 },
|
||||
},
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/storyboard.jpg',
|
||||
startTime: 10,
|
||||
endTime: 20,
|
||||
width: 284,
|
||||
height: 160,
|
||||
coords: { x: 284, y: 0 },
|
||||
},
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/storyboard.jpg',
|
||||
startTime: 20,
|
||||
width: 284,
|
||||
height: 160,
|
||||
coords: { x: 568, y: 0 },
|
||||
},
|
||||
];
|
||||
|
||||
export default function JsonSpriteUsage() {
|
||||
return <Thumbnail thumbnails={THUMBNAILS} time={12} style={{ maxWidth: 240 }} />;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Thumbnail } from '@videojs/react';
|
||||
|
||||
const THUMBNAILS = [
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/thumbnail.jpg?time=0',
|
||||
startTime: 0,
|
||||
endTime: 10,
|
||||
},
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/thumbnail.jpg?time=10',
|
||||
startTime: 10,
|
||||
endTime: 20,
|
||||
},
|
||||
{
|
||||
url: 'https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/thumbnail.jpg?time=20',
|
||||
startTime: 20,
|
||||
},
|
||||
];
|
||||
|
||||
export default function JsonUsage() {
|
||||
return <Thumbnail thumbnails={THUMBNAILS} time={12} style={{ maxWidth: 240 }} />;
|
||||
}
|
||||
Reference in New Issue
Block a user