|
| 1 | +### Import : |
| 2 | +```js |
| 3 | +const VideoPlayer = brackets.getModule("view/VideoPlayer") |
| 4 | +``` |
| 5 | + |
| 6 | +<a name="Strings"></a> |
| 7 | + |
| 8 | +## Strings |
| 9 | +Tiny shared HTML5 `<video>` widget. Two entry points: |
| 10 | + |
| 11 | + createPlayer(options) — returns a configured `<video>` wrapper the |
| 12 | + caller can drop anywhere in their UI. |
| 13 | + |
| 14 | + renderFullScreenPlayer(srcElement, options) — opens a viewport- |
| 15 | + covering overlay with a large auto-playing player that |
| 16 | + expands out of `srcElement` (genie-style) and contracts back |
| 17 | + on close. Useful when an inline thumbnail should expand into |
| 18 | + a focused fullscreen view on click. |
| 19 | + |
| 20 | +**Kind**: global constant |
| 21 | +<a name="createPlayer"></a> |
| 22 | + |
| 23 | +## createPlayer(options) ⇒ <code>jQuery</code> |
| 24 | +Build a `<video>` element wrapped in a div with sensible Phoenix |
| 25 | +defaults. Returns the wrapper as a jQuery object; the caller appends |
| 26 | +and disposes it. |
| 27 | + |
| 28 | +**Kind**: global function |
| 29 | +**Returns**: <code>jQuery</code> - `<div class="phx-video-player ..."><video.../></div>` |
| 30 | + |
| 31 | +| Param | Type | Default | Description | |
| 32 | +| --- | --- | --- | --- | |
| 33 | +| options | <code>Object</code> | | | |
| 34 | +| options.src | <code>string</code> | | Video URL (required). | |
| 35 | +| [options.poster] | <code>string</code> | | Optional poster image URL. | |
| 36 | +| [options.controls] | <code>boolean</code> | <code>true</code> | Show native player controls. | |
| 37 | +| [options.muted] | <code>boolean</code> | <code>true</code> | Start muted. | |
| 38 | +| [options.autoplay] | <code>boolean</code> | <code>false</code> | Autoplay on insert (browsers only honour this when also muted). | |
| 39 | +| [options.loop] | <code>boolean</code> | <code>false</code> | | |
| 40 | +| [options.preload] | <code>string</code> | <code>"\"metadata\""</code> | One of "none", "metadata", "auto". Use "auto" when you want the bytes to fetch in the background after the poster paints. | |
| 41 | +| [options.className] | <code>string</code> | | Extra class on the wrapper. | |
| 42 | + |
| 43 | +<a name="renderFullScreenPlayer"></a> |
| 44 | + |
| 45 | +## renderFullScreenPlayer(srcElement, options) ⇒ <code>Object</code> |
| 46 | +Open a viewport-covering overlay with a large autoplaying video that |
| 47 | +expands out of `srcElement` (Mac-dock-genie style) and contracts |
| 48 | +back to it on close. Click on the dimmed backdrop, the close (×) |
| 49 | +button, or pressing Escape closes the overlay. |
| 50 | + |
| 51 | +Defaults: muted, autoplay, controls, preload="auto" (so the bytes |
| 52 | +stream while the open animation runs and the user can hit play |
| 53 | +straight away). Override via `options`. |
| 54 | + |
| 55 | +**Kind**: global function |
| 56 | +**Returns**: <code>Object</code> - Handle exposing a programmatic close. |
| 57 | + |
| 58 | +| Param | Type | Description | |
| 59 | +| --- | --- | --- | |
| 60 | +| srcElement | <code>HTMLElement</code> \| <code>jQuery</code> | Element the lightbox should expand from / contract back to. Used only for the source rect; not modified. | |
| 61 | +| options | <code>Object</code> | See createPlayer's options; additionally honours all the same player flags. `src` required. | |
| 62 | + |
0 commit comments