移动端遇到的问题小结--video

本篇主要是针对Android系统,所遇到的问题。

  • 1. video的全屏处理:

  这里说的全屏是指针对浏览器的全屏,而不是整个手机的全屏。要想全屏效果只需对video标签加   webkit-playsinline 。

  但是这样做会有一个问题:针对偏长的手机,视频会出现居中的效果。针对这种情况,可以对video加属性  object-fit:fill 

<video id="myvideo" src="test.mp4" webkit-playsinline="true" object-fit:fill></video>
  • 2. video的自动播放

  自动播放是指页面加载完毕后,视频自动开始播放。但是目前而言,Android机是不支持这种自动播放的。

  解决办法:引导用户触发滑屏或者touch事件进行触发 video.play()  进行播放

  • 3.移动端设置1px的border:

  为解决兼容问题,以下为固定代码。代码放置在需要写border的容器的css样式里面。

  background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), color-stop(.5, #ffffff), color-stop(.5, transparent)) top left no-repeat, -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#ffffff)) bottom left no-repeat, -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), color-stop(.5, #e8e8e8), color-stop(.5, transparent)) top left no-repeat, -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#e8e8e8)) bottom left no-repeat, #ffffff;
  background: -webkit-linear-gradient(90deg, #ffffff, #ffffff) top left no-repeat, -webkit-linear-gradient(270deg, #ffffff, #ffffff) bottom left no-repeat, -webkit-linear-gradient(90deg, #e8e8e8, #e8e8e8, rgba(232, 232, 232, 0)) top left no-repeat, -webkit-linear-gradient(270deg, #e8e8e8, #e8e8e8, rgba(232, 232, 232, 0)) bottom left no-repeat, #ffffff;
  background: linear-gradient(0deg, #ffffff, #ffffff) top left no-repeat, linear-gradient(180deg, #ffffff, #ffffff) bottom left no-repeat, linear-gradient(0deg, #e8e8e8, #e8e8e8, rgba(232, 232, 232, 0)) top left no-repeat, linear-gradient(180deg, #e8e8e8, #e8e8e8, rgba(232, 232, 232, 0)) bottom left no-repeat, #ffffff;
  -webkit-background-size: 0 0, 0 0, 0 0, 100% 1px;

  PS:同时可参考该链接:https://zhuanlan.zhihu.com/p/26141351

  • 4.移动端页面左右滑屏问题
     
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">

     

转载于:https://www.cnblogs.com/waterFowl/p/9540783.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值