1. In WordPress, create a shortcode in your theme’s functions.php (or a small plugin):
function dejacast_live_player() {
$api_url = "https://api.dejacast.com/api/v1/publishers/359/live";
$api_key = "93b7cfaa23930ddfe962bf42bb36761a89b922a5edbedc8584ff0a452691a47f";
$args = [
'headers' => [
'API-Key' => $api_key,
'accept' => 'application/json',
],
'timeout' => 10,
];
$response = wp_remote_get( $api_url, $args );
if ( is_wp_error( $response ) ) {
return "
Error loading live stream.
"; } $decoded = json_decode( wp_remote_retrieve_body( $response ), true ); $playback_value = isset($decoded['data']) ? trim($decoded['data']) : ''; if ( $playback_value === '' ) { return "No live stream available.
"; } // Build the embed script URL with URL-encoded playback value $player_base = "https://app.dejacast.com/player/sfSx7z4W/live-wisetv.js"; $embed_src = $player_base . "?playbackURL=" . rawurlencode($playback_value); ob_start(); ?>
