值
一个 MIDIPort
对象。
示例
Navigator.requestMIDIAccess()
方法返回一个 Promise,该 Promise 解析为 MIDIAccess
对象。当端口状态改变时,一个 MIDIConnectionEvent
会被传递给 statechange
事件。然后可以将有关端口的信息打印到控制台。
js
navigator.requestMIDIAccess().then((access) => {
access.onstatechange = (event) => {
console.log(event.port.name, event.port.manufacturer, event.port.state);
};
});
规范
规范 |
---|
Web MIDI API # dom-midiconnectionevent-port |
浏览器兼容性
加载中…