@sweet-player/vue
Vue component for sweet-player
6,615
25
| Install | |
|---|---|
npm install @sweet-player/vue |
|
| Latest Version: | 1.6.0 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Aug 4, 2026 |
| Links: | GitHub · npm |
Maintainer: liuxionghui
@sweet-player/vue
Vue component wrapper for @sweet-player/core.
Live Demo: player.sweetui.com
Install
npm install @sweet-player/vue
Usage
<script setup lang="ts">
import { ref } from 'vue';
import { SweetPlayer } from '@sweet-player/vue';
import type { SweetPlayerCore } from '@sweet-player/vue';
const player = ref<SweetPlayerCore | null>(null);
function onReady(p: SweetPlayerCore) {
player.value = p;
}
</script>
<template>
<SweetPlayer
src="https://example.com/video.m3u8"
title="Video Title"
id="ep-01"
:volume="80"
:seek-step="10"
:auto-next="5"
@ready="onReady"
@next="() => console.log('next')"
/>
</template>
Props
All @sweet-player/core options (except container) can be passed as props:
| Prop | Type | Description |
|---|---|---|
src |
string |
Video URL (.m3u8 or regular video) |
title |
string |
Title displayed in the top-left corner |
id |
string |
Enables resume playback from last position |
volume |
number |
Volume 0-100 |
seekStep |
number |
Seek step in seconds |
autoNext |
boolean | number |
Auto-play next on ended (number = countdown seconds) |
locale |
string |
Language (built-in: zh-CN / en) |
plugins |
SweetPlayerPlugin[] |
Plugin list |
| ... | Full options in core docs |
Events
| Event | Payload | Description |
|---|---|---|
@ready |
SweetPlayerCore |
Player instance created |
@prev |
— | Previous clicked |
@next |
— | Next clicked |
@qualityChange |
QualityLevel |
Quality changed |
@audioTrackChange |
AudioTrackInfo |
Audio track changed |
Instance Methods
Access the player instance via @ready event, then call any method:
player.value?.play();
player.value?.seek(60);
player.value?.setVolume(50);
player.value?.toggleFullscreen();
player.value?.togglePip();
License
MIT
Related Packages
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.6.0 | ^3.0.0 | MIT | |
| 1.5.1 | ^3.0.0 | MIT | |
| 1.5.0 | ^3.0.0 | MIT | |
| 1.4.0 | ^3.0.0 | MIT | |
| 1.3.0 | ^3.0.0 | MIT | |
| 1.2.4 | ^3.0.0 | MIT | |
| 1.2.3 | ^3.0.0 | MIT | |
| 1.2.2 | ^3.0.0 | MIT | |
| 1.2.1 | ^3.0.0 | MIT | |
| 1.2.0 | ^3.0.0 | MIT | |
| 1.1.2 | ^3.0.0 | MIT | |
| 1.1.1 | ^3.0.0 | MIT | |
| 1.1.0 | ^3.0.0 | MIT | |
| 1.0.1 | ^3.0.0 | MIT | |
| 1.0.0 | ^3.0.0 | MIT | |
| 0.10.5 | ^3.0.0 | MIT | |
| 0.10.4 | ^3.0.0 | MIT | |
| 0.10.3 | ^3.0.0 | MIT | |
| 0.10.2 | ^3.0.0 | MIT | |
| 0.10.1 | ^3.0.0 | MIT | |
| 0.10.0 | ^3.0.0 | MIT | |
| 0.9.0 | ^3.0.0 | MIT | |
| 0.8.1 | ^3.0.0 | MIT | |
| 0.8.0 | ^3.0.0 | MIT | |
| 0.7.3 | ^3.0.0 | MIT | |
| 0.7.2 | ^3.0.0 | MIT | |
| 0.7.1 | ^3.0.0 | MIT | |
| 0.7.0 | ^3.0.0 | MIT | |
| 0.6.4 | ^3.0.0 | MIT | |
| 0.6.3 | ^3.0.0 | MIT |
Showing the latest 30 of 38. See every release on npm