Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/videojs/videojs-media-session

Media Session API plugin
https://github.com/videojs/videojs-media-session

media-session media-session-api playlist videojs videojs-playlist

Last synced: 4 months ago
JSON representation

Media Session API plugin

Awesome Lists containing this project

README

        

# videojs-media-session

Media Sessions API

This is an experimental videojs plugin that interfaces videojs, [videojs-playlist][], and Chrome's newly announced [Media Session API] [implementation][].

## Table of Contents

## Installation

```sh
npm install --save videojs-media-session
```

## Usage

To include videojs-media-session on your website or web application, use any of the following methods.

### `` Tag

This is the simplest case. Get the script in whatever way you prefer and include the plugin _after_ you include [video.js][videojs], so that the `videojs` global is available.

```html
<script src="//path/to/video.min.js">

var player = videojs('my-video');

player.mediaSession();

```

### Browserify

When using with Browserify, install videojs-media-session via npm and `require` the plugin as you would any other module.

```js
var videojs = require('video.js');

// The actual plugin function is exported by this module, but it is also
// attached to the `Player.prototype`; so, there is no need to assign it
// to a variable.
require('videojs-media-session');

var player = videojs('my-video');

player.mediaSession();
```

### RequireJS/AMD

When using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the plugin as you normally would:

```js
require(['video.js', 'videojs-media-session'], function(videojs) {
var player = videojs('my-video');

player.mediaSession();
});
```

## License

MIT. Copyright (c) Gary Katsevman <[email protected]>

[videojs]: http://videojs.com/
[videojs-playlist]: https://github.com/brightcove/videojs-playlist
[Media Session API]: https://wicg.github.io/mediasession/
[implementation]: https://developers.google.com/web/updates/2017/02/media-session