Skip to content

Commit

Permalink
docs(faq): add a question about autoplay (#3898)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev authored Jan 3, 2017
1 parent 9c74116 commit e5a240a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* [If you don't think you can fix the issue or add the feature](#if-you-dont-think-you-can-fix-the-issue-or-add-the-feature)
* [Q: What is a reduced test case?](#q-what-is-a-reduced-test-case)
* [Q: What media formats does video.js support?](#q-what-media-formats-does-videojs-support)
* [Q: How to I autoplay the video?](#q-how-to-i-autoplay-the-video)
* [Q: How can I autoplay a video on a mobile device?](#q-how-can-i-autoplay-a-video-on-a-mobile-device)
* [Q: How can I play RTMP video in video.js?](#q-how-can-i-play-rtmp-video-in-videojs)
* [Q: How can I hide the links to my video/subtitles/audio/tracks?](#q-how-can-i-hide-the-links-to-my-videosubtitlesaudiotracks)
* [Q: What is a plugin?](#q-what-is-a-plugin)
Expand Down Expand Up @@ -117,6 +119,39 @@ techs made available to video.js. For example, video.js 5 includes the Flash tec
enables the playback of FLV video where the Flash plugin is available. For more information
on media formats see the [troubleshooting guide][troubleshooting].

## Q: How to I autoplay the video?

Video.js supports the standard html5 `autoplay` attribute on the video element.
It also supports it as an option to video.js or as a method invocation on the player.

```html
<video autoplay controls class="video-js">
```

```js
var player = videojs('my-video', {
autoplay: true
});

// or

player.autoplay(true);
```

### Q: How can I autoplay a video on a mobile device?

Most mobile devices have blocked autoplaying videos until recently.
For mobile devices that don't support autoplaying, autoplay isn't supported by video.js.
For those devices that support autoplaying, like iOS10 and Chrome for Android 53+,
you must mute the video or have a video without audio tracks to be able to play it.
For example:

```html
<video muted autoplay playsinline>
```

Will make an inline, muted, autoplaying video on an iPhone with iOS10.

## Q: How can I play RTMP video in video.js?

Make sure that the Flash tech is available -- RTMP is not playable on browsers without Flash including mobile. Then, just set the rtmp source with
Expand Down

0 comments on commit e5a240a

Please sign in to comment.