<?php

/**
 * The template for displaying the trailer player
 *
 * This template can be overridden by copying it to yourtheme/movie-engine/global/trailer-player.php.
 *
 * @package MovieEngine
 * @version 1.0.0
 */

if (! defined("ABSPATH")) {
    exit; // Exit if accessed directly
}

$trailer_url = $args['trailer_url'] ?? '';
$post_id     = $args['post_id'] ?? get_the_ID();
$backdrop    = get_post_meta($post_id, '_movie_engine_backdrop_url', true);
if (! $backdrop) {
    $backdrop = get_the_post_thumbnail_url($post_id, 'full');
}
?>
<div class="movie-engine-player-wrapper me-trailer-cta-wrapper" style="background-image: url('<?php echo esc_url($backdrop); ?>');">
    <div class="me-trailer-cta-overlay"></div>
    <div class="me-trailer-cta-content">
        <div class="me-player-tip">
            <span class="fa-solid fa-circle-info" aria-hidden="true"></span>
            <?php esc_html_e('Full movie not yet available', 'cine-movie-engine'); ?>
        </div>
        <h3><?php esc_html_e('Watch the Official Trailer', 'cine-movie-engine'); ?></h3>
        <button type="button" class="movie-engine-btn movie-engine-btn-primary me-open-trailer" data-url="<?php echo esc_url($trailer_url); ?>">
            <span class="fa-solid fa-play" aria-hidden="true"></span>
            <?php esc_html_e('PLAY TRAILER', 'cine-movie-engine'); ?>
        </button>
    </div>
</div>
<?php