video 兼容性问题处理(小程序webview全屏横屏后样式错

2022-03-15  本文已影响0人  申_9a33

这里讨论的是Chrome,Safari,以及小程序嵌套webview 里面使用video标签的一些问题

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
</style>
<body>
    <div>
        <video
            width="100%" 
            height="auto" 
            src="http://101.36.105.242:9000/public-bucket/%E6%B5%8B%E8%AF%95%E6%AD%A3%E8%A7%84%E8%A7%86%E9%A2%91.mp4"
            autoplay
            controls
        />
    </div>
</body>
</html>

1.video背景色不统一问题

<style>
    video{
        background-color: black;
    }
</style>

2.小程序webview全屏横屏后样式错乱

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    video{
        width: 100%;
        object-fit: contain;
        background-color: black;
    }
</style>
<body>
    <div>
        <video
            width="100%" 
            height="auto" 
            src="http://101.36.105.242:9000/public-bucket/%E6%B5%8B%E8%AF%95%E6%AD%A3%E8%A7%84%E8%A7%86%E9%A2%91.mp4"
            preload="none"
            x5-video-player-type="h5-page"
            webkit-playsinline="true"
            playsinline
            x-webkit-airplay="allow"
            mtt-playsinline="true"
            autoplay
            controls
        />
    </div>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读