@mahdikhashan/v-on-page-video

0.1.3 • Public • Published

v-on-page-video

npm (tag) npm bundle size npm npm peer dependency version GitHub commit activity NPM

Directive for Vue 2 to pause and play the video element when page visibility changes like moving the tab to background


Installation

npm install --save @mahdikhashan/v-on-page-video

How to use

add the custom directive to you component

<template>
  <div class="hello">
    <video v-on-page-video width="320" height="240" controls>
      <source
        src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
        type="video/mp4"
      />
    </video>
  </div>
</template>

<script>
import onPageVideo from "@mahdikhashan/v-on-page-video";

export default {
  name: "HelloWorld",
  directives: {
    onPageVideo,
  },
};
</script>

Package Sidebar

Install

npm i @mahdikhashan/v-on-page-video

Weekly Downloads

3

Version

0.1.3

License

MIT

Unpacked Size

5.72 kB

Total Files

7

Last publish

Collaborators

  • mahdikhashan