Skip to content

Commit

Permalink
Minor formatting cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
misteroneill committed Dec 2, 2016
1 parent 5cfdcad commit e6a964a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
3 changes: 0 additions & 3 deletions docs/guides/player-workflows.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Player Workflows

This document outlines many considerations for using Video.js for advanced player workflows. Be sure to read [the setup guide](setup.md) first!

## Removing Players

No matter the term used for it, web applications are becoming common. Not everything is a static, load-once-and-done web page anymore! This means that developers need to be able to manage the full lifecycle of a video player - from creation to destruction. Video.js supports player removal through the `dispose()` method.

### [`dispose()`](http://docs.videojs.com/docs/api/player.html#Methodsdispose)

This method is available on all Video.js players and [components](http://docs.videojs.com/docs/api/component.html#Methodsdispose). It is _the only_ supported method of removing a Video.js player from both the DOM and memory. For example, the following code sets up a player and then disposes it when media playback is complete:

```js
Expand Down
9 changes: 0 additions & 9 deletions docs/guides/setup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Video.js Setup

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Expand All @@ -16,15 +15,13 @@
<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Getting Video.js

Video.js is officially available via CDN, npm, and Bower.

Video.js works out of the box with not only HTML `<script>` and `<link>` tags, but also all major bundlers/packagers/builders, such as Browserify, Node, WebPack, etc.

Please refer to the [Getting Started][getting-started] document for details.

## Creating a Player

> **Note:** Video.js works with `<video>` _and_ `<audio>` elements, but for simplicity we'll refer only to `<video>` elements going forward.
Once you have Video.js [loaded on your page][getting-started], you're ready to create a player!
Expand All @@ -41,7 +38,6 @@ Video.js supports all attributes of the `<video>` element (such as `controls`, `
```

### Automatic Setup

By default, when your web page finishes loading, Video.js will scan for media elements that have the `data-setup` attribute. The `data-setup` attribute is used to pass options to Video.js. A minimal example looks like this:

```html
Expand All @@ -54,7 +50,6 @@ By default, when your web page finishes loading, Video.js will scan for media el
> **Note:** You _must_ use single-quotes with `data-setup` as it is expected to contain JSON.
### Manual Setup

On the modern web, a `<video>` element often does not exist when the page finishes loading. In these cases, automatic setup is not possible, but manual setup is available via [the `videojs` function][videojs].

One way to call this function is by providing it a string matching a `<video>` element's `id` attribute:
Expand Down Expand Up @@ -84,7 +79,6 @@ videojs(document.querySelector('.video-js'));
```

## Options

> **Note:** This guide only covers how to pass options during player setup. For a complete reference on _all_ available options, see the [options guide](options.md).
There are three ways to pass options to Video.js. Because Video.js decorates an HTML5 `<video>` element, many of the options available are also available as [standard `<video>` tag attributes][video-attrs]:
Expand All @@ -110,7 +104,6 @@ videojs('my-player', {
```

### Global Defaults

Default options for all players can be found at `videojs.options` and can be changed directly. For example, to set `{autoplay: true}` for all future players:

```js
Expand Down Expand Up @@ -140,7 +133,6 @@ These are correct:
```

## Player Readiness

Because Video.js techs have the potential to be loaded asynchronously, it isn't always safe to interact with a player immediately upon setup. For this reason, Video.js players have a concept of "readiness" which will be familiar to anyone who has used jQuery before.

Essentially, any number of ready callbacks can be defined for a Video.js player. There are three ways to pass these callbacks. In each example, we'll add an identical class to the player:
Expand Down Expand Up @@ -177,7 +169,6 @@ player.on('ready', function() {
In each case, the callback is called asynchronously - _even if the player is already ready!_

## Advanced Player Workflows

For a discussion of more advanced player workflows, see the [player workflows guide](player-workflows.md).


Expand Down

0 comments on commit e6a964a

Please sign in to comment.