<div class="video">
<video class="video__video" controls width="1280" height="720" playsinline poster="https://files.vidstack.io/sprite-fight/poster.webp" preload="none" data-video-translations="{"Current time":"Current time","Disable captions":"Disable captions","Enable captions":"Enable captions","Enter Fullscreen":"Enter Fullscreen","Enter PiP":"Enter PiP","Exit Fullscreen":"Exit Fullscreen","Exit PiP":"Exit PiP","Go back to previous menu":"Go back to previous menu","Ad":"Ad","AirPlay":"AirPlay","All":"All","Audio":"Audio","Auto":"Auto","Buffered":"Buffered","Captions":"Captions","Default":"Default","Disabled":"Disabled","Download":"Download","Duration":"Duration","Enabled":"Enabled","End":"End","Forward":"Forward","LIVE":"LIVE","Loop":"Loop","Mute":"Mute","Normal":"Normal","Pause":"Pause","Play":"Play","Played":"Played","Quality":"Quality","Reset":"Reset","Restart":"Restart","Rewind":"Rewind","Seek":"Seek","Settings":"Settings","Speed":"Speed","Start":"Start","Unmute":"Unmute","Volume":"Volume"}">
<source src="https://files.vidstack.io/sprite-fight/720p.mp4" type="video/mp4">
</video>
</div>
<div {{ html_attributes({
id: id ?? false,
class: 'video',
}, attrs ?? {}) }}>
<video {{ html_attributes({
class: 'video__video',
controls: controls ?? true,
width: width ?? null,
height: height ?? null,
src: src ?? null,
autoplay: autoplay ?? false,
muted: muted ?? false,
playsinline: playsinline ?? true,
poster: poster ?? false,
preload: preload ?? 'none',
'data-video-translations': {
'Current time': 'Current time' | t('site'),
'Disable captions': 'Disable captions' | t('site'),
'Enable captions': 'Enable captions' | t('site'),
'Enter Fullscreen': 'Enter Fullscreen' | t('site'),
'Enter PiP': 'Enter PiP' | t('site'),
'Exit Fullscreen': 'Exit Fullscreen' | t('site'),
'Exit PiP': 'Exit PiP' | t('site'),
'Go back to previous menu': 'Go back to previous menu' | t('site'),
'Ad': 'Ad' | t('site'),
'AirPlay': 'AirPlay' | t('site'),
'All': 'All' | t('site'),
'Audio': 'Audio' | t('site'),
'Auto': 'Auto' | t('site'),
'Buffered': 'Buffered' | t('site'),
'Captions': 'Captions' | t('site'),
'Default': 'Default' | t('site'),
'Disabled': 'Disabled' | t('site'),
'Download': 'Download' | t('site'),
'Duration': 'Duration' | t('site'),
'Enabled': 'Enabled' | t('site'),
'End': 'End' | t('site'),
'Forward': 'Forward' | t('site'),
'LIVE': 'LIVE' | t('site'),
'Loop': 'Loop' | t('site'),
'Mute': 'Mute' | t('site'),
'Normal': 'Normal' | t('site'),
'Pause': 'Pause' | t('site'),
'Play': 'Play' | t('site'),
'Played': 'Played' | t('site'),
'Quality': 'Quality' | t('site'),
'Reset': 'Reset' | t('site'),
'Restart': 'Restart' | t('site'),
'Rewind': 'Rewind' | t('site'),
'Seek': 'Seek' | t('site'),
'Settings': 'Settings' | t('site'),
'Speed': 'Speed' | t('site'),
'Start': 'Start' | t('site'),
'Unmute': 'Unmute' | t('site'),
'Volume': 'Volume' | t('site'),
},
}, videoAttrs ?? {}) }}>
{% for source in sources|default %}
<source {{ html_attributes(source) }}>
{% endfor %}
</video>
</div>
{
"width": 1280,
"height": 720,
"poster": "https://files.vidstack.io/sprite-fight/poster.webp",
"sources": [
{
"src": "https://files.vidstack.io/sprite-fight/720p.mp4",
"type": "video/mp4"
}
]
}
@import 'vidstack/player/styles/base.css';
@import 'vidstack/player/styles/plyr/theme.css';
.video {
--plyr-color-main: var(--color-orange);
--plyr-border-radius: var(--video-border-radius, var(--border-radius-medium));
aspect-ratio: 16/9;
block-size: auto;
border-radius: var(--plyr-border-radius);
box-shadow: var(--box-shadow-xxl);
display: flex;
inline-size: 100%;
> * {
block-size: 100%;
display: block;
inline-size: 100%;
}
}
import onLoad from '../../../javascripts/utils/onLoad';
onLoad<HTMLVideoElement>('.video__video', async ($video) => {
const { PlyrLayout, VidstackPlayer } = await import(/* webpackChunkName: "vidstack" */ 'vidstack/global/player');
const { videoTranslations } = $video.dataset;
await VidstackPlayer.create({
target: $video,
layout: new PlyrLayout({
translations: videoTranslations ? JSON.parse(videoTranslations) : undefined,
}),
});
});
No notes defined.