All Projects → avidofood → vue-responsive-video-background-player

avidofood / vue-responsive-video-background-player

Licence: MIT license
Play your own videos in background responsively in different resolutions.

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to vue-responsive-video-background-player

Vidage
Your solution to full-screen background video & image combined.
Stars: ✭ 1,579 (+644.81%)
Mutual labels:  background-video, background
vue-composition-api-ts-todo
ToDo List with Vue 3 Composition API and TypeScript
Stars: ✭ 69 (-67.45%)
Mutual labels:  vue3
vue-reuse
基于composition-api的hooks函数库
Stars: ✭ 28 (-86.79%)
Mutual labels:  vue3
adminlte-3-vue
Vue 3.2.31 start-up project with AdminLTE 3.2.0 template
Stars: ✭ 134 (-36.79%)
Mutual labels:  vue3
vue-next-rx
RxJS integration for Vue next
Stars: ✭ 31 (-85.38%)
Mutual labels:  vue3
vitailse
Opinionated Vite starter template with TailwindCSS
Stars: ✭ 95 (-55.19%)
Mutual labels:  vue3
taro-quick-start
Quick start project with Taro & Vue3 & TypeScript.
Stars: ✭ 35 (-83.49%)
Mutual labels:  vue3
fearless
A dashboard scaffolding based on Vue.js 3.x & TypeScript created by Vite.
Stars: ✭ 1,156 (+445.28%)
Mutual labels:  vue3
v-code-diff
A vue code diff display plugin, support Vue2 / Vue3
Stars: ✭ 93 (-56.13%)
Mutual labels:  vue3
vue-dk-toast
Lightweight toast-notification plugin for Vue 3 🍞
Stars: ✭ 23 (-89.15%)
Mutual labels:  vue3
ionic-vue-mobile-template-01
Hybrid app template built with vue, ionic and capacitor.
Stars: ✭ 47 (-77.83%)
Mutual labels:  vue3
table
Performant advanced table component
Stars: ✭ 321 (+51.42%)
Mutual labels:  vue3
v-intl
Add i18n to your awesome Vue 3 app 🔉
Stars: ✭ 13 (-93.87%)
Mutual labels:  vue3
cordova-plugin-background-upload
Cordova plugin for background upload
Stars: ✭ 47 (-77.83%)
Mutual labels:  background
vue3-manjaro-ui
网页版Manjaro。A simulation webpage for Manjaro Linux(KDE Plasma).
Stars: ✭ 109 (-48.58%)
Mutual labels:  vue3
vue3-admin
admin-web后台管理项目骨架是基于vue3搭建起来的项目,前端ui库使用的是element-plus组件库,实现登录鉴权,动态菜单功能
Stars: ✭ 107 (-49.53%)
Mutual labels:  vue3
slider
Vue 3 slider component with multihandles, tooltips merging and formatting (+Tailwind CSS support).
Stars: ✭ 162 (-23.58%)
Mutual labels:  vue3
g2plot-vue
g2plot for vue, both 2 and 3
Stars: ✭ 106 (-50%)
Mutual labels:  vue3
vite-vue3-tailwind
Boilerplate at vue 3 whit firebase, vue notus, typesctip, vite, tailwind
Stars: ✭ 21 (-90.09%)
Mutual labels:  vue3
vue3-oop
使用类和依赖注入写vue组件
Stars: ✭ 90 (-57.55%)
Mutual labels:  vue3

Responsive Video Background Player for Vue 2 & 3 ⚡️

Downloads Version License

Laravel Tongue

If you are looking to play videos in the background, you have found the best Vue package for it 😜 (Currently no YouTube videos)

Prerequisites: Vue 2.x.x or Vue 3.x.x

Installation in 2 Steps

1: Add with npm 💻

 # For Vue 2.x.x
 npm install [email protected]

# For Vue 3.x.x
 npm install vue-responsive-video-background-player

2a: Install as a component

 import VideoBackground from 'vue-responsive-video-background-player'

 Vue.component('video-background', VideoBackground);

2b: Install as a plugin

 import { Plugin } from 'vue-responsive-video-background-player'

 Vue.use(Plugin);

(3: Only for Nuxt.js users)

Thanks to @skoulix for his instructions:

Again this is only for Nuxt.js users. Gridsome users click here. At your nuxt.config.js locate the part where you declare your plugins and import the file. Example:

plugins: [
  {
    src: '~/plugins/vue-video-background',
    ssr: false
  }
]

Now the component is globally available and can be used at any .vue file without issues.

Usage - (or to make it runnable 🏃‍♂️)

Easiest version 🔍

 <video-background 
    src="<your-video-path>.mp4"
    style="max-height: 400px; height: 100vh;"
 >
    <h1 style="color: white;">Hello welcome!</h1>
 </video-background>

Advanced version 🌐

 <video-background 
    src="<your-default-video-path>.mp4"
    poster="/images/mainfoto.jpg"
    :sources="[
        {src: '<your-tablet-video-path>.mp4', res: 900, autoplay: true}, 
        {src: '<your-mobile-video-path>.mp4', res: 638, autoplay: true, poster: '<your-mobile-background-image-path>.png'}
    ]"
    style="max-height: 400px; height: 100vh;"
    overlay="linear-gradient(45deg,#2a4ae430,#fb949e6b)" 
>
    <h1 style="color: white;">Hallo welcome!</h1>
</video-background>

Demo ⚡️

https://avidofood.github.io/vue-responsive-video-background-player/

Props

This package is for responsive videos depicting different video resolution. Have you ever visited my favorite car company Tesla? Have a look, they use a lot of video background videos and are using different resolutions for each device.

Props values

  • src (required: true)

This is your path to your video. You can just use this value for showing your video in every resolution.

⚠️Warning for Vue CLI: You need to bind the source like this: :src="require(@/assets/video/timelapse.mp4)". Read here why

  • poster (default: '')

This is your first background image that is shown before the video is loaded.

⚠️Warning for Vue CLI: You need to bind the source like this: :src="require(@/assets/img/logo.png)". Read here why

  • sources (default: [])

This is the main reason for this package. I wanted to have the possibility to change the resolution of the video when the resize event is fired.

To make it work, sources is an array that contains objects. For example:

[{src: '<your-mobile-video-path>.mp4', res: 638, autoplay: true, poster: '<your-mobile-background-image-path>.png'}]

To make it work you need at least src, res, autoplay.

poster is optional.

res stand for resolution. This example means that between 0px and 638px of the window's width only the mobile video will be shown. After that your default src.

  • autoplay (default: true)

The video is going to be played immediately when the video is ready. If you are setting it to false, you can start the video just by this.$refs.videobackground.player.play(). But remember to set ref=videobackground to the HTML tag <video-background>, so that it can work.

  • overlay (default: '') If you love overlays, then copy the overlay from the advanced example.

  • muted (default: true)

Warning. Videos are perhaps not played when unmuted.

  • loop (default: true)

Loops through the video. You can catch the event ended to show only the poster.

  • preload (default: auto)

https://www.w3schools.com/tags/att_video_preload.asp

  • objectFit (default: cover)

So the video fits perfectly in the container

  • playsWhen (default: canplay)

This is important, if you know that you might have users with bad internet speed, you should definetly use canplaythrough. Learn more in video events.

  • playbackRate (default: 1.0)

The playbackRate property sets the current playback speed of the video. Example but negative values didn't work for me?

  • transition (default: fade)

You can add your own transition styles here. If you set it to empty string, it won't show any transitions.

Events

  • ready: Video is loaded
  • playing: Video is playing
  • error: Video error
  • loading: Video is loading
  • ended: Video finished, only when loop is set to false

Methods

If you happen to need more control over the player, you can use the internal methods. For that, you need to set ref=videobackground to the HTML tag <video-background>. After that you can call all methods like this this.$refs.videobackground.player.play().

  • play(): Video is playing
  • pause(): Video is paused
  • show(): Video is shown
  • hide(): Video is hidden, the poster is shown
  • load(): Video is loaded

Security

If you discover any security related issues, please don't email me. I'm afraid 😱. [email protected]

Credits

Now comes the best part! 😍 This package is based on

Oh come on. You read everything?? If you liked it so far, hit the ⭐️ button to give me a 🤩 face.

Changelog

Mental node. Because of vue-cli, I cannot upgrade to webpack 5, therefore I cannot use laravel-mix 6...

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].