A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/issues/7109 below:

In Vue 2.5 ,the use of MessageChannel in nextTick function will lead to audio can not play in some mobile browsers. · Issue #7109 · vuejs/vue · GitHub

Version

2.5.8

Reproduction link

https://codesandbox.io/s/vpomxl5p3

Steps to reproduce

Click the 'click me' button and the audio will play.

What is expected?

It can play well in all of the modern browsers that support audio.

What is actually happening?

In PC browsers, it can play well. However, in some mobile browsers, such as iOS Safari、iOS Wechat Webview、Android Chrome,it can not play.

In Vue 2.4 or below, the nextTick function use microTask, like MutationObserver or Promise at first,the click callback and audio play function are in the same tick,so it can play well in all browsers.

Howerver, in Vue 2.5 ,macroTask will be used in DOM action, so the click callback and audio play function are not in the same tick. If we just use setTimeout 0, it will be fine, but actually MessageChannel will be firstly used because of the priority, which lead to the audio can not play in some mobile browsers mentioned above.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4