在浏覽器中自動播放視訊會報錯:play() failed because the user didn\'t interact with the document first。
網上大部分資料是需要設定autoplay選項,但是我的谷歌浏覽器版本是78 ;
設定改成如下

設定之後還是無效
需求背景如下:有6個子子產品自動跳轉,12個子子產品中有視訊的播放。
問題:子子產品中的小視訊可以自動播放,但是子子產品對應的頁面裡視訊無法自動播放。
解決:
浏覽器自動播放的條件1.沒有音頻,将video設定成muted
2.視訊在視圖裡面是可見的,不能被隐藏或者在可視區域外
子子產品對應的頁面在頁面加載完成時是對使用者不可見的,浏覽器會報錯play() failed because the user didn\'t interact with the document first。這時需要使用者與浏覽器進行互動(包括touchend、click、doubleClick、鍵盤事件)。