# Autoplay
Configure ByteArk Player to start playback automatically. Modern browsers have stricter autoplay policies, for example:
- Autoplay is allowed when the video is muted
- Autoplay is allowed for sites the viewer visits frequently
- Autoplay is blocked without prior user interaction
Browser-specific autoplay policies:
# Configuration
# Autoplay setting
Set the autoplay field in options when initializing ByteArk Player. The autoplay value accepts:
| Value | Type | Description |
|---|---|---|
| 'any' | String | The player tries to autoplay (see note below) |
| true | Boolean | Autoplay only if the browser allows playback with sound |
| false | Boolean | Disable autoplay |
| 'viewable' | String | Autoplay when the player is visible on screen |
| 'focus' | String | Autoplay when visible, pause when scrolled out of view |
Note
With autoplay: 'any' ByteArk Player tries to autoplay using this fallback strategy:
- Try unmuted playback. If the browser allows it, autoplay with sound.
- If unmuted is blocked, try muted playback.
- If both fail, the viewer must click to start playback.
Flow for autoplay: 'any':

(Image from Google IMA SDK (opens new window))
# Autoplay with ads
When using Advertisement, set autoplayadsmuted to allow the player to start playback properly:
| Value | Type | Description |
|---|---|---|
| true | Boolean | Start muted when a preroll ad is present |
| false | Boolean | Don't allow muted ad playback (may prevent autoplay) |
# Recommended settings
Recommendation
For the best chance of autoplay, set autoplay to any and autoplayadsmuted to true.
# Example
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div id="video-player"></div>
<script src="https://byteark-sdk.cdn.byteark.com/player/v2/byteark-player.min.js"></script>
<script>
var player = bytearkPlayer('video-player', {
fluid: true,
autoplay: 'any',
autoplayadsmuted: true,
poster: '/assets/samples/player/images/poster-big-buck-bunny.jpg',
sources: [{
title: 'Big Buck Bunny',
src: 'https://byteark-playertzxedwv.stream-playlist.byteark.com/streams/TZyZheqEJUwC/playlist.m3u8',
type: 'application/x-mpegURL'
}],
plugins: {
bytearkAds: {
adTagUrl: '<AD_TAG_URL>',
}
}
});
</script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28