npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-video-input

v1.0.1

Published

vue-video-input =============

Downloads

4

Readme

vue-video-input

Video file input Vue.js component with video canvas preview, drag and drop, information detection, gif preview creation and more.

Installation

npm

npm install --save vue-video-input

yarn

yarn add vue-video-input

Usage

<template>
  <div class="hello">    
    <video-input 
      ancho="600" 
      alto="600" 
      radio="0"
      mensaje="DRAG VIDEO" 
      @info="onInfo">
    </video-input>
  </div>
</template>
<script>
import VideoInput from 'vue-video-input'

export default {
  name: 'app',
  data () {
    return {
    }
  },
  components: {
    VideoInput
  },
  methods: {
    onInfo (video) {
      console.log('New video selected!')
      if (video.base64) {
        console.log('Base64 of video loaded.', video.base64)
      } else {
        console.log('FileReader API not supported: use the <form>, Luke!')
      }
    }
  }
}
</script>

You can also use it directly in the browser through unpkg's CDN (or jsDelivr):

<!DOCTYPE html>
<html>
<head>
  <script src="https://unpkg.com/vue"></script>
  <script src="https://unpkg.com/vue-video-input"></script>
  <title>In the browser!</title>
</head>
<body>
  <div id="app">
    <p>{{ message }}</p>
    <video-input></video-input>
  </div>
  <script>
    var app = new Vue({
      el: '#app',
      data: {
        message: 'Hello Vue!'
      },
      components: {
        'video-input': VideoInput
      }
    })
  </script>
</body>
</html>

Props

  • ancho, alto: (pixels, optional) the maximum width and height of the preview container. The video will be resized and centered to cover this area. Either ancho or alto is required.
  • margin: (pixels, optional) the margin around the preview container. Default value: 0.
  • radio: (percentage, optional) The border-radius value for the container. Set radius="50" to get a circular container. Default value: 0.
  • mensaje: (string, optional) Message to display inside container when no video has being selected.
  • tipo: (media type, optional) the accepted video type(s), e.g. video/mp4, video/avi, etc. Default value: 'video/*'.
  • maxmb: (MB, optional) the maximum accepted file size in megabytes.
  • duracion: (int, optional) the amount of seconds the video must have. Default -1=disabled.
  • ratio: (string, optional) the required aspect ratio the video must have.
  • preview_ancho: (pixels, optional) the width for the gif preview file to be created.
  • preview_alto: (pixels, optional) the height for the gif preview file to be created.

Events

  • info: emitted on (successful) video change. Passes an object with the fields: mbytes (amount of megabytes that the video has), duracion (amount of seconds the video has), ratio (aspect ratio of the video), ancho (original width of video), height (original height of video), base64 (Base64 Data URI string with video data).
  • change: emitted on (successful) video change. Passes a field called 'archivo' with the input object file.
  • preview: emitted while the animated gif datafile is being and/or has finished created, along with an object with creando (true is gif preview is still being created), preview (Base64 Data URI string with GIF data).
  • error: emitted on error, along with an object with tipo (maxmb, ratio, formato), mensaje.

TODOs

  • Translate properties/events to English
  • Add tests

Contributions

All contributions are welcome, as long as they are within the scope of the project. Please open a new issue before submitting a pull request.

You should follow the Javascript Standard Style guidelines: https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style