<?php
define('WP_USE_THEMES', false);
require('../../../wp-load.php');

echo "=== Testing Direct Stream URL ===\n\n";

$profile_url = 'https://www.youtube.com/@NashvilleBirdCam';
$player_url = 'https://www.youtube.com/watch?v=ithwtp7aJlM';
$youtube_channel_id = 'UClOWy1mPxNB1D3cpmmxqGEg';

echo "Profile URL: $profile_url\n";
echo "Player URL: $player_url\n";
echo "Channel ID: $youtube_channel_id\n\n";

$data = mm_video_get_livestream_data($profile_url, $player_url, $youtube_channel_id);

echo "=== Result ===\n";
print_r($data);

echo "\n=== Key Fields ===\n";
echo "Platform: " . ($data['platform'] ?? 'NOT SET') . "\n";
echo "Video ID: " . ($data['video_id'] ?? 'NOT SET') . "\n";
echo "Embed URL: " . ($data['embed_url'] ?? 'NOT SET') . "\n";

if (!empty($data['video_id']) && !empty($data['embed_url'])) {
    echo "\n✓ SUCCESS - Both video_id and embed_url are set!\n";
} else {
    echo "\n✗ FAILURE - Missing video_id or embed_url\n";
}
