html5 - h5页面上如何播放优酷视频
大家讲道理
大家讲道理 2017-04-17 12:08:44
0
4
1173

移动端video标签播放视频,如何在video标签中引用优酷视频的地址,做到可以在手机网页上播放,就像在优酷客户端上播放一样

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(4)
巴扎黑

巴扎黑

Youku player can be used.
http://cloud.youku.com/tools?qq-pf-to=pcqq.c2c

Peter_Zhu

Just embed the first iframe universal code

巴扎黑

Some people may be confused after seeing the above answer. Let me add something.

If you use rich text editors such as ueditor and kineditor to insert videos, the default is to insert the URL ending in swf
At this time, html5 is not supported.

So how to do it?
When parsing the html5 template, take out the video url address and replace it with the general html code.

function attach_youku($message){

    $pattern = "/\[media\](.*?)\[\/media\]/ies";
    if(strpos($message, '[/media]') !== FALSE) {
        preg_match($pattern,$message,$matches,PREG_OFFSET_CAPTURE);
        if($matches){
            preg_match("/\/sid\/(.*)\/v.swf/i",$matches[0][0],$urlMatches);
            if($urlMatches){
                $embed = "<iframe height='100%' width='100%' src='http://player.youku.com/embed/{$urlMatches[1]}' frameborder=0 'allowfullscreen'></iframe>";
                $message = substr($message,0,$matches[0][1]) .$embed. substr($message,$matches[0][1]+strlen($matches[0][0]));
            }
        }
        return attach_youku($message);
    }else{
        return $message;
    }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!