Skip to main content

Turn the video preview off, or serve your own clip

Free Beginner

Each episode’s Video preview decides what a locked visitor sees. This filter overrides it in code, for example to give every episode of a show the same trailer. Return [] for no preview. It runs for visitors who failed the access check, so whatever you return is what they can get.

A file with start and end carries the file’s address in the page, whatever the times: that is a teaser, not protection. Only a separate clip keeps the full video away.

Code

<?php
// Every episode of show 12 previews the same trailer.
add_filter( 'benecaster_episode_preview_video', function ( array $preview, int $episode_id, int $show_id ): array {
    if ( 12 !== $show_id ) {
        return $preview;
    }
    return [ 'source' => 'file', 'url' => 'https://cdn.example.com/trailer.mp4', 'start' => 0, 'end' => 0 ];
}, 10, 3 );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →