zhw2590582 / ArtPlayer

:art: ArtPlayer.js is a modern and full featured HTML5 video player
https://artplayer.org
MIT License
2.42k stars 260 forks source link

DOMException: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22 #758

Closed John7125 closed 1 month ago

John7125 commented 1 month ago

Expected behaviour

应该自动循环播放

Actual behaviour

播放第一遍后,控制台输出 DOMException: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22

Steps to reproduce

Artplayer使用DASH播放,Artplayer版本^5.1.1

art.value = new Artplayer(
  {
    container: artRef.value,
    url: 'http://127.0.0.1:3000/dash/index.mpd',
    muted: true,
    autoplay: true,
    loop: true,
    customType: {
      mpd: playMpd
    }
  },
  (art) => {
    art.volume = 1
  }
)
function playMpd(video: HTMLVideoElement, url: string, art: Artplayer) {
  if (dashjs.supportsMediaSource()) {
    if (art.mpd) art.mpd.destroy()
    const dash = dashjs.MediaPlayer().create()
    dash.initialize(video, url, art.option.autoplay)
    art.mpd = dash
    art.on('destroy', () => dash.destroy())
  } else {
    art.notice.show = 'Unsupported playback format: mpd'
  }
}

Environment

Console errors (if any)

artplayer.js?v=8113e20c:650 Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22

Link to where the bug is happening

zhw2590582 commented 1 month ago

你试图静音自动播放后,再取消静音?假如chrome的自动播放策略这么容易绕过的话,那这个策略就没意义了啊,那所有网站都可以绕过了

John7125 commented 1 month ago

你试图静音自动播放后,再取消静音?假如chrome的自动播放策略这么容易绕过的话,那这个策略就没意义了啊,那所有网站都可以绕过了

开发者大大,你好!chrome的自动播放策略在静音状态下是可以自动播放的,我的配置是设置了音量但静音还是打开的,需要与浏览器交互才能播放声音 我测试了在播放本地mp4视频和播放m3u8视频文件,是正常循环播放,没有遇到相关问题 如果您有时间,这个问题可以帮忙解惑下吗

zhw2590582 commented 1 month ago

所以你遇到的问题是:使用dashjs后不能循环播放,对吗?

John7125 commented 1 month ago

所以你遇到的问题是:使用dashjs后不能循环播放,对吗?

是的,开发者大大您看问题真的是一针见血标👍