Media

Video

Plays a video with controls that match the rest of your app. Two variants: Video for a file, and ShakaVideo for adaptive streams (HLS and DASH).

Installation

npx sinaui add video shaka-video

Examples

A file, with captions

Press the captions button or C to show them. Cross-origin captions need crossorigin on the video.

0:00 / 0:00
<script lang="ts">
	import Video from '#lib/ui/Video.svelte';
</script>

<Video
	title="Friday"
	src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/friday.mp4"
	crossorigin="anonymous"
>
	<track
		kind="captions"
		srclang="en"
		label="English"
		src="https://interactive-examples.mdn.mozilla.net/media/examples/friday.vtt"
	/>
</Video>

A stream

Picks the quality to suit the connection; choose one yourself from the quality menu.

0:00 / 0:00
<script lang="ts">
	import ShakaVideo from '#lib/ui/ShakaVideo.svelte';
</script>

<ShakaVideo
	title="Angel One"
	manifest="https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd"
/>

Props

PropTypeDefault
srcstring (Video)
manifeststring, a .mpd or .m3u8 (ShakaVideo, required)
titlestring: names the player and shows in the system media controls
artiststring
artworkstring: image for the lock screenposter
posterstring
aspectRatiostring'16 / 9'
elementHTMLVideoElement, bindable: for libraries that attach to the video
errorstring: a message to show over the player
children<source> and <track> elements
controlsSnippet: your own buttons, placed before full screen

Any other attribute (loop, crossorigin, …) goes on the video.

Keyboard

KeyDoes
Space / KPlay or pause
← / →Back or forward 5 seconds
J / LBack or forward 10 seconds
Home / EndStart or end (on the seek bar)
MMute
CCaptions on or off
FFull screen

Accessibility

  • Every control is a labeled button or slider; the seek bar reads “1:15 of 3:20”.
  • Controls fade while it plays and come back on any mouse move, touch or key press.
  • Headphone buttons, the lock screen and the system media panel control it too.
  • Errors are announced in plain words over the player.
  • With reduced motion, controls fade without sliding.
Introduction
Theming
Changelog
Button
Action button
Confirm button
Copy button
Hold to confirm
Split button
Calendar
Checkbox
Color picker
Combobox
Date picker
Date range picker
File drop
Form
Input
Mention input
Multi select
Number field
OTP input
Password input
Phone input
Radio cards
Radio group
Rich text editor
Search field
Segmented control
Select
Signature pad
Slider
Switch
Tag input
Upload
Wheel picker
Textarea
Time field
Toggle group
Toolbar
Alert dialog
Command palette
Context menu
Dialog
Drawer
Dropdown
Hover card
Popover
Tooltip
Announcement bar
Alert
Empty state
Meter
Progress
Rolling number
Skeleton
Spinner
Toast
Avatar
Avatar group
Badge
Card
Carousel
Chart
Chat
Code block
Data table
Folder
Kbd
Mind map
Resizable panels
Scroll area
Separator
Sortable
Table
Tag group
Virtual list
Audio player
Image
Image compare
Video
Visualizer
Breadcrumb
File tree
Menubar
Navigation menu
Pagination
Sidebar layout
Stepper
Tabs
Alarm clock
Clock
Dynamic island
Fluid orb
Hourglass
Stopwatch
Timer
AI chat
AI media
Auth
Board
Booking
Dashboard
File explorer
Messaging
Notifications
Settings
Team
Overview
Pricing
Agent chat
Calendar
Voice agent
Mail inbox
CMS
Blog
Marketing site
E-commerce
AI agents
SaaS landing page
SaaS app
Accordion
Dark theme
Light theme