想研究研究这个玩玩。。。。
这是wecenter播放器里的优酷代码:
/**
* 优酷网
* http://v.youku.com/v_show/id_XMjI4MDM4NDc2.html
* http://player.youku.com/player.php/sid/XMjU0NjI2Njg4/v.swf
*/
private function _parseYouku($url)
{
preg_match("#id\_(\w+)#", $url, $matches);
if (empty($matches))
{
preg_match("#v_playlist\/#", $url, $mat);
if (!$mat)
return false;
$html = self::_fget($url);
preg_match("#videoId2\s*=\s*\'(\w+)\'#", $html, $matches);
if (!$matches)
return false;
}
$link = "http://v.youku.com/player/getPlayList/VideoIDS/{$matches[1]}/timezone/+08/version/5/source/out?password=&ran=2513&n=3";
$retval = self::_cget($link);
if ($retval)
{
$json = json_decode($retval, true);
$data['img'] = $json['data'][0]['logo'];
$data['title'] = $json['data'][0]['title'];
$data['url'] = $url;
$data['iframe'] = "http://player.youku.com/embed/{$matches[1]}";
return $data;
}
else
{
return false;
}
}
这是优酷开放平台给的代码:
<div id="youkuplayer" style="width:480px;height:400px"></div>
<script type="text/javascript" src="http://player.youku.com/jsapi">
player = new YKU.Player('youkuplayer',{
styleid: '9',
client_id: '这里省去duangduangduang',
vid: '替换成优酷视频ID',
autoplay: true,
show_related: false
});
function playVideo(){
player.playVideo();
}
function pauseVideo(){
player.pauseVideo();
}
function seekTo(s){
player.seekTo(s);
}
function currentTime(){
return player.currentTime();
}
</script>
阅读全文
收起全文