benecaster_episode_autoplay_enabled
Filters whether ?bc_autoplay=1 may start the player on a single episode page. Any link to an episode can carry the argument; the Email Editor adds it to the player link in its new-episode emails. With it, Benecaster tries to start the episode’s audio or video as the page loads, but never a video when Primary media is Video, and never a video preview. When the browser refuses, as Chrome, Safari and Firefox do for sound until the visitor has interacted with the site, a Click to play button appears at the top of the player and goes away once playback starts. The button has the class benecaster-autoplay-fallback and no styling of its own, so style it in your theme.
It never mutes the episode to get past the browser. An embedded player (an iframe from your host) is not started and gets no button. A locked page never autoplays. A theme that overrides episode/player.php keeps autoplay only if its template still fires benecaster_after_episode_player.
Return false to ignore the argument.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$enabled |
bool |
— | Whether the argument may start the player. Default `true`. |
$episode_id |
int |
— | ID of the episode being shown |
Returns:
bool
Examples
Turn autoplay off everywhere
add_filter( 'benecaster_episode_autoplay_enabled', '__return_false' );
Turn autoplay off for video episodes only
add_filter( 'benecaster_episode_autoplay_enabled', function ( bool $enabled, int $episode_id ): bool {
return $enabled && '' === (string) get_post_meta( $episode_id, '_benecaster_video_url', true );
}, 10, 2 );
Affects
- Episode page player
Need this built rather than just documented? See our services →