diff options
-rw-r--r-- | readme.md | 14 | ||||
-rw-r--r-- | src/js/plyr.js | 2 |
2 files changed, 12 insertions, 4 deletions
@@ -111,7 +111,7 @@ For YouTube and Vimeo, Plyr uses the standard YouTube API markup (an empty `<div ``` ### JavaScript -Include the `plyr.js` script before the closing `</body>` tag and then call `plyr.setup()`. More info on `setup()` can be found under [#initialising](initialising). +Include the `plyr.js` script before the closing `</body>` tag and then call `plyr.setup()`. More info on `setup()` can be found under [initialising](#initialising). ```html <script src="path/to/plyr.js"></script> @@ -138,7 +138,7 @@ If you want to use our CDN for the default CSS, you can use the following: ``` ### SVG Sprite -The SVG sprite is loaded automatically from our CDN. To change this, see the [#options](Options) below. For reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/1.8.12/plyr.svg`. +The SVG sprite is loaded automatically from our CDN. To change this, see the [options](#Options) below. For reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/1.8.12/plyr.svg`. ## Advanced @@ -172,7 +172,7 @@ WebVTT captions are supported. To add a caption track, check the HTML example ab #### Initialising -By default, Plyr looks for all `<video>`, `<audio>` and `[data-type]` elements with the document and initialises on any found. You can specify other options, including a different NodeList, HTMLElement or string selector as below: +By default, Plyr looks for all `<video>`, `<audio>` and `[data-type]` elements with the document and initialises on any found. You can specify other options, including a different NodeList, HTMLElement, Array of HTMLElements or string selector as below: Passing a [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList): ```javascript @@ -184,6 +184,14 @@ Passing a [HTMLElement](https://developer.mozilla.org/en/docs/Web/API/HTMLElemen plyr.setup(document.querySelector('.js-player'), options); ``` +Passing an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of [HTMLElement](https://developer.mozilla.org/en/docs/Web/API/HTMLElement)s: +```javascript +plyr.setup([ + document.querySelector('.js-player'), + document.querySelector('.another-js-player') +], options); +``` + Passing a [string selector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll): ```javascript plyr.setup('.js-player', options); diff --git a/src/js/plyr.js b/src/js/plyr.js index f01866bd..fc49a123 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -16,7 +16,7 @@ module.exports = factory(root, document); } else if (typeof define === 'function' && define.amd) { // AMD - define(null, function() { factory(root, document) }); + define([], function () { return factory(root, document); }); } else { // Browser globals (root is window) root.plyr = factory(root, document); |