0.0.5-1 • Published 2 years ago

@kkan0615/vue-video-player v0.0.5-1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

It's beta version!

vue-video-player

video player made by vue component

Download

NPM

npm i @kkan0615/vue-video-player

YARN

yarn add @kkan0615/vue-video-player

How to use

Global component

import VueVideoPlayer from '@kkan0615/vue-video-player'
import '@kkan0615/vue-video-player/dist/style.css'

const app = createApp(App)

app
  .component('VueVideoPlayer', VueVideoPlayer)
  .mount('#app')

In component

<script setup lang="ts">

import VueVideoPlayer from '@kkan0615/vue-video-player'
import '@kkan0615/vue-video-player/dist/style.css'

</script>

Props

NameTypeDefaultDescription
videoListvideo[]Video list
heightstring600pxVideo height
widthstring600pxVideo width
posterstring''picture url before start
loopbooleanfalseLoop the video
initVolumenumber1000 to 100, first volume size
initPlaybackRatenumber10 to 2, first volume size
videoObjectFitobject-fit (style)1object fit style
subtitleListSubtitle[]Subtitle list
disablebooleanfalseDisable to press any buttons
playbackRateListnumber0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0Playback rate list
labelListlabel(Check the README.md)label(i18n) list
subtitleClassstring''subtilte class

label list

{
  noVideo: 'No video',
  errorPlaying: 'Sorry there are some errors to play the video',
  speed: 'speed',
  subtitle: 'subtitle',
  noSubtitle: 'no subtitle',
  pictureInPicture: 'picture in picture',
  quality: 'quality',

Copy it and change the values

Slot

NameDescription
prependInnerMenufront of controller panel
appendInnerMenuback controller panel
betweenPlayAndVolumebetween play and volume button (usually for next video button)
prependSettingContendfront of setting content list item
appendSettingContendback of setting content list item
errorContainerError container

Key event

KeyDescription
spacePlay or pause
ArrowRightmove forward
ArrowLeftmove backward
ArrowUpvolume up
ArrowDownvolume down

Note

The event is added at window

Types

Video

KeyTypeDescriptionExample
srcstringurlhttps://www.sample.com
typestringtype of videovideo/mp4
labelstringlabellabel
qualitynumberquality720px
defaultbooleanis it default videotrue

Note

Please use url not from local directory

Subtitle

KeyTypeDescriptionExample
srcstringurlhttps://www.sample.com
srclangstringlanguageen
defaultbooleanis it default subtitletrue
labelstringlabellabel
kindstringmostly use subtitlesubtitle

Note

Please use url not from local directory

Object fit

  • contain – the video will be scaled to fit the container while preserving the aspect ratio, letterboxing will be present around the video
  • cover – the video is scaled to fill the container while preserving the aspect ratio, the video will be clipped
  • fill – the video is scaled to fill the container without preserving the aspect ratio, the video will be stretched
  • none – video is not resized

How to add more list item in setting menu

<template
  #prependSettingContend
>
  <li
      class="vue-video-player-drop-menu-content-list-item"
      @click="someFunc()"
  >
    <!--  icon part  -->
    <div
        class="vue-video-player-drop-menu-content-list-item--icon"
    >
      <m-picture-in-picture-icon
          :size="18"
      />
    </div>
    <!--  label part  -->
    <div
        class="vue-video-player-drop-menu-content-title-container--title"
    >
      some label
    </div>
  </li>
</template>

Note

Sorry, We don't support to additional list item like quality and subtitle menu. We plan to update it later!

Customizing

Styles

@import '@kkan0615/vue-video-player/dist/style.css'

Support me

"Buy Me A Coffee"

What we do next?

Hide pip mode with following code

if (!('pictureInPictureEnabled' in document)) {
    pipButton.classList.add('hidden');
  }

Add loading panel

0.0.5-1

2 years ago

0.0.5

2 years ago

0.0.4-12

2 years ago

0.0.4-11

2 years ago

0.0.4-10

2 years ago

0.0.4-9

2 years ago

0.0.4-8

2 years ago

0.0.4-7

2 years ago

0.0.4-6

2 years ago

0.0.4-5

2 years ago

0.0.4-4

2 years ago

0.0.4-3

2 years ago

0.0.4-1

2 years ago

0.0.4

2 years ago

0.0.3-5

2 years ago

0.0.3-4

2 years ago

0.0.3-3

2 years ago

0.0.3-2

2 years ago

0.0.3-1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago