Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add some FAQ entries #7609

Merged
merged 5 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/guides/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
* [Q: Can Video.js be required in node.js?](#q-can-videojs-be-required-in-nodejs)
* [Q: Does Video.js work with webpack?](#q-does-videojs-work-with-webpack)
* [Q: Does Video.js work with react?](#q-does-videojs-work-with-react)
* [Q: Can the big play button be centered?](#q-can-the-big-play-button-be-centered)
* [Q: Can the big play button be shown when paused?](#q-can-the-big-play-button-be-shown-when-paused)
* [Q: Why is the picture-in-picture button different in Firefox?](#q-why-is-the-picture-in-picture-button-different-in-firefox)

## Q: What is Video.js?

Expand Down Expand Up @@ -273,6 +276,18 @@ Yes! See the [Webpack and Video.js configuration guide][webpack-guide].

Yes! See [ReactJS integration example][react-guide].

## Q: Can the big play button be centered?

The default skin offsets the button to not obscure the poster image, but just add a `vjs-big-play-centered` class to the player to have it centred.

## Q: Can the big play button be shown when paused?

Add a `vjs-show-big-play-button-on-pause` class to the player to display the button when paused.

## Q: Why is the picture-in-picture button different in Firefox?

Firefox does not support the HTML video Picture-in-Picture (PIP) API, so it is not possible to have a custom button in the Video.js controls. Firefox has its own overlay PIP button, and its [own logic for whether to display it][firefox-pip].

[ads]: https://github.com/videojs/videojs-contrib-ads

[audio-tracks]: /docs/guides/audio-tracks.md
Expand All @@ -293,6 +308,8 @@ Yes! See [ReactJS integration example][react-guide].

[eme]: https://github.com/videojs/videojs-contrib-eme

[firefox-pip]: https://firefox-source-docs.mozilla.org/toolkit/components/pictureinpicture/pictureinpicture/index.html#the-picture-in-picture-toggle

[flash-eol]: https://www.adobe.com/products/flashplayer/end-of-life.html

[generator]: https://github.com/videojs/generator-videojs-plugin
Expand Down
19 changes: 19 additions & 0 deletions docs/guides/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [Problems with playback](#problems-with-playback)
* [Video.js Errors](#videojs-errors)
* [vdata123456 errors](#vdata123456-errors)
* [Problems with setup options](#problems-with-setup-options)

## Problems with media formats

Expand Down Expand Up @@ -89,6 +90,24 @@ a component.

To fix this issue please make sure that all event listeners are cleaned up on dispose.

## Problems with setup options

If a player is inititalized without the expected setup options, it's usually because of using both the `data-setup` attribute and the `videojs()` constructor. Take this example:

```html
<video-js id="my_video" data-setup='{"autoplay": "any"}'></video-js>

<script>
const myPlayer = videojs('my_video');
</script>
```

Here you might expect the player to be initialized with the `autoplay` option set, but it will not be. While Video.js sets up player embeds that have a `data-setup` attribute automatically when the page is loaded, in this case the player will have _already been setup_ in the script tag. The `data-setup` option will never be applied.

This can be more confusing if `videojs('my_video')` is used in an async script as different behavior will occur depending on when the script is executed.

It's better to not use `data-setup` and use the `videojs()` constructor once to set up the player, and/or only use the explicit getter `videojs.getPlayer('my_video')` to get a player reference.

mister-ben marked this conversation as resolved.
Show resolved Hide resolved
[hosting-media]: #problems-when-hosting-media

[text-tracks]: /docs/guides/text-tracks.md
Expand Down