admin管理员组文章数量:1026989
html中显示优酷视频,html5
巴扎黑2017-04-17 12:10:441楼
看到上面的答案,可能有人会有雾水。我来补充一下。
如果使用ueditor,kineditor等富文本编辑器插入的视频,其默认是插入swf结尾的url
这个时候,html5是不支持的。
那么如何做呢?
在解析html5模板的时候,取出视频url地址,替换为通用html代码。
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 = "";
$message = substr($message,0,$matches[0][1]) .$embed. substr($message,$matches[0][1]+strlen($matches[0][0]));
}
}
return attach_youku($message);
}else{
return $message;
}
}
html中显示优酷视频,html5
巴扎黑2017-04-17 12:10:441楼
看到上面的答案,可能有人会有雾水。我来补充一下。
如果使用ueditor,kineditor等富文本编辑器插入的视频,其默认是插入swf结尾的url
这个时候,html5是不支持的。
那么如何做呢?
在解析html5模板的时候,取出视频url地址,替换为通用html代码。
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 = "";
$message = substr($message,0,$matches[0][1]) .$embed. substr($message,$matches[0][1]+strlen($matches[0][0]));
}
}
return attach_youku($message);
}else{
return $message;
}
}
本文标签: html中显示优酷视频Html5
版权声明:本文标题:html中显示优酷视频,html5 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1704970316a380843.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论