为了账号安全,请及时绑定邮箱和手机立即绑定

在mac 谷歌浏览器下,提示错误play() failed because the user didn't interact with the document first.

   componentDidMount() {
        $("#player").jPlayer({
            ready:  function(){
                $(this).jPlayer("setMedia", {
                    'mp3': 'spacer.gifhttp://oj4t8z2d5.bkt.clouddn.com/%E9%AD%94%E9%AC%BC%E4%B8%AD%E7%9A%84%E5%A4%A9%E4%BD%BF.mp3',
                }).jPlayer('play');
            },
            supplied: "mp3",
            vmode: "window",
            size:{
                width:"640px",
                height:"396px",
                cssClass:"jp-video-360p"
              },
        });
        $('#player').bind($.jPlayer.event.timeupdate, e => {
            this.setState({
                progress: Math.round(e.jPlayer.status.currentTime)
            })
        })
    } 


正在回答

1 回答

这是chrome浏览器在今年4月份的自动播放策略,在页面没有产生用户交互时时不能进行自动播放的,可以先让用户点击再进行播放

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
使用React构建一款音乐播放器
  • 参与学习       26488    人
  • 解答问题       156    个

从零开始使用React构建一款音乐播放器

进入课程

在mac 谷歌浏览器下,提示错误play() failed because the user didn't interact with the document first.

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号