1.0.2 β€’ Published 2 years ago

vue-video-annotation v1.0.2

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

Vue Video Annotation

Downloads Version

Vue3 component that allows adding annotations to videos by free drawing or adding shapes like circles, squares, and arrows.

πŸ“¦ Installation

NPM

npm install --save vue-video-annotation

πŸš€ Usage in Vue3 Components

<template>
  <VideoAnnotationPlayer :annotations="annotations"
    @annotation-add="onAnnotationAdd">
    <template v-slot:videoContent>
      <source type="video/mp4" src="https://www.dropbox.com/s/xvjem6er1pp1usy/MicrosoftInclusiveHiring.mp4?raw=1">

      <source type="video/webm" src="https://www.dropbox.com/s/bmki1sn54o4m3xt/MicrosoftInclusiveHiring.webm?raw=1">

      <track kind="subtitles" label="δΈ­ζ–‡ε­—εΉ•" srclang="zh" src="https://www.dropbox.com/s/ipnbojfe0jtz5n7/MicrosoftInclusiveHiringCHT.vtt?raw=1" default>
    </template>
  </VideoAnnotationPlayer>
</template>
<script>
  import { VideoAnnotationPlayer, Annotation } from 'vue-video-annotation'

  export default defineComponent({
    components: {
        VideoAnnotationPlayer
    },
    setup() {
        let annotations = ref<Annotation[]>([]);

        const onAnnotationAdd = (annotation: Annotation) => {
            annotations.value.push(annotation);
        }

        return {
            annotations
        }
    }
  })
</script>
import { createApp } from 'vue'
import App from './App.vue'

//Import the style
import 'vue-video-annotation/dist/style.css'

const app = createApp(App);
app.mount('#app');

πŸ”§ Properties

PropertyTypeDescriptionDefault
srcStringVideo url to be used
posterStringImage url to be used before video start
autoPlayBooleanBoolean to enable autoplayfalse
showFullscreenButtonBooleanShow/Hide fullscreen buttontrue
showLoopButtonBooleanShow/Hide loop buttontrue
constrolsTimeoutNumberValue to control the timout of the controls3000 seconds
strokeWidthNumberStroke width for annotations5
showAnnotationControlsBooleanShow/Hide annotation controlstrue
annotationsAnnotation[]Array of annoataions to be used to add/import[] required
colorsString[]Array of colors to be used by the player['#000000', '#FFFFFF', '#F44336', '#E91E63', '#9C27B0', '#673AB7', '#3F51B5', '#2196F3', '#00BCD4', '#009688', '#4CAF50', '#8BC34A', '#CDDC39', '#FFEB3B', '#FFC107', '#FF9800', '#FF5722', '#795548', '#9E9E9E', '#607D8B']

πŸ”§ Events

EventDescriptionExample
annotationAddFired after an annotation be drawn@annotation-add="doSomething"
annotationSelectedFired after an annotation be selected@annotation-selected="doSomething"