修复Ooyala的嵌入视频代码

时间:2013-04-17 03:48:50

标签: video ooyala

我正在使用自定义构建主题的Wordpress。

我可以选择发布格式,如音频,视频,报价等。

当我选择我的帖子作为视频时,它会显示两个选项视频网址,视频嵌入代码。

在视频嵌入代码中,如果我从Youtube中添加嵌入代码,则可以使用。但主要问题是我在Ooyala.com上传了我的视频。当我从ooyala插入我的html嵌入代码。它不显示视频,只显示代码。(无视频)

在浏览了我的主题代码之后,我遇到了这个代码,它将嵌入代码转换为

function wpbandit_video_wmode_transparent($html, $url, $attr) {
if ( strpos( $html, "<embed src=" ) !== false ) {
    $html = str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html);
} elseif ( strpos ($html, 'feature=oembed') !== false ) {
    $html = str_replace('feature=oembed', 'feature=oembed&wmode=opaque', $html);
} 
    return $html;
}
    add_filter('embed_oembed_html','wpbandit_video_wmode_transparent',10,3);

/**
    Add container to default video embeds
**/
function wpbandit_embed_oembed_html($html, $url, $attr, $post_id) {
    return '<div class="video-container">' . $html . '</div>';
}
add_filter('embed_oembed_html', 'wpbandit_embed_oembed_html', 99, 4);

我从ooyala获得的代码因为我的视频嵌入代码是这样的:

<script src='https://player.ooyala.com/v3/84b6e4bac6d945439a38bdfff895a0fd'></script>    <div id='ooyalaplayer' style='width:1280px;height:720px'></div><script>OO.ready(function() {     OO.Player.create('ooyalaplayer', 'N5MG1rYTpsId-Q4ZlUy1JEykqD5QMWEN'); });</script><noscript>    <div>Please enable Javascript to watch this video</div></noscript>

请帮帮我。

1 个答案:

答案 0 :(得分:2)

尝试安装我们的Wordpress插件:http://wordpress.org/extend/plugins/ooyala-video-browser/