1.0.0 • Published 5 years ago

@tryangled/vue-video v1.0.0

Weekly downloads
6
License
MIT
Repository
-
Last release
5 years ago

@tryangled/vue-video youtube and vimeo component for Vue.js

TL;DR

Component to take as input Youtube and/or Vimeo urls and return the correct video url, type (youtube/vimeo), valid/invalid and thumbnail url.

Features

  • Lightweight (<6KB gzipped)
  • Dependency free
  • Mobile support
  • Returns an array of videos
  • Retreives the thumbnail of the video

Usage

A. Globally

import Vue from 'vue'
import vue-video from '@tryangled/vue-video'

// register component <vue-video>
Vue.use(vue-video)

B. Use as component: https://codesandbox.io/embed/vue-video-sample-app-ve1jk?fontsize=14

<template>
  <div>
    <vue-video
      thumbWidthPX="100"
      urlInputBorder="blue"
      urlInputTextColor="green"
      urlInputPlaceholderText="Add Youtube / Vimeo Link"
      urlInputTextHeightPX="30"
      limitVideoTo="3"
      @VideoDeleted="onVideoDeleted"
      @thumbnailClick="onThumbClicked"
      @VideoAdded="onVideoAdded"
      @VideoUrlError="onVideoUrlError"
    ></vue-video>
  </div>
</template>

<script>
  import {vueVideo} from '@tryangled/vue-video'

  export default {
    data () {
      return {
        }
      },
    methods: {
      onVideoDeleted(value) {
        //write your code here
        console.log(value.position);
        console.log(value.videos);
        console.log(value.video);
        },
      onThumbClicked(url) {
        //write your code here
        console.log(url);
        },
      onVideoAdded(value) {
        //write your code here
        console.log(value.videos);
        console.log(value.video);
        },
      onVideoUrlError(url) {
        //write your code here
        console.log(url);
        }
      }
    }
</script>

Custom attributes

AttributeRequiredTypeDefaultDescription
thumbWidthPXoptionalString"100"Thumbnail Width in px
urlInputBorderoptionalString"gray"Input Border Color
urlInputTextColoroptionalString"black"Input Text Color
urlInputPlaceholderTextoptionalString"Video link (Youtube or Vimeo)"Input placeholder Text
urlInputTextHeightPXoptionalString"30"Input Height in px
limitVideoTooptionalString"-1"Limit of videos ("-1" = unlimited)

Event handlers

Event handlerParameterTypeDescription
VideoDeleted{position, video, videos}{String, {Url, isValid, thumbUrl, type}, {Url, isValid, thumbUrl, type}, ... }event triggered when a video is deleted from the list
thumbnailClickvideoUrlStringevent triggered when a thumbnail is clicked, parameter passed is the video URL
VideoAdded{video, videos}{{Url, isValid, thumbUrl, type}, {Url, isValid, thumbUrl, type}, ... }event triggered when a valid video is added to the list
VideoUrlErrorurlStringevent triggered when the url entered cannot be resolved to a valid youtube / vimeo url

References

1.0.0

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago