Socket
Socket
Sign inDemoInstall

svelte-player

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-player

SveltePlayer


Version published
Weekly downloads
21
decreased by-16%
Maintainers
1
Weekly downloads
 
Created
Source

SveltePlayer

A Svelte component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud, DailyMotion and Kaltura. This package is port of CookPete/react-player in Svelte

Usage

pnpm install svelte-player
<script lang="ts">
	import SveltePlayer from 'svelte-player';
</script>

// Render a YouTube video player
<SveltePlayer url="https://www.youtube.com/watch?v=LXb3EKWsInQ" />

By default, SveltePlayer supports many different types of url. Import only one type such as svelte-player/youtube or svelte-player/lazy to lazy load the appropriate player for the url you pass in like react-player not supported.

Demo page: https://fikryfahrezy.github.io/svelte-player

The component parses a URL and loads in the appropriate markup and external SDKs to play media from various sources. Props can be passed in to control playback and react to events such as buffering or media ending. See the demo source for a full example.

For platforms without direct use of npm modules, a minified version of SveletePlayer is not available.

Polyfills

  • Not available
Autoplay

See how react-player handle it.

Props

Read the description at react-player.

PropSupportedNote
url-
playing-
loop-
controls-
lightSet boolean value through props or custom component through <slot name="light" />
volume-
muted-
playbackRate-
width-
height-
style-
progressInterval-
playsinline-
pip-
stopOnUnmount-
fallback-
wrapper-
playIconPass it through <slot name="play-icon" >
previewTabIndex-
config-
Callback props

Read the description at react-player.

Callback props take a function that gets fired on various player events:

PropSupportedSvelte Player Version
onReadyon:ready
onStarton:start
onPlayon:play
onProgresson:progress
onDurationon:duration
onPauseon:pause
onBufferon:buffer
onBufferEndon:bufferEnd
onSeekon:seek
onPlaybackRateChangeon:playbackRateChange
onPlaybackQualityChangeon:playbackQualityChange
onEndedon:ended
onErroron:error
onClickPreviewon:clickPreview
onEnablePIPon:enablePIP
onDisablePIPon:disablePIP

Keywords

FAQs

Package last updated on 20 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc