wordpress で外部メディアを使用して vimeo ビデオを追加しようとしています。ビデオ リンクは http://vimeo.com/74626703ですが、Error loading player: No playable sources found として表示されます。
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>