开发技巧:php根据ios或安卓设置video.js宽度

2022-10-11 21:09:17 114 0
魁首哥

效果截图:

php代码:

function get_device_type()

{

//全部变成小写字母

$agent = strtolower($_SERVER[‘HTTP_USER_AGENT’]);

$type = ‘other’;

//分别进行判断

if(strpos($agent, ‘iphone’) || strpos($agent, ‘ipad’))

{

$type = ‘ios’;

}

if(strpos($agent, ‘android’))

{

$type = ‘android’;

}

return $type;

}

style=”object-fit:contain;background-color:#fff;”

id=”my-video”

class=”video-js”

controls

preload=”auto”

?>

height=”175″

}elseif(get_device_type()==”ios”){

?>

height=”205″

}

?>

data-setup=”{}”

poster = “

>

” type=”video/mp4″ />

To view this video please enable JavaScript, and consider upgrading to a

web browser that

>supports HTML5 video

>

收藏
分享
海报
0 条评论
114
上一篇:php 中高级面试题(经典) 下一篇:每天一个常用PHP函数-array_column

本站已关闭游客评论,请登录或者注册后再评论吧~

忘记密码?

图形验证码