0.5.3 • Published 4 years ago

@iomariani/vue-player v0.5.3

Weekly downloads
27
License
MIT
Repository
github
Last release
4 years ago

vue-player

Simple, lightweight, vue.js HTML5 audio/video player

GitHub version bundlephobia vue2 CodeFactor License


Table of Contents


Demo

Available at codesandbox.io (sandbox)


Install

npm install @iomariani/vue-player

Usage

Global

If you want the component to be available globally:

import Vue from 'vue'
import VuePlayer from '@iomariani/vue-player'

Vue.component('vue-player', VuePlayer)

Local

If you want the component to be available locally:

import VuePlayer from '@iomariani/vue-player'

new Vue({
	components: {
		VuePlayer
	}
})

CSS

The component css is available seperately. You can just import it by:

import '@iomariani/vue-player/dist/vue-player.css'

HTML

audio

<vue-player audio />

video

<vue-player video />

Props

ParamTypeDescriptionDefault
exclusiveBooleanAllow only one player playing at a timetrue
autoplayBooleanAudio/video autoplay propertyfalse
loopBooleanAudio/video loop propertyfalse
colorStringColor to use at the active trackbar#2f96fd
theaterBoolean or String ("fullscreen")Wrap the player with an overlay div, if param is fullscreen will show overlay only when in fullscreenfalse
overlayBlurBooleanAdd a blur filter effect to the overlayfalse
overlayColorStringColor to use on the overlay div#000000e6
Audio Props
audioBooleanSet player type as audiofalse
sourcesObjectDeclaration example below
Video Props
videoBooleanSet player type as videofalse
videoWidthStringVideo width100%
videoHeightStringVideo heightauto
posterStringURL of the poster image
fullscreenStringType of fullscreen to use. See types belowboth
autoFullscreenBooleanActive fullscreen mode on playfalse
sourcesObjectDeclaration example below
viewportFunctionElement to scale towindow
Fullscreen Types
nativeBrowser native requestFullscreen method
scaleScale the player to the viewport
bothEnable both native and scale methods

Sources

Sources must be declared as an object as type:source. Example:

const audioSources = {
	"audio/mp3": "//localhost/music.mp3",
	...
};

const videoSources = {
	"video/mp4": "//localhost/video.mp4",
	"video/webm": "//localhost/video.webm",
	...
};

Styling

If you want to style the player you can do so by importing the scss file:

<style lang="scss">
@import '@iomariani/vue-player/src/scss/vue-player.scss';
</style>

Available Variables

$vardefault
$player-background#f0f0f0
$player-border-radius20px
$player-buffer-background#ffffff33
$player-fullscreen-z-index100000

Todo

  • Loading/buffering icon
  • Volume slider
  • Trackbar seeker on drag
  • Emmit player events
  • Viewport Prop for scale fullscreen
  • Skip forward 10s
  • Skip backwards 10s
  • Custom Fullscreen scale
  • Theater Mode
  • Exclusive Mode

Credits

Author

License

MIT

0.5.3

4 years ago

0.5.2

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.3.0

4 years ago

0.4.0

4 years ago

0.2.1

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.2.0

4 years ago