Failed to execute 'play' on 'HTMLMedia

2019-07-28 08:33发布

play() trigger simultaneously in chrome android without user gesture on soundmanager2

Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.

but its works fine when we change datasaver off by site settings in chrome android

please help me from this

1条回答
孤傲高冷的网名
2楼-- · 2019-07-28 09:04

If you are attempting to "auto-play" audio, i.e., on load or page display etc., then it is usually going to be blocked by mobile devices. iOS does this basically all the time.

http://www.schillmania.com/projects/soundmanager2/doc/technotes/#mobile-device-limitations

For HTML5 audio load and playback to work, you need to call the audio stuff immediately from a user touch/click/gesture, and no setTimeout() or other asynchronous stuff is allowed in-between.

查看更多
登录 后发表回答