Skip to content

[html] 第156天 HTML5的video在有的移动端设备无法自动播放?怎么解决? #1221

Open

Description

@haizhilin2013

第156天 HTML5的video在有的移动端设备无法自动播放?怎么解决?

Activity

  1. mannymu commented on Sep 19, 2019

    @mannymu

    在chrome 也无法自动播放。。没有办法,无解

  2. Jianhang1015 commented on Sep 19, 2019

    @Jianhang1015

    介入微信的sdk, 然后调用skd内置的方法

  3. Xiaohantx commented on Sep 19, 2019

    @Xiaohantx

    正常浏览器下无解,微信内置浏览器,可以绑定WeixinJSBridgeReady实现自动播放

  4. chenyunping66 commented on Sep 19, 2019

    @chenyunping66

    避免自动播放浪费流量,手机网页访问带有audio的页面不能自动播放。
    一、利用微信的JSAPI的创建页面监听WeixinJSBridgeReady()是实现:
    <audio autoplay="autopaly" loop="loop" id="audios"> <source src="music/bng.mp3" type="audio/mp3" /> </audio>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script> document.addEventListener('WeixinJSBridgeReady', function() { document.getElementById('audios').play() }) </script>
    二、添加控制属性(controls),让用户手动触发
    <audio autopaly ="autoplay" loop="loop" id="audios" controls="controls"> <source src=".mp3音乐路径" type="audio/mp3"/> <audio>
    三、添加触摸监听,当用户打开浏览出,触摸屏幕事件来监听播放
    document.addEventLinstener('touchstart',function{ document.getEmlementById(“audios").play } )

  5. cq-wangyong commented on Sep 19, 2019

    @cq-wangyong

    我试了一下对于音频audio标签,可以用touchstart和WeixinJSBridgeReady的方法,但是视频video却不行啊,各位老哥也是这样么

  6. chenyunping66 commented on Sep 19, 2019

    @chenyunping66
  7. cq-wangyong commented on Sep 19, 2019

    @cq-wangyong

    试下 muted 这个属性呢
    …
    ------------------ 原始邮件 ------------------ 发件人: "cq-wangyong"notifications@github.com; 发送时间: 2019年9月19日(星期四) 下午5:32 收件人: "haizlin/fe-interview"fe-interview@noreply.github.com; 抄送: "云"1276830496@qq.com; "Comment"comment@noreply.github.com; 主题: Re: [haizlin/fe-interview] [html] 第156天 HTML5的video在有的移动端设备无法自动播放?怎么解决? (#1221) 我试了一下对于音频audio标签,可以用touchstart和WeixinJSBridgeReady的方法,但是视频video却不行啊,各位老哥也是这样么 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

    这个属性是静音,和自动播放没关系吧

  8. Children-look-word commented on Sep 20, 2019

    @Children-look-word

    我最近碰到 一个 video 问题 就是 我在内网上 用video标签播放下载地址,但是考虑到一些格式不支持播放,以及一些视频编码不一样,所以我考虑用video.js 纯粹滴 flash播放,但是好像有个问题就是不知道为什么我基本falsh的文件swf好像就是引入不进去,我已经放在啦内网本地文件中,而且也在video-falsh源码中滴swf 路径也去掉啦,但还是播放不出来。不知道是什么问题

  9. HUGY1 commented on Nov 30, 2019

    @HUGY1

    video不能自动播放的意义在于浏览器怕突然播放的声音会吓到人,设置muted静音是有一点作用的。但是大多数无解,只能曲线救国,设置播放按钮之类或者行为触发

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions