效果截图:
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;
}
<video
style=”object-fit:contain;background-color:#fff;”
id=”my-video”
class=”video-js”
controls
preload=”auto”
<? if(get_device_type()==”android”){
?>
height=”175″
<?
}elseif(get_device_type()==”ios”){
?>
height=”205″
<?
}
?>
data-setup=”{}”
poster = “<?%20echo%20$rowme[“imagepath88″];?>”
>
<source src=”<?%20echo%20$rowme[“imagepath07″];?>” type=”video/mp4″ />
<p class=”vjs-no-js”>
To view this video please enable JavaScript, and consider upgrading to a
web browser that
<a href=”#34;%20target=”_blank”
>supports HTML5 video</a
>
</p>
</video>