Last active
November 1, 2023 18:49
-
-
Save joedolson/c4fdc966e1d29c2ca38fcaa08fa37064 to your computer and use it in GitHub Desktop.
Load Wowza in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Embed a Wowza streaming player in WordPress. Maps the `$` function to `jQuery.noConflict()` before running embed so that variable is available. | |
* Usage: [wowza url="//player.video.wowza.com/hosted/WOWZA_ID/wowza.js"] | |
* | |
* @param array $atts Shortcode attributes. | |
* @param string $content Container content. Not used. | |
* | |
* @return string | |
*/ | |
function embed_wowza( $atts, $content ) { | |
$atts = shortcode_atts( | |
array( | |
'url' => '', | |
), | |
$atts, | |
'wowza' | |
); | |
if ( ! $atts['url'] ) { | |
return ''; | |
} | |
return "<script>(function (jQuery) {window.$ = jQuery.noConflict();})(jQuery);</script> | |
<div id='wowza_player'></div><script id='player_embed' src='" . esc_url( $atts['url'] ) . "' type='text/javascript'></script>"; | |
} | |
add_shortcode( 'wowza', 'embed_wowza' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment