MIDIPort: open() メソッド
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。
MIDIPort
インターフェイスの open()
メソッドは、この MIDIPort
に接続された MIDI デバイスを明示的に利用可能にします。
ポートを開くのに成功したら、新しい MIDIConnectionEvent
が MIDIPort statechange
と MIDIAccess statechange
イベントに渡され、MIDIPort.connection
プロパティが "open"
になります。
このメソッドが呼ばれたときにポートが既に開かれている場合は、Promise は正常に解決します。
構文
js
open()
引数
なし
返値
ポートへのアクセスを正常に得たら解決する Promise
を返します。
例外
InvalidAccessError
DOMException
-
ポートが利用不可能で開けない場合、Promise はこのエラーで拒否されます。
例
以下の例では、出力ポートを開きます。
js
const output = midiAccess.outputs.get(portID);
output.open(); // ポートを開く
仕様書
Specification |
---|
Web MIDI API # dom-midiport-open |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
open |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
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.