<?php
wp_embed_register_handler('brightcove', '#https?://players\.brightcove\.net/([\d]+)/([^/]+)/index\.html\?videoId=([\d]+)#', 'wp_embed_handler_brightcove');
function wp_embed_handler_brightcove( $matches, $attr, $url, $rawattr ) {
$account = esc_attr( $matches[ 1 ] );
$player = esc_attr( $matches[ 2 ] );
$video_id = esc_attr( $matches[ 3 ] );
$embed = '<div style="display: block; position: relative; max-width: 142.86%;"><div style="padding-top: 39.3742%;"><iframe src="'
. sprintf( 'http://players.brightcove.net/%1$s/%2$s/index.html?videoId=%3$s',
$account,
$player,
$video_id
) . '" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" style="width: 100%; height: 100%; position: absolute; top: 0px; bottom: 0px; right: 0px; left: 0px;"></iframe></div></div>';
return apply_filters( 'embed_brightcove', $embed, $matches, $attr, $url, $rawattr );
}
// TEST
// ===============================================
echo wp_oembed_get('http://players.brightcove.net/1234567890123/default_default/index.html?videoId=1234567789012');
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.