移动端video标签播放视频,如何在video标签中引用优酷视频的地址,做到可以在手机网页上播放,就像在优酷客户端上播放一样
巴扎黑2017-04-17 12:10:44
Youku player can be used.
http://cloud.youku.com/tools?qq-pf-to=pcqq.c2c
巴扎黑2017-04-17 12:10:44
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;
}
}