[Home]

WebKit Autoplay Policy Tests

Tests which autoplay scenarios are allowed or blocked based on the current mediaTypesRequiringUserActionForPlayback configuration. Each test creates a media element and attempts to play it without user interaction.

1. Muted video autoplay

A <video> element with muted autoplay. Most browsers allow this by default.

Pending

2. Unmuted video autoplay

A <video> element with autoplay (not muted). Browsers with audio blocking will reject this.

Pending

3. Audio element autoplay

An <audio> element with autoplay. Should be blocked when audio autoplay is blocked.

Pending

4. Programmatic play() - muted video

A muted <video> element with play() called from script (no autoplay attribute).

Pending

5. Programmatic play() - unmuted video

An unmuted <video> element with play() called from script.

Pending

Expected results

Based on the WKAudiovisualMediaTypes value set on WKWebViewConfiguration.mediaTypesRequiringUserActionForPlayback.

Test [] (allow all) .audio .all
1. Muted videoAllowedAllowedAllowed*
2. Unmuted videoAllowedBlockedBlocked
3. Audio elementAllowedBlockedBlocked
4. play() mutedAllowedAllowedBlocked
5. play() unmutedAllowedBlockedBlocked

* WebKit exempts muted video with the autoplay attribute from restrictions regardless of configuration. Programmatic play() on muted video (test 4) is still blocked under .all.