zoukankan      html  css  js  c++  java
  • 移动端遇到的问题小结--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">
  • 相关阅读:
    函数式编程思想:不变性
    如何制作JQuery Plugin 插件【插件参数的配置】
    jQuery Mobile 中文手册 Ajax开发版——初始化部分
    转载:真实的用户,真实的中国互联网
    创建自定义的jQuery移动主题
    HTML5 LocalStorage 本地存储
    Safari调试工具
    为什么项目经理拿的钱比程序员多?
    移动浏览器项目WebApp需要jQuery吗?移动设备放弃jQuery的理由
    HTML5设计原则
  • 原文地址:https://www.cnblogs.com/waterFowl/p/9540783.html
Copyright © 2011-2022 走看看