MIDI event handlers are not capable of resuming an AudioContext
Reported by
chrisgut...@gmail.com,
Feb 28 2018
|
||||||||||
Issue description
Chrome Version : 66.0.3357.0
OS Version: OS X 10.13.3
URLs (if applicable) :
Other browsers tested:
Add OK or FAIL after other browsers where you have tested this issue:
Safari: doesn't implement Web MIDI
Firefox: doesn't implement Web MIDI
IE/Edge: doesn't implement Web MIDI
What steps will reproduce the problem?
1. create an AudioContext
2. try to resume the AudioContext in response to a MIDI input event
What is the expected result?
The promise should resolve and the AudioContext should be in the state of running afterwards.
What happens instead of that?
The promise returned by calling resume() won't resolve. It doesn't get rejected either. It seems to wait for a user input (a keypress or mouse click event) which then unlocks the AudioContext and the promise gets resolved.
Please provide any additional information below. Attach a screenshot if
possible.
UserAgentString: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36
,
Feb 28 2018
,
Mar 1 2018
chrisguttandin@ - Thanks for filing the issue...!! Could you please provide a sample test file/url to test the issue from TE-end. This will help us in triaging the issue further. Thanks...!!
,
Mar 1 2018
I created a little example which is hosted on GitHub: https://chrisguttandin.github.io/web-midi-autoplay-policy-test/. The source code is available as well: https://github.com/chrisguttandin/web-midi-autoplay-policy-test Many thanks for looking into this.
,
Mar 1 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 1 2018
CC-ing toyoshim@ and cwilso@ to get opinions on this. I think this issue has some implication of the potential spec work.
,
Mar 2 2018
Let me confirm. According to the rtoy's comment at #1, it sounds AudioContext needs a user gesture bit to be resumed by scripts. Right? MIDI input message may be a kind of a user gesture, but some devices periodically send messages for synchronization, or heart-beating. So, I have a concern that assuming all MIDI inputs as a user gesture introduces an escape hatch. If we really need this, we would like to allow only chosen messages to have a user gesture bit, for instance only for note-on/off messages. Control-changes are probably also safe, but system messages are not, etc. But, I'm not sure this is really needed. Even MIDI, we may require another user gesture to use in the future for more secure permission system. If it happens, MIDI message can not be a fast path to resume the AudioContext.
,
Mar 2 2018
remove Mac bit. This discussion is platform independent.
,
Mar 2 2018
Yes, an AudioContext needs a user gesture to resume (or the context must be created from a user gesture). Can't say if it's really needed, but it does seem to fit in as a user gesture. And I was only thinking about note-on/off events as counting as a user gesture. However, I just realized it's quite complicated. ROLI Blocks devices are MIDI devices but the MIDI messages it sends out aren't really MIDI messages. These use their own protocol with the protocol messages as stream of bits (bytes?) that are then packed into MIDI messages. It seems possible that some of these could be note-on/off messages that don't actually correspond to actual note on events. (I didn't examine the protocol in detail, but did look at it briefly many months ago.)
,
Mar 13 2018
@rtoy/@toyoshim: Could you please let us know whether this issue requires any triaging from TE end. Else feel free to change the status of the bug to untriaged/Available to move this out of TE triaging bucket. Thanks!
,
Mar 14 2018
This may be a minor feature proposal that needs a spec discussion rather than a bug. So at this point, this issue does not need helps from TE end. FYI, Firefox started Web MIDI security discussion at an open thread; https://github.com/mozilla/standards-positions/issues/58 At this point, I feel putting more authority, ability to pass user gesture check, to the API is a little risky.
,
Mar 14 2018
toyoshim@ Thanks for the update. As per comment #11, this is a Feature Request. Hence marking this as Untriaged for further updates from Dev. Thanks..
,
Mar 29 2018
Per #11, this is not an implementation bug and we have a tracking issue for the spec. I propose to close this until the spec is fixed.
,
Mar 29 2018
Can you please point me to the tracking issue for the spec? Many thanks in advance.
,
Mar 29 2018
chrisguttanding@ Sorry, I was wrong that the issue at #11 was about the user gesture. I think you should file a new issue against Web MIDI API so it can get looked at by the WG.
,
Mar 29 2018
Just for reference, I created a new issue on GitHub: https://github.com/WebAudio/web-midi-api/issues/186
,
Mar 29 2018
chrisguttanding@ Thanks for filing the spec issue! : https://github.com/WebAudio/web-midi-api/issues/186
,
Mar 29 2018
|
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by rtoy@chromium.org
, Feb 28 2018Components: Blink>Media>Autoplay Blink>WebAudio