这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

MIDIMessageEvent 接口在 Web MIDI API represents the event passed to the onmidimessage event handler of the MIDIInput 接口。 midimessage event is fired every time a MIDI message is sent from a device represented by a MIDIInput , for example when a MIDI keyboard key is pressed, a knob is tweaked, or a slider is moved.

构造函数

MIDIMessageEvent.MIDIMessageEvent
创建新的 MIDIMessageEvent 对象实例。

特性

MIDIConnectionEvent.data
Uint8Array containing the data bytes of a single MIDI message. See the MIDI specification for more information on its form.

注意 : Even though the Web MIDI API 指定 receivedTime property that returns a DOMHighResTimeStamp , Chrome (the only implementation at the time of writing) does not support that property since the basic Event.timeStamp property already returns a DOMHighResTimeStamp in Chrome.

范例

// Printing all messages to console
navigator.requestMIDIAccess().then(midiAccess => {
  Array.from(midiAccess.inputs).forEach(input => {
    input[1].onmidimessage = console.log;
  })
});
					

规范

规范 状态 注释
Web MIDI API
The definition of 'MIDIMessageEvent' in that specification.
工作草案 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
MIDIMessageEvent Chrome 43 Edge ≤79 Firefox ? IE No Opera 30 Safari ? WebView Android No Chrome Android 43 Firefox Android ? Opera Android 30 Safari iOS No Samsung Internet Android 4.0
MIDIMessageEvent() 构造函数 Chrome 43 Edge ≤79 Firefox ? IE No Opera 30 Safari ? WebView Android No Chrome Android 43 Firefox Android ? Opera Android 30 Safari iOS No Samsung Internet Android 4.0
data Chrome 43 Edge ≤79 Firefox ? IE No Opera 30 Safari ? WebView Android No Chrome Android 43 Firefox Android ? Opera Android 30 Safari iOS No Samsung Internet Android 4.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

元数据

  • 最后修改: