Socket
Socket
Sign inDemoInstall

@mellkam/vue-plyr-queue

Package Overview
Dependencies
27
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @mellkam/vue-plyr-queue

Plugin for @mellkam/vue-plyr that makes ease to create video/audio queue with plyr player.


Version published
Weekly downloads
17
increased by325%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

vue-plyr-queue

npm license

Package that makes easy to build video queue with plyr in vue

Instalation

This package has three required peer dependencies.

"peerDependencies": {
  "plyr": ">=3.6.3",
  "vue": ">=3.2.0",
},
npm i @mellkam/vue-plyr-queue

Get started

<template>
	<video ref="player" />
	<ul>
		<li v-if="currentVideo">Current: {{ currentVideo.src }}</li>
		<li v-for="video in queue">
			{{ video.src }}
			<button @click="() => removeVideo(video.id)">Remove</button>
		</li>
	</ul>
	<button @click="nextVideo">Next</button>
</template>

<script lang="ts" setup>
import "plyr/dist/plyr.css";
import Plyr from "plyr";
import { useVideoQueue } from "@mellkam/vue-plyr-queue";
import { computed, onUnmounted, ref } from "vue";

const player = ref<HTMLVideoElement | null>(null);

const plyr = computed(() => {
	if (!player.value) return null;

	return new Plyr(player.value, { autoplay: true });
});

onUnmounted(() => {
	if (!plyr.value) return;

	try {
		plyr.value.destroy();
	} catch (error) {
		console.error(error);
	}
});

const { currentVideo, queue, nextVideo, removeVideo, addVideo } = useVideoQueue(
	{
		plyr,
		initialQueue: [
			{ id: "1", src: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
			{ id: "2", src: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
			{ id: "3", src: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }
		],
		defaultProvider: "youtube"
	}
);
</script>

Keywords

FAQs

Last updated on 16 Jul 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc