<?php
header('Content-Type: application/json');
include("conex.php");

$resultado = mysqli_query($conex, "SELECT id, video FROM tb_video WHERE activo = 1");

$videos = [];

// Agrega una opción vacía al inicio
$videos[] = [
    "id" => "",
    "video" => "--- Seleccione ---"
];

while ($row = mysqli_fetch_assoc($resultado)) {
    $videos[] = [
        "id" => $row["id"],
        "video" => $row["video"]
    ];
}

echo json_encode($videos, JSON_UNESCAPED_UNICODE);
?>
