Autostarting on Page Load

This article explains how to automatically start playback of your media on page load. Here is an example:

 

Since autostarting with audio can be a jarring experience for viewers, we've also configured the above player to mute the media by default. Please note: Safari 11 blocks autoplay content with sound by default. You must go into Safari preferences and change this setting to 'Allow All Auto-Play' to get autostart to work. See below for a detailed explanation of the player's behavior given the new browser changes.

Note that autostarting on mobile phones(Android, iOS) is supported as of JW 7.8 when the player is muted. If you're running a preroll, setting autoplayadsmuted:true will mute the player to allow the ad and content to play.

Embed code

As always, ensure you have uploaded a copy of JW Player and included the script in the <head> of your page, together with your player key. See an embedding guide like Basic Video Embed for more info. Next, place the following embed code at the location you want the player to appear:

<div id="myElement"></div>

<script>
var playerInstance = jwplayer("myElement");
    playerInstance.setup({
      file: "/uploads/myVideo.mp4",
      width: 640,
      height: 270,
      autostart: true,
      mute: true //optional, but recommended
    });
</script>

Safari 11 Auto-Play Restrictions

Safari 11 has introduced a new page-level setting allowing the viewer to choose to "Allow all Auto-Play", "Stop Media with Sound", and "Never Auto-Play". The default is "Stop Media with Sound". Because of the nature of video players, specifically video players with ads, the "never" and "only when muted" options impact many use cases for our customers.

Please note: the following applies to JW 8. Behavior in the latest version of JW 7 is impacted significantly more.

Click-to-play Impact

Safari 11 inadvertantly impacted click-to-play in the following scenarios:

Mute State Ad Plugin Browser Setting Behavior
Muted IMA Never autoplay Click to start playback, ad plays, click to start content
Not muted IMA Never autoplay Click to start playback, ad plays, click to start content
Not muted IMA Autoplay only when muted Click to start playback, ad plays, click to start content

For all of the above, one would expect the initial click to carry through to the end but that is not the case, regardless of the mute state of the player or browser setting. At this time, the JW Player team is investigating potential solutions. One current workaround is to change your "preload" setting to "none" via the dashboard or your player setup config.

Autostart Impact

Safari 11 also impacted autostart in the following scenarios:

Mute State Ad Plugin Browser Setting Behavior
Muted VAST Never autoplay Player automatically starts playback, click to start ad playback, content starts automatically*
Not muted VAST Never autoplay Player automatically starts playback, click to start ad playback, content starts automatically*
Not muted VAST Autoplay only when muted Player automatically starts playback, click to start ad playback, content starts automatically
Muted IMA Never autoplay Player automatically starts playback, click to start ad playback, click to start content
Not muted IMA Never autoplay Player automatically starts playback, click to start ad playback, click to start content
Not muted IMA Autoplay only when muted Player automatically starts playback, click to start ad playback, click to start content

Regarding the above scenarios, the first 3 cases are expected functionality given the choice of browser setting. For the latter 3, you'll notice they're the same behavior as the click-to-play scenarios. At this time, the JW Player team is investigating potential solutions to have the initial click (to start the ad playback) pass through to the content, matching the first 3 scenarios' expected functionality.

* Scenarios with an asterisk have a known issue currently being worked on by the JW Player team.

So where does that leave things?

While JW Player can't make any recommendations given various monetization strategies across the industry, we can note the use cases least-impacted by these changes. Given the default is "Stop Media with Sound" running muted ads is the easiest way to have your ads play without a user interaction. Since advertisers typically don't like their ads to be muted, if you choose to not mute your ads, users are going to have to generate a user action to start playback on the ad.

If the user chooses to actively change their setting for your page to "Never Auto-Play" there's no way around getting autostart to work without a user interaction.

Note: Chrome will also be implementing similar functionality (albeit less restrictive changes) in Chrome 64 in January 2018.

Did you find this article helpful?

Please log in to rate this article.