# test-inline-video

> Test if inline video mode is available

Latest version **1.0.0** (published 2018-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install test-inline-video
pnpm add test-inline-video
yarn add test-inline-video
bun add test-inline-video
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-10-23 |
| First published | 2017-11-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | pqml |
| Maintainers | pqml |
| Keywords | inlinevideo, inline, video |

## Links

- npm: https://www.npmjs.com/package/test-inline-video
- Repository: https://github.com/pqml/test-inline-video
- Homepage: https://github.com/pqml/test-inline-video#readme
- Issues: https://github.com/pqml/test-inline-video/issues
- npm.io page: https://npm.io/package/test-inline-video

## 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) — 2018-10-23
- 0.2.0 — 2018-10-22
- 0.1.1 — 2018-02-21
- 0.1.0 — 2018-02-19
- 0.0.2 — 2017-11-20
- 0.0.1 — 2017-11-08

## README

<h1 align="center">test-inline-video</h1>
<h3 align="center">Test if inline video mode is available</h3>
<br><br><br>

## Example
Example on [pqml.github.io/test-inline-video/](https://pqml.github.io/test-inline-video/)

<br><br>

## Features & Requirements
- Small module: < 800b gziped
- :warning: **Test-inline-video use Promises.** Use a [polyfill](https://www.npmjs.com/package/promise-polyfill) if you have to support IE / old browser versions
- The lib returns a `dataSave` property to check if browser Data Saving is enabled.
  - This is useful for Android: [Chrome Data Saver](https://support.google.com/chrome/answer/2392284?co=GENIE.Platform%3DAndroid&hl=en) turn off autoplay.
- You can also use this library to test low battery mode on iOS: inline videos don't play when it's enabled
  - The lib can measure framerate with the `measureFps` option to see if there is also FPS throttling: on iOS this is also a sign of low battery mode enabled
  - The framereate measure makes the test a bit longer - do not use this option if you don't need it

<br><br>

## Module Installation & Usage

##### Installation from npm
```sh
# using npm
$ npm install --save test-inline-video

# or using yarn
$ yarn add test-inline-video
```

##### Usage with npm and a module bundler
```js
import testInlineVideo from 'test-inline-video' // ES6 module import
const testInlineVideo = require('test-inline-video') // CommonJS module import

// Also test for framerate throttling
testInlineVideo({ testFramerate: true })
  .then(function (result) {
    // resut.autoplay return true of false if videos can autoplay
    if (result.autoplay) {
      log('Inline video mode is available!');
    } else {
      // Default error message : 'No support for inline video'
      log(result.error.message);
      // Test for FPS throttling on iOS
      if (result.badFps && result.iOS) log('You are probably in low-battery mode');
      // Test for Data Saver
      if (result.saveData) log('Please, disable your browser Data Saver');
    }
  })
```

##### Installation & usage from a browser

```html
<script src="//unpkg.com/test-inline-video"></script>
<script>
  // Don't forget the Promise polyfill if you need one
  windowtestInlineVideo()
    .then(function (result) {
      // resut.autoplay return true of false if videos can autoplay
      if (result.autoplay) {
        log('Inline video mode is available!');
      } else {
        log('No autoplay support');
      }
    })
</script>
```

<br><br>

## Development commands

- `npm install` - Install all npm dependencies
- `npm run start` - Start the dev server with livereload on the example folder
- `npm run build` - Bundle your library in CJS / UMD / ESM
- `npm run deploy` - Deploy your example folder on a gh-page branch
- `npm run test` - Lint your js inside the src folder

<br><br>

## License
MIT.

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