Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-responsive-video

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-responsive-video

A video element that will swap out the source file base on screen width

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Vue Responsive Video

A video element that will swap out its src based on the size of the window.

But why?

With a <picture> element you can provide multiple <source> child elements and use the media attribute on them to control when each one is used.

However, with the <video>, while it does support the <source> element as a child, it doesn't support the media attribute on its children.

This is annoying and leaves us with the challenge of finding a way to not provide huge videos to mobile devices.

This package tries to provide a way to do that.

Installation

npm install --save vue-responsive-video

# or

yarn add vue-responsive-video

Setup

First, add the component to your project. This code may vary depending on your setup.

import VueResponsiveVideo from 'vue-responsive-video';
Vue.component('responsive-video', VueResponsiveVideo);

Example

<responsive-video
    mobile-src="my-video-sml.mp4"
    desktop-src="my-video-med.mp4"
></responsive-video>

Limitations / Todo

Currently we're only supporting 2 sizes but we should be able to refactor it to support an arbitrary number of sizes.

An issue on iOS Safari 15 has meant that we can't provide a poster attribute which means we have no fallback if videos fail to play.

Keywords

FAQs

Package last updated on 08 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc