Wordpress JW播放器无法正常运行

时间:2013-09-18 07:01:14

标签: wordpress

我正在尝试使用wordpress中的外部媒体添加vimeo视频,视频链接为http://vimeo.com/74626703,但显示为错误加载播放器: 找不到可玩的来源,所以我应该帮忙。

function draw_video_contents($paged) {
global $post, $cat;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts(array('cat' => $cat . ',-' . CALENDAR_CATEGORY_ID, 'paged' => $paged,  'showposts' => 9));

$data = array();

// to display the entire text
global $more;    // Declare global $more (before the loop).
$more = 1;

if (have_posts()) : while (have_posts()) : the_post();
        $i++;

        ob_start();
        the_category(' ,');
        $categories = ob_get_clean();


        $data[] = array(
            "id" => $post->ID,
            "title" => get_the_title($post->ID),
            "link" => get_permalink($post->ID),
            "excerpt" => get_the_excerpt(),
            "description" => get_the_content(),
            "categories" => $categories,
            "tags" => get_the_tag_list('Tags: ', ', ', ''),
            "date" => get_the_time('M d y @ g:i A'),
            "author" => get_the_author_link(),
        );

    endwhile;
endif;


// Read the jwplayer tag into the posts, to get the mediaid
$media_id_list = array();
$video_list = array();


foreach ($data as $i => $d) {

    if (preg_match('/\[jwplayer mediaid="(\d*)".*\]/', $d['description'], $match)) {
        $mediaid = $match[1];
        $media_id_list[] = $mediaid;
        $data[$i]['mediaid'] = $mediaid;
        $data[$i]['mediatype'] = "jwplayer";
    } elseif (preg_match('/\[jwplayer file="(.*?)".*\]/', $d['description'], $match)) {
        $mediaid = $match[1];
        $data[$i]['mediaid'] = $mediaid;
        $data[$i]['mediatype'] = "jwplayer-file";
    } elseif (preg_match('#<iframe.*?src="(?:.*youtu.*?/embed/(.*?))".*?>#', $d['description'], $match)) {


        $mediaid = $match[1];
        list( $mediaid ) = explode("?", $mediaid);
        $data[$i]['mediaid'] = $mediaid;
        $data[$i]['mediatype'] = "youtube";
    } elseif (preg_match('#<iframe.*?src="(//player.vimeo.com/video/.*?)".*?>#',  $d['description'], $match)) {
        $mediaid = $match[1];
        $data[$i]['mediaid'] = $mediaid;
        $data[$i]['mediatype'] = "vimeo";
    }
}

// create the list of mediaid to use in the query
if ($query_in_media = implode(',', $media_id_list)) {
    global $wpdb;

    // get the mediafile URLs
    $request = "SELECT guid, ID
                    FROM wp_posts p
                    WHERE ID IN ($query_in_media)";

    $result = $wpdb->get_results($request);
    $media_list = array();
    foreach ($result as $r) {
        $media_list[$r->ID] = $r->guid;
    }

    // assign to $data the media_file
    foreach ($data as $i => $d) {
        if ($d['mediaid'] && isset($media_list[$d['mediaid']]))
            $data[$i]['media_file'] = $media_list[$d['mediaid']];
    }
}


$hugeImageSize = array('h' => 509, 'w' => 1024);
$smallVideoImageSize = array('h' => 167, 'w' => 256);

$largeImageSize = array('h' => 289, 'w' => 681);
$smallImageSize = array('h' => 205, 'w' => 340);
?>

 <div class="subHeaderBottomBorder"></div>

 <?php
 echo drawVideoItem($data[4], $hugeImageSize, "main");
 ?>
 <div class="videoCarousel">
    <ul id="videoCarousel">
    <?php echo drawSmallVideoItem($data[1], $smallVideoImageSize); ?> 
    <?php echo drawSmallVideoItem($data[2], $smallVideoImageSize); ?> 
    <?php echo drawSmallVideoItem($data[3], $smallVideoImageSize); ?> 

 <?php echo drawSmallVideoItem($data[5], $smallVideoImageSize); ?>  
 <?php echo drawSmallVideoItem($data[6], $smallVideoImageSize); ?>    
 <?php echo drawSmallVideoItem($data[7], $smallVideoImageSize); ?> 
    <?php echo drawSmallVideoItem($data[8], $smallVideoImageSize); ?>
 <?php echo drawSmallVideoItem($data[9], $smallVideoImageSize); ?> 
    </ul>
</div>
<div class="paginationWrapper">
    <a href="javascript:void(0);" class="previous">Previous</a>
    <a href="javascript:void(0);" class="next">Next</a>
</div>
</div>

1 个答案:

答案 0 :(得分:0)

您是否尝试过短代码?

[vimeo http://vimeo.com/44633289] doesn't work for me.

[embed]http://vimeo.com/9308198[/embed] works for me.

您还可以在此处查看说明:http://en.support.wordpress.com/videos/vimeo/

P.S。什么外部媒体?你在使用一些自定义插件吗?您只需切换到html-edit模式并将链接粘贴到vimeo。

如果仍然无效,请尝试切换到默认主题并查看问题是否仍然存在。

enter image description here

enter image description here

enter image description here

这就是我能为你做的一切,基本上蒙着眼睛:)