# vue-responsive-video

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

Latest version **1.0.0** (published 2022-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-responsive-video
pnpm add vue-responsive-video
yarn add vue-responsive-video
bun add vue-responsive-video
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-06-08 |
| First published | 2022-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Jake Gully |
| Maintainers | mayastudio |
| Keywords | video, vue, responsive |

## Links

- npm: https://www.npmjs.com/package/vue-responsive-video
- Repository: https://github.com/hellomayaagency/vue-responsive-video
- Homepage: https://github.com/hellomayaagency/vue-responsive-video#readme
- Issues: https://github.com/hellomayaagency/vue-responsive-video/issues
- npm.io page: https://npm.io/package/vue-responsive-video

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) <3.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-06-08

## README

# 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

```bash
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.

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

## Example

```html
<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.

---
_Source: https://npm.io/package/vue-responsive-video · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
