CINXE.COM

Web MIDI API

<!DOCTYPE html><html lang="en"><head> <meta charset="utf-8"> <meta name="generator" content="ReSpec 35.2.0"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <style> .issue-label{text-transform:initial} .warning>p:first-child{margin-top:0} .warning{padding:.5em;border-left-width:.5em;border-left-style:solid} span.warning{padding:.1em .5em .15em} .issue.closed span.issue-number{text-decoration:line-through} .issue.closed span.issue-number::after{content:" (Closed)";font-size:smaller} .warning{border-color:#f11;border-color:var(--warning-border,#f11);border-width:.2em;border-style:solid;background:#fbe9e9;background:var(--warning-bg,#fbe9e9);color:#000;color:var(--text,#000)} .warning-title:before{content:"⚠";font-size:1.3em;float:left;padding-right:.3em;margin-top:-.3em} li.task-list-item{list-style:none} input.task-list-item-checkbox{margin:0 .35em .25em -1.6em;vertical-align:middle} .issue a.respec-gh-label{padding:5px;margin:0 2px 0 2px;font-size:10px;text-transform:none;text-decoration:none;font-weight:700;border-radius:4px;position:relative;bottom:2px;border:none;display:inline-block} </style> <style> pre.idl{padding:1em;position:relative} pre.idl>code{color:#000;color:var(--text,#000)} @media print{ pre.idl{white-space:pre-wrap} } .idlHeader{display:block;width:150px;background:#8ccbf2;background:var(--def-border,#8ccbf2);color:#fff;color:var(--defrow-border,#fff);font-family:sans-serif;font-weight:700;margin:-1em 0 1em -1em;height:28px;line-height:28px} .idlHeader a.self-link{margin-left:.3cm;text-decoration:none;border-bottom:none;color:inherit} .idlID{font-weight:700;color:#005a9c} .idlType{color:#005a9c} .idlName{color:#ff4500} .idlName a{color:#ff4500;border-bottom:1px dotted #ff4500;text-decoration:none} a.idlEnumItem{color:#000;border-bottom:1px dotted #ccc;text-decoration:none} .idlSuperclass{font-style:italic;color:#005a9c} .idlDefaultValue,.idlParamName{font-style:italic} .extAttr{color:#666} .idlSectionComment{color:gray} .idlIncludes a{font-weight:700} .respec-button-copy-paste:focus{text-decoration:none;border-color:#51a7e8;outline:0;box-shadow:0 0 5px rgba(81,167,232,.5)} .respec-button-copy-paste:is(:focus:hover,.selected:focus){border-color:#51a7e8} .respec-button-copy-paste:is(:hover,:active,.zeroclipboard-is-hover,.zeroclipboard-is-active){text-decoration:none;background-color:#ddd;background-image:linear-gradient(#eee,#ddd);border-color:#ccc} .respec-button-copy-paste:is(:active,.selected,.zeroclipboard-is-active){background-color:#dcdcdc;background-image:none;border-color:#b5b5b5;box-shadow:inset 0 2px 4px rgba(0,0,0,.15)} .respec-button-copy-paste.selected:hover{background-color:#cfcfcf} .respec-button-copy-paste:is(:disabled,:disabled:hover,.disabled,.disabled:hover){color:rgba(102,102,102,.5);cursor:default;background-color:rgba(229,229,229,.5);background-image:none;border-color:rgba(197,197,197,.5);box-shadow:none} @media print{ .respec-button-copy-paste{visibility:hidden} } </style> <style> dfn{cursor:pointer} .dfn-panel{position:absolute;z-index:35;min-width:300px;max-width:500px;padding:.5em .75em;margin-top:.6em;font-family:"Helvetica Neue",sans-serif;font-size:small;background:#fff;background:var(--indextable-hover-bg,#fff);color:#000;color:var(--text,#000);box-shadow:0 1em 3em -.4em rgba(0,0,0,.3),0 0 1px 1px rgba(0,0,0,.05);box-shadow:0 1em 3em -.4em var(--tocsidebar-shadow,rgba(0,0,0,.3)),0 0 1px 1px var(--tocsidebar-shadow,rgba(0,0,0,.05));border-radius:2px} .dfn-panel:not(.docked)>.caret{position:absolute;top:-9px} .dfn-panel:not(.docked)>.caret::after,.dfn-panel:not(.docked)>.caret::before{content:"";position:absolute;border:10px solid transparent;border-top:0;border-bottom:10px solid #fff;border-bottom-color:var(--indextable-hover-bg,#fff);top:0} .dfn-panel:not(.docked)>.caret::before{border-bottom:9px solid #a2a9b1;border-bottom-color:var(--indextable-hover-bg,#a2a9b1)} .dfn-panel *{margin:0} .dfn-panel b{display:block;color:#000;color:var(--text,#000);margin-top:.25em} .dfn-panel ul a[href]{color:#333;color:var(--text,#333)} .dfn-panel>div{display:flex} .dfn-panel a.self-link{font-weight:700;margin-right:auto} .dfn-panel .marker{padding:.1em;margin-left:.5em;border-radius:.2em;text-align:center;white-space:nowrap;font-size:90%;color:#040b1c} .dfn-panel .marker.dfn-exported{background:#d1edfd;box-shadow:0 0 0 .125em #1ca5f940} .dfn-panel .marker.idl-block{background:#8ccbf2;box-shadow:0 0 0 .125em #0670b161} .dfn-panel a:not(:hover){text-decoration:none!important;border-bottom:none!important} .dfn-panel a[href]:hover{border-bottom-width:1px} .dfn-panel ul{padding:0} .dfn-panel li{margin-left:1em} .dfn-panel.docked{position:fixed;left:.5em;top:unset;bottom:2em;margin:0 auto;max-width:calc(100vw - .75em * 2 - .5em - .2em * 2);max-height:30vh;overflow:auto} </style> <title>Web MIDI API</title> <style id="respec-mainstyle"> @keyframes pop{ 0%{transform:scale(1,1)} 25%{transform:scale(1.25,1.25);opacity:.75} 100%{transform:scale(1,1)} } a.internalDFN{color:inherit;border-bottom:1px solid #99c;text-decoration:none} a.externalDFN{color:inherit;border-bottom:1px dotted #ccc;text-decoration:none} a.bibref{text-decoration:none} .respec-offending-element:target{animation:pop .25s ease-in-out 0s 1} .respec-offending-element,a[href].respec-offending-element{text-decoration:red wavy underline} @supports not (text-decoration:red wavy underline){ .respec-offending-element:not(pre){display:inline-block} .respec-offending-element{background:url(data:image/gif;base64,R0lGODdhBAADAPEAANv///8AAP///wAAACwAAAAABAADAEACBZQjmIAFADs=) bottom repeat-x} } #references :target{background:#eaf3ff;animation:pop .4s ease-in-out 0s 1} cite .bibref{font-style:normal} a[href].orcid{padding-left:4px;padding-right:4px} a[href].orcid>svg{margin-bottom:-2px} ol.tof,ul.tof{list-style:none outside none} .caption{margin-top:.5em;font-style:italic} #issue-summary>ul{column-count:2} #issue-summary li{list-style:none;display:inline-block} details.respec-tests-details{margin-left:1em;display:inline-block;vertical-align:top} details.respec-tests-details>*{padding-right:2em} details.respec-tests-details[open]{z-index:999999;position:absolute;border:thin solid #cad3e2;border-radius:.3em;background-color:#fff;padding-bottom:.5em} details.respec-tests-details[open]>summary{border-bottom:thin solid #cad3e2;padding-left:1em;margin-bottom:1em;line-height:2em} details.respec-tests-details>ul{width:100%;margin-top:-.3em} details.respec-tests-details>li{padding-left:1em} .self-link:hover{opacity:1;text-decoration:none;background-color:transparent} aside.example .marker>a.self-link{color:inherit} .header-wrapper{display:flex;align-items:baseline} :is(h2,h3,h4,h5,h6):not(#toc>h2,#abstract>h2,#sotd>h2,.head>h2){position:relative;left:-.5em} :is(h2,h3,h4,h5,h6):not(#toch2)+a.self-link{color:inherit;order:-1;position:relative;left:-1.1em;font-size:1rem;opacity:.5} :is(h2,h3,h4,h5,h6)+a.self-link::before{content:"§";text-decoration:none;color:var(--heading-text)} :is(h2,h3)+a.self-link{top:-.2em} :is(h4,h5,h6)+a.self-link::before{color:#000} @media (max-width:767px){ dd{margin-left:0} } @media print{ .removeOnSave{display:none} } </style> <meta name="color-scheme" content="light"> <meta name="revision" content="c07b3a19d53c41db48f3287bb46561b01242a5fb"> <meta name="description" content="Some user agents have music devices, such as synthesizers, keyboard and other controllers, and drum machines connected to their host computer or device. The widely adopted Musical Instrument Digital Interface (MIDI) protocol enables electronic musical instruments, controllers and computers to communicate and synchronize with each other. MIDI does not transmit audio signals: instead, it sends event messages about musical notes, controller signals for parameters such as volume, vibrato and panning, cues and clock signals to set the tempo, and system-specific MIDI communications (e.g. to remotely store synthesizer-specific patch data). This same protocol has become a standard for non-musical uses, such as show control, lighting and special effects control."> <link rel="canonical" href="https://www.w3.org/TR/webmidi/"> <style> var{position:relative;cursor:pointer} var[data-type]::after,var[data-type]::before{position:absolute;left:50%;top:-6px;opacity:0;transition:opacity .4s;pointer-events:none} var[data-type]::before{content:"";transform:translateX(-50%);border-width:4px 6px 0 6px;border-style:solid;border-color:transparent;border-top-color:#222} var[data-type]::after{content:attr(data-type);transform:translateX(-50%) translateY(-100%);background:#222;text-align:center;font-family:"Dank Mono","Fira Code",monospace;font-style:normal;padding:6px;border-radius:3px;color:#daca88;text-indent:0;font-weight:400} var[data-type]:hover::after,var[data-type]:hover::before{opacity:1} </style> <script id="initialUserConfig" type="application/json">{ "shortName": "webmidi", "specStatus": "WD", "copyrightStart": "2015", "editors": [ { "name": "Chris Wilson", "url": "mailto:cwilso@google.com", "w3cid": "3742", "company": "Google", "companyURL": "http://google.com" }, { "name": "Michael Wilson", "url": "mailto:mjwilson@google.com", "w3cid": "136815", "company": "Google", "companyURL": "http://google.com" } ], "formerEditors": [ { "name": "Jussi Kalliokoski", "url": "http://juss.in", "w3cid": "45545" } ], "github": "WebAudio/web-midi-api", "group": "wg/audio", "otherLinks": [ { "key": "Implementation report:", "data": [ { "value": "No preliminary interoperability or implementation report exists." } ] } ], "previousPublishDate": "2024-11-16", "previousMaturity": "WD", "testSuiteURI": "https://github.com/web-platform-tests/wpt/tree/master/webmidi", "xref": { "profile": "web-platform", "specs": [ "hr-time", "permissions", "permissions-policy" ] }, "gitRevision": "c07b3a19d53c41db48f3287bb46561b01242a5fb", "publishDate": "2024-11-27", "publishISODate": "2024-11-27T00:00:00.000Z", "generatedSubtitle": "W3C Working Draft 27 November 2024" }</script> <link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2021/W3C-WD"></head> <body class="h-entry" data-cite="WEBIDL hr-time permissions permissions-policy HTML INFRA URL WEBIDL DOM FETCH"><div class="head"> <p class="logos"><a class="logo" href="https://www.w3.org/"><img crossorigin="" alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a></p> <h1 id="title" class="title">Web MIDI API</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types#WD">W3C Working Draft</a> <time class="dt-published" datetime="2024-11-27">27 November 2024</time></p> <details open=""> <summary>More details about this document</summary> <dl> <dt>This version:</dt><dd> <a class="u-url" href="https://www.w3.org/TR/2024/WD-webmidi-20241127/">https://www.w3.org/TR/2024/WD-webmidi-20241127/</a> </dd> <dt>Latest published version:</dt><dd> <a href="https://www.w3.org/TR/webmidi/">https://www.w3.org/TR/webmidi/</a> </dd> <dt>Latest editor's draft:</dt><dd><a href="https://webaudio.github.io/web-midi-api/">https://webaudio.github.io/web-midi-api/</a></dd> <dt>History:</dt><dd> <a href="https://www.w3.org/standards/history/webmidi/">https://www.w3.org/standards/history/webmidi/</a> </dd><dd> <a href="https://github.com/WebAudio/web-midi-api/commits/">Commit history</a> </dd> <dt>Test suite:</dt><dd><a href="https://github.com/web-platform-tests/wpt/tree/master/webmidi">https://github.com/web-platform-tests/wpt/tree/master/webmidi</a></dd> <dt>Editors:</dt><dd class="editor p-author h-card vcard" data-editor-id="3742"> <a class="ed_mailto u-email email p-name" href="mailto:cwilso@google.com">Chris Wilson</a> (<a class="p-org org h-org" href="https://google.com">Google</a>) </dd><dd class="editor p-author h-card vcard" data-editor-id="136815"> <a class="ed_mailto u-email email p-name" href="mailto:mjwilson@google.com">Michael Wilson</a> (<a class="p-org org h-org" href="https://google.com">Google</a>) </dd> <dt> Former editor: </dt><dd class="editor p-author h-card vcard" data-editor-id="45545"> <a class="u-url url p-name fn" href="http://juss.in">Jussi Kalliokoski</a> </dd> <dt>Feedback:</dt><dd> <a href="https://github.com/WebAudio/web-midi-api/">GitHub WebAudio/web-midi-api</a> (<a href="https://github.com/WebAudio/web-midi-api/pulls/">pull requests</a>, <a href="https://github.com/WebAudio/web-midi-api/issues/new/choose">new issue</a>, <a href="https://github.com/WebAudio/web-midi-api/issues/">open issues</a>) </dd> <dt>Implementation report:</dt><dd> No preliminary interoperability or implementation report exists. </dd> </dl> </details> <p class="copyright"> <a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2015-2024 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a rel="license" href="https://www.w3.org/copyright/software-license-2023/" title="W3C Software and Document Notice and License">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <section id="abstract" class="introductory"><h2>Abstract</h2> <p> Some user agents have music devices, such as synthesizers, keyboard and other controllers, and drum machines connected to their host computer or device. The widely adopted Musical Instrument Digital Interface (MIDI) protocol enables electronic musical instruments, controllers and computers to communicate and synchronize with each other. MIDI does not transmit audio signals: instead, it sends event messages about musical notes, controller signals for parameters such as volume, vibrato and panning, cues and clock signals to set the tempo, and system-specific MIDI communications (e.g. to remotely store synthesizer-specific patch data). This same protocol has become a standard for non-musical uses, such as show control, lighting and special effects control. </p> <p> This specification defines an API supporting the MIDI protocol, enabling web applications to enumerate and select MIDI input and output devices on the client system and send and receive <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-1">MIDI messages</a>. It is intended to enable non-music MIDI applications as well as music ones, by providing low-level access to the <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-1">MIDI devices</a> available on the users' systems. The Web MIDI API is not intended to describe music or controller inputs semantically; it is designed to expose the mechanics of MIDI input and output interfaces, and the practical aspects of sending and receiving <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-2">MIDI messages</a>, without identifying what those actions might mean semantically (e.g., in terms of "modulate the vibrato by 20Hz" or "play a G#7 chord", other than in terms of changing a controller value or sending a set of note-on messages that happen to represent a G#7 chord). </p> <p> To some users, "MIDI" has become synonymous with Standard MIDI Files and General MIDI. That is not the intent of this API; the use case of simply playing back a .SMF file is not within the purview of this specification (it could be considered a different format to be supported by the HTML <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/media.html#audio">audio</a></code> element, for example). The Web MIDI API is intended to enable direct access to devices that respond to MIDI - controllers, external synthesizers or lighting systems, for example. The Web MIDI API is also explicitly designed to enable a new class of applications on the web that can respond to MIDI controller inputs - using external hardware controllers with physical buttons, knobs and sliders (as well as musical controllers like keyboard, guitar or wind instrument controllers) to control web applications. </p> <p> The Web MIDI API is also expected to be used in conjunction with other APIs and elements of the web platform, notably the <a data-link-type="dfn|abstract-op" href="#WebAudio" class="internalDFN" id="ref-for-WebAudio-1">Web Audio API</a>. This API is also intended to be familiar to users of MIDI APIs on other systems, such as Apple's CoreMIDI and Microsoft's Windows MIDI API. </p> </section> <section id="sotd" class="introductory"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at https://www.w3.org/TR/.</em></p><p> This document was published by the <a href="https://www.w3.org/groups/wg/audio">Audio Working Group</a> as a Working Draft using the <a href="https://www.w3.org/policies/process/20231103/#recs-and-notes">Recommendation track</a>. </p><p>Publication as a Working Draft does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. </p><p> This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p><p> This document was produced by a group operating under the <a href="https://www.w3.org/policies/patent-policy/"><abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a rel="disclosure" href="https://www.w3.org/groups/wg/audio/ipr">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/policies/patent-policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/policies/patent-policy/#sec-Disclosure">section 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. </p><p> This document is governed by the <a id="w3c_process_revision" href="https://www.w3.org/policies/process/20231103/">03 November 2023 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document</a>. </p></section><nav id="toc"><h2 class="introductory" id="table-of-contents">Table of Contents</h2><ol class="toc"><li class="tocline"><a class="tocxref" href="#abstract">Abstract</a></li><li class="tocline"><a class="tocxref" href="#sotd">Status of This Document</a></li><li class="tocline"><a class="tocxref" href="#introduction"><bdi class="secno">1. </bdi> Introduction </a></li><li class="tocline"><a class="tocxref" href="#conformance"><bdi class="secno">2. </bdi>Conformance</a></li><li class="tocline"><a class="tocxref" href="#terminology"><bdi class="secno">3. </bdi> Terminology </a></li><li class="tocline"><a class="tocxref" href="#obtaining-access-to-midi-devices"><bdi class="secno">4. </bdi> Obtaining Access to <span data-link-type="dfn|abstract-op" class="formerLink">MIDI Devices</span> </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#permissions-integration"><bdi class="secno">4.1 </bdi> Permissions Integration </a></li><li class="tocline"><a class="tocxref" href="#permissions-policy-integration"><bdi class="secno">4.2 </bdi> Permissions Policy Integration </a></li><li class="tocline"><a class="tocxref" href="#extensions-to-the-navigator-interface"><bdi class="secno">4.3 </bdi> Extensions to the <span data-idl="interface" data-title="Navigator" data-dfn-for=""><code>Navigator</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#MIDIOptions"><bdi class="secno">4.3.1 </bdi> <span data-export="" data-dfn-type="dictionary" data-idl="dictionary" data-title="MIDIOptions" data-dfn-for=""><code>MIDIOptions</code></span> Dictionary </a></li></ol></li></ol></li><li class="tocline"><a class="tocxref" href="#the-midi-api"><bdi class="secno">5. </bdi> The MIDI API </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#MIDIInputMap"><bdi class="secno">5.1 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MIDIInputMap" data-dfn-for=""><code>MIDIInputMap</code></span> Interface </a></li><li class="tocline"><a class="tocxref" href="#MIDIOutputMap"><bdi class="secno">5.2 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MIDIOutputMap" data-dfn-for=""><code>MIDIOutputMap</code></span> Interface </a></li><li class="tocline"><a class="tocxref" href="#MIDIAccess"><bdi class="secno">5.3 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MIDIAccess" data-dfn-for=""><code>MIDIAccess</code></span> Interface </a></li><li class="tocline"><a class="tocxref" href="#MIDIPort"><bdi class="secno">5.4 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MIDIPort" data-dfn-for=""><code>MIDIPort</code></span> Interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#MIDIInput"><bdi class="secno">5.4.1 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MIDIInput" data-dfn-for=""><code>MIDIInput</code></span> Interface </a></li><li class="tocline"><a class="tocxref" href="#MIDIOutput"><bdi class="secno">5.4.2 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MIDIOutput" data-dfn-for=""><code>MIDIOutput</code></span> Interface </a></li><li class="tocline"><a class="tocxref" href="#midiporttype-enum"><bdi class="secno">5.4.3 </bdi> <span data-export="" data-dfn-type="enum" data-idl="enum" data-title="MIDIPortType" data-dfn-for=""><code>MIDIPortType</code></span> Enum </a></li><li class="tocline"><a class="tocxref" href="#midiportdevicestate-enum"><bdi class="secno">5.4.4 </bdi> <span data-export="" data-dfn-type="enum" data-idl="enum" data-title="MIDIPortDeviceState" data-dfn-for=""><code>MIDIPortDeviceState</code></span> Enum </a></li><li class="tocline"><a class="tocxref" href="#midiportconnectionstate-enum"><bdi class="secno">5.4.5 </bdi> <span data-export="" data-dfn-type="enum" data-idl="enum" data-title="MIDIPortConnectionState" data-dfn-for=""><code>MIDIPortConnectionState</code></span> Enum </a></li></ol></li><li class="tocline"><a class="tocxref" href="#MIDIMessageEvent"><bdi class="secno">5.5 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MIDIMessageEvent" data-dfn-for=""><code>MIDIMessageEvent</code></span> Interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#MIDIMessageEventInit"><bdi class="secno">5.5.1 </bdi> <span data-export="" data-dfn-type="dictionary" data-idl="dictionary" data-title="MIDIMessageEventInit" data-dfn-for=""><code>MIDIMessageEventInit</code></span> Dictionary </a></li></ol></li><li class="tocline"><a class="tocxref" href="#MIDIConnectionEvent"><bdi class="secno">5.6 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="MIDIConnectionEvent" data-dfn-for=""><code>MIDIConnectionEvent</code></span> Interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#MIDIConnectionEventInit"><bdi class="secno">5.6.1 </bdi> <span data-export="" data-dfn-type="dictionary" data-idl="dictionary" data-title="MIDIConnectionEventInit" data-dfn-for=""><code>MIDIConnectionEventInit</code></span> Dictionary </a></li></ol></li></ol></li><li class="tocline"><a class="tocxref" href="#privacy-considerations"><bdi class="secno">6. </bdi> Privacy Considerations </a></li><li class="tocline"><a class="tocxref" href="#security-considerations"><bdi class="secno">7. </bdi> Security Considerations </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#malicious-firmware-updates"><bdi class="secno">7.1 </bdi> Malicious Firmware Updates </a></li><li class="tocline"><a class="tocxref" href="#additional-security-considerations"><bdi class="secno">7.2 </bdi> Additional Security Considerations </a></li></ol></li><li class="tocline"><a class="tocxref" href="#changelog"><bdi class="secno">8. </bdi> Changelog </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#changes-since-working-draft-17-march-2015"><bdi class="secno">8.1 </bdi> Changes since Working Draft 17 March 2015 </a></li></ol></li><li class="tocline"><a class="tocxref" href="#references"><bdi class="secno">A. </bdi>References</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><bdi class="secno">A.1 </bdi>Normative references</a></li></ol></li></ol></nav> <section class="informative" id="introduction"><div class="header-wrapper"><h2 id="x1-introduction"><bdi class="secno">1. </bdi> Introduction </h2><a class="self-link" href="#introduction" aria-label="Permalink for Section 1."></a></div><p><em>This section is non-normative.</em></p> <p> The Web MIDI API specification defines a means for web developers to enumerate, manipulate and access <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-2">MIDI devices</a> - for example, interfaces that may provide hardware MIDI ports with other devices plugged in to them and USB devices that support the USB-MIDI specification. Having a Web API for MIDI enables web applications that use existing software and hardware synthesizers, hardware music controllers and light systems and other mechanical apparatus controlled by MIDI. This API has been defined with this wide variety of use cases in mind. </p> <p> The approaches taken by this API are similar to those taken in Apple's CoreMIDI API and Microsoft's Windows MIDI API; that is, the API is designed to represent the low-level software protocol of MIDI, in order to enable developers to build powerful MIDI software on top. The API enables the developer to enumerate input and output interfaces, and send and receive <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-3">MIDI messages</a>, but (similar to the aforementioned APIs) it does not attempt to semantically define or interpret <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-4">MIDI messages</a> beyond what is necessary to robustly support current devices. </p> <p> The Web MIDI API is not intended to directly implement high-level concepts such as sequencing; it does not directly support Standard MIDI Files, for example, although a Standard MIDI File player can be built on top of the Web MIDI API. It is also not intended to semantically capture patches or controller assignments, as General MIDI does; such interpretation is outside the scope of the Web MIDI API (though again, General MIDI can easily be utilized through the Web MIDI API). </p> </section> <section id="conformance"><div class="header-wrapper"><h2 id="x2-conformance"><bdi class="secno">2. </bdi>Conformance</h2><a class="self-link" href="#conformance" aria-label="Permalink for Section 2."></a></div><p>As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.</p><p> The key words <em class="rfc2119">MUST</em> and <em class="rfc2119">SHOULD</em> in this document are to be interpreted as described in <a href="https://datatracker.ietf.org/doc/html/bcp14">BCP 14</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">RFC2119</a></cite>] [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8174" title="Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words">RFC8174</a></cite>] when, and only when, they appear in all capitals, as shown here. </p> <p> This specification defines conformance criteria that apply to a single product: the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#user-agent">user agent</a> that implements the interfaces that it contains. </p> <p> Implementations that use ECMAScript to implement the APIs defined in this specification <em class="rfc2119">MUST</em> implement them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification [<cite><a class="bibref" data-link-type="biblio" href="#bib-webidl" title="Web IDL Standard">WEBIDL</a></cite>], as this specification uses that specification and terminology. </p> </section> <section id="terminology"><div class="header-wrapper"><h2 id="x3-terminology"><bdi class="secno">3. </bdi> Terminology </h2><a class="self-link" href="#terminology" aria-label="Permalink for Section 3."></a></div> <p> The <dfn id="WebAudio" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Web Audio API</dfn> and its associated interfaces and concepts are defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-webaudio" title="Web Audio API">webaudio</a></cite>]. </p> <p> The terms <dfn id="dfn-midi" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">MIDI</dfn>, <dfn data-plurals="midi devices" id="dfn-midi-device" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">MIDI device</dfn>, <dfn data-plurals="midi input ports" id="dfn-midi-input-port" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">MIDI input port</dfn>, <dfn data-plurals="midi output ports" id="dfn-midi-output-port" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">MIDI output port</dfn>, <dfn data-plurals="midi interfaces" id="dfn-midi-interface" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">MIDI interface</dfn>, <dfn data-plurals="midi messages" id="dfn-midi-message" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">MIDI message</dfn>, <dfn id="dfn-system-real-time" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">System Real Time</dfn> and <dfn id="dfn-system-exclusive" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">System Exclusive</dfn> are defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-midi" title="MIDI 1.0 Core Specifications">MIDI</a></cite>]. </p> <div class="note" role="note" id="issue-container-generatedID"><div role="heading" class="note-title marker" id="h-note" aria-level="3"><span>Note</span></div><div class=""> <dfn data-plurals="valid midi messages" id="dfn-valid-midi-message" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Valid MIDI message</dfn> is defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-midi" title="MIDI 1.0 Core Specifications">MIDI</a></cite>]. The following may be used as a non-normative guide: <ul> <li>The first byte (the status byte) should have the high bit set, any following bytes should not unless they are part of a <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-1">System Exclusive</a> message</li> <li>If the high nibble of the status byte in hex is <code>8</code>, <code>9</code>, <code>A</code>, <code>B</code>, or <code>E</code> then the total message length should be 3 bytes </li><li>If the high nibble of the status byte is <code>C</code> or <code>D</code> then the total message length should be 2 bytes</li> <li>If the status byte is <code>F1</code> or <code>F3</code> then the total message length should be 2 bytes</li> <li>If the status byte is <code>F2</code> then the total message length should be 3 bytes</li> <li>If the status byte is <code>F6</code>, <code>F8</code>, <code>FA</code>, <code>FB</code>, <code>FC</code>, <code>FE</code>, or <code>FF</code> then the total message length should be 1 byte (only the status byte)</li> <li>If the status byte is <code>F0</code> then this is a <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-2">System Exclusive</a> message with no length restriction, and the last byte should be <code>F7</code></li> <li>If the status byte is <code>F4</code>, <code>F5</code>, <code>F7</code>, <code>F9</code>, or <code>FD</code> then the message is not valid</li> </ul> </div></div> </section> <section id="obtaining-access-to-midi-devices"><div class="header-wrapper"><h2 id="x4-obtaining-access-to-midi-devices"><bdi class="secno">4. </bdi> Obtaining Access to <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-3">MIDI Devices</a> </h2><a class="self-link" href="#obtaining-access-to-midi-devices" aria-label="Permalink for Section 4."></a></div> <section data-link-for="Navigator" id="permissions-integration"><div class="header-wrapper"><h3 id="x4-1-permissions-integration"><bdi class="secno">4.1 </bdi> Permissions Integration </h3><a class="self-link" href="#permissions-integration" aria-label="Permalink for Section 4.1"></a></div> <p> The Web Midi API is a <a data-link-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-powerful-feature">powerful feature</a> that is identified by the <a data-link-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-name">name</a> <a href="#dfn-midi-0" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-midi-0-1">"midi"</a>. It integrates with <cite><a data-matched-text="[[[Permissions]]]" href="https://www.w3.org/TR/permissions/">Permissions</a></cite> by defining the following permission-related flags: </p> <dl> <dt> <a data-link-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-permission-descriptor-type">permission descriptor type</a> </dt> <dd> <pre class="idl def" id="webidl-1632041439"><span class="idlHeader"><a class="self-link" href="#webidl-1632041439">WebIDL</a></span><code><span data-idl="" class="idlDictionary" id="idl-def-midipermissiondescriptor" data-title="MidiPermissionDescriptor">dictionary <dfn data-export="" data-dfn-type="dictionary" id="dom-midipermissiondescriptor" data-idl="dictionary" data-title="MidiPermissionDescriptor" data-dfn-for="" class="idlID" tabindex="0" aria-haspopup="dialog"><code>MidiPermissionDescriptor</code></dfn> : <span class="idlSuperclass"><a data-link-type="dictionary" href="https://www.w3.org/TR/permissions/#dom-permissiondescriptor">PermissionDescriptor</a></span> {<span data-idl="" class="idlMember" id="idl-def-midipermissiondescriptor-sysex" data-title="sysex" data-dfn-for="MidiPermissionDescriptor"><span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <dfn data-export="" data-dfn-type="dict-member" id="dom-midipermissiondescriptor-sysex" data-idl="field" data-title="sysex" data-dfn-for="MidiPermissionDescriptor" data-type="boolean" class="idlName" tabindex="0" aria-haspopup="dialog"><code>sysex</code></dfn> = false;</span> };</span></code></pre> <p> <code>{name: "midi", sysex: true}</code> is <a data-link-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-stronger-than">stronger than</a> <code>{name: "midi", sysex: false}</code>. </p> </dd> </dl> </section> <section data-link-for="Navigator" id="permissions-policy-integration"><div class="header-wrapper"><h3 id="x4-2-permissions-policy-integration"><bdi class="secno">4.2 </bdi> Permissions Policy Integration </h3><a class="self-link" href="#permissions-policy-integration" aria-label="Permalink for Section 4.2"></a></div> <p> The Web Midi API defines a <a data-link-type="dfn" href="https://www.w3.org/TR/permissions-policy-1/#policy-controlled-feature">policy-controlled feature</a> named <dfn class="permission" data-dfn-type="permission" id="dfn-midi-0" tabindex="0" aria-haspopup="dialog" data-export="">"midi"</dfn> which has a <a data-link-type="dfn" href="https://www.w3.org/TR/permissions-policy-1/#policy-controlled-feature-default-allowlist">default allowlist</a> of <code>'self'</code>. </p> </section> <section data-dfn-for="Navigator" id="extensions-to-the-navigator-interface"><div class="header-wrapper"><h3 id="x4-3-extensions-to-the-navigator-interface"><bdi class="secno">4.3 </bdi> Extensions to the <dfn id="dom-navigator" data-idl="interface" data-title="Navigator" data-dfn-for="" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn"><code>Navigator</code></dfn> interface </h3><a class="self-link" href="#extensions-to-the-navigator-interface" aria-label="Permalink for Section 4.3"></a></div> <pre class="idl def" id="webidl-1402413408"><span class="idlHeader"><a class="self-link" href="#webidl-1402413408">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-navigator-partial-1" data-title="Navigator">partial interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-navigator" id="ref-for-dom-navigator-1"><code>Navigator</code></a> {<span data-idl="" class="idlMethod" id="idl-def-navigator-requestmidiaccess-options" data-title="requestMIDIAccess" data-dfn-for="Navigator"> [<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>]<span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a> &lt;<a data-link-type="idl" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-1"><code>MIDIAccess</code></a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-navigator-requestmidiaccess" id="ref-for-dom-navigator-requestmidiaccess-1"><code>requestMIDIAccess</code></a>(optional<span class="idlType"> <a data-link-type="idl" href="#dom-midioptions" class="internalDFN" id="ref-for-dom-midioptions-1"><code>MIDIOptions</code></a></span> <span class="idlParamName">options</span> = {});</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="method" id="dom-navigator-requestmidiaccess" data-idl="operation" data-title="requestMIDIAccess()" data-dfn-for="Navigator" data-type="Promise" data-lt="requestMIDIAccess()|requestMIDIAccess(options)" data-local-lt="Navigator.requestMIDIAccess|Navigator.requestMIDIAccess()|requestMIDIAccess" tabindex="0" aria-haspopup="dialog"><code>requestMIDIAccess()</code></dfn> method </dt> <dd> <p> When invoked, returns a Promise object representing a request for access to <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-4">MIDI devices</a> on the user's system. </p> <p> Requesting MIDI access <em class="rfc2119">SHOULD</em> prompt the user for access to MIDI devices, particularly if <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-3">System Exclusive</a> access is requested. In some scenarios, this permission may have already been implicitly or explicitly granted, in which case this prompt may not appear. If the user gives express permission or the call is otherwise approved, the vended Promise is resolved. The underlying system may choose to allow the user to select specific <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-1">MIDI interfaces</a> to expose to this API (i.e. pick and choose interfaces on an individual basis), although this is not required. The system may also choose to prompt (or not) based on whether <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-4">System Exclusive</a> support is requested, as <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-5">System Exclusive</a> access has greater privacy and security implications. </p> <p> If the user declines or the call is denied for any other reason, the Promise is rejected with a <a data-link-type="interface" data-lt="DOMException" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> parameter. </p> <p data-link-for="Navigator"> When the <a data-link-type="idl" data-lt="requestMIDIAccess()" href="#dom-navigator-requestmidiaccess" class="internalDFN" id="ref-for-dom-navigator-requestmidiaccess-2"><code>requestMIDIAccess</code></a><code>()</code> method is called, the user agent <em class="rfc2119">MUST</em> run the following steps: </p> <ol> <li> <p> Let <var>promise</var> be a new Promise object and <var>resolver</var> be its associated resolver. </p> </li> <li> <p> Return <var>promise</var> and run the following steps asynchronously. </p> </li> <li> <p> Let <var>document</var> be the calling context's <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">Document</a>. </p> </li> <li> <p> If <var>document</var> is not <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#allowed-to-use">allowed to use</a> the <a data-link-type="dfn" href="https://www.w3.org/TR/permissions-policy-1/#policy-controlled-feature">policy-controlled feature</a> named <a href="#dfn-midi" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-midi-1">midi</a>, jump to the step labeled <em>failure</em> below. </p> </li> <li> <p> Optionally, e.g. based on a previously-established user preference, for security reasons, or due to platform limitations, jump to the step labeled <em>failure</em> below. </p> </li> <li> <p> Optionally, e.g. based on a previously-established user preference, jump to the step labeled <em>success</em> below. </p> </li> <li> <p> Prompt the user in a user-agent-specific manner for permission to provide the entry script's origin with a <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-2"><code>MIDIAccess</code></a> object representing control over user's <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-5">MIDI devices</a>. This prompt may be contingent upon whether <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-6">System Exclusive</a> support was requested, and may allow the user to enable or disable that access. </p> <p> If permission is denied, jump to the step labeled <em>failure</em> below. If the user never responds, this algorithm will never progress beyond this step. If permission is granted, continue the following steps. </p> </li> <li> <p> <em><b>success</b></em>: Let <var>access</var> be a new <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-3"><code>MIDIAccess</code></a> object. (It is possible to call requestMIDIAccess() multiple times; this may prompt the user multiple times, so it may not be best practice, and the same instance of MIDIAccess will not be returned each time.) </p> </li> <li> <p> Call <var>resolver</var>'s <code>accept(value)</code> method with <var>access</var> as value argument. </p> </li> <li> <p> Terminate these steps. </p> </li> <li> <p> <em><b>failure</b></em>: Let <var>error</var> be a new <a data-link-type="interface" data-lt="DOMException" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a>. This exception's .name should be "<a data-link-type="exception" href="https://webidl.spec.whatwg.org/#notallowederror"><code>NotAllowedError</code></a>" if the user or their security settings denied the application from creating a MIDIAccess instance with the requested options, or if the error is the result of <var>document</var> not being <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#allowed-to-use">allowed to use</a> the feature, "<a data-link-type="exception" href="https://webidl.spec.whatwg.org/#aborterror"><code>AbortError</code></a>" if the page is going to be closed for a user navigation, "<a data-link-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a>" if the underlying systems raise any errors, or otherwise it should be "<a data-link-type="exception" href="https://webidl.spec.whatwg.org/#notsupportederror"><code>NotSupportedError</code></a>". </p> </li> <li> <p> Call <var>resolver</var>'s <code>reject(value)</code> method with <var>error</var> as value argument. </p> </li> </ol> </dd> </dl> <section data-dfn-for="MIDIOptions" data-link-for="Navigator" id="midioptions-dictionary"><div class="header-wrapper"><h4 id="MIDIOptions"><bdi class="secno">4.3.1 </bdi> <dfn data-export="" data-dfn-type="dictionary" id="dom-midioptions" data-idl="dictionary" data-title="MIDIOptions" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIOptions</code></dfn> Dictionary </h4><a class="self-link" href="#MIDIOptions" aria-label="Permalink for Section 4.3.1"></a></div> <p> This dictionary contains optional settings that may be provided to the <a data-link-type="idl" data-lt="requestMIDIAccess()" href="#dom-navigator-requestmidiaccess" class="internalDFN" id="ref-for-dom-navigator-requestmidiaccess-3"><code>requestMIDIAccess</code></a><code>()</code> request. </p> <pre class="idl def" id="webidl-1327204285"><span class="idlHeader"><a class="self-link" href="#webidl-1327204285">WebIDL</a></span><code><span data-idl="" class="idlDictionary" id="idl-def-midioptions" data-title="MIDIOptions">dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-midioptions" id="ref-for-dom-midioptions-2"><code>MIDIOptions</code></a> {<span data-idl="" class="idlMember" id="idl-def-midioptions-sysex" data-title="sysex" data-dfn-for="MIDIOptions"><span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-midioptions-sysex" id="ref-for-dom-midioptions-sysex-1"><code>sysex</code></a>;</span><span data-idl="" class="idlMember" id="idl-def-midioptions-software" data-title="software" data-dfn-for="MIDIOptions"><span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-midioptions-software" id="ref-for-dom-midioptions-software-1"><code>software</code></a>;</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="dict-member" id="dom-midioptions-sysex" data-idl="field" data-title="sysex" data-dfn-for="MIDIOptions" data-type="boolean" tabindex="0" aria-haspopup="dialog"><code>sysex</code></dfn> </dt> <dd> <p> This member informs the system whether the ability to send and receive <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-7">System Exclusive</a> messages is requested or allowed on a given <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-4"><code>MIDIAccess</code></a> object. On the option passed to <a data-link-type="idl" data-lt="requestMIDIAccess()" href="#dom-navigator-requestmidiaccess" class="internalDFN" id="ref-for-dom-navigator-requestmidiaccess-4"><code>requestMIDIAccess</code></a><code>()</code>, if this member is set to true, but <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-8">System Exclusive</a> support is denied (either by policy or by user action), the access request will fail with a "<a data-link-type="exception" href="https://webidl.spec.whatwg.org/#notallowederror"><code>NotAllowedError</code></a>" error. If this support is not requested (and allowed), the system will throw exceptions if the user tries to send <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-9">System Exclusive</a> messages, and will silently mask out any <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-10">System Exclusive</a> messages received on the port. </p> </dd> <dt> <dfn data-export="" data-dfn-type="dict-member" id="dom-midioptions-software" data-idl="field" data-title="software" data-dfn-for="MIDIOptions" data-type="boolean" tabindex="0" aria-haspopup="dialog"><code>software</code></dfn> </dt> <dd> <p> This member informs the system whether the ability to utilize any software synthesizers installed in the host system is requested or allowed on a given <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-5"><code>MIDIAccess</code></a> object. On <a data-link-type="idl" data-lt="requestMIDIAccess()" href="#dom-navigator-requestmidiaccess" class="internalDFN" id="ref-for-dom-navigator-requestmidiaccess-5"><code>requestMIDIAccess</code></a><code>()</code>, if this member is set to true, but software synthesizer support is denied (either by policy or by user action), the access request will fail with a "<a data-link-type="exception" href="https://webidl.spec.whatwg.org/#notallowederror"><code>NotAllowedError</code></a>" error. If this support is not requested, the system should not include any software synthesizers in the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-6"><code>MIDIAccess</code></a> exposure of available ports. </p> <p> Note that may result in a two-step request procedure if software synthesizer support is desired but not required - software synthesizers may be disabled when MIDI hardware device access is allowed. </p> </dd> </dl> </section> </section> </section> <section id="the-midi-api"><div class="header-wrapper"><h2 id="x5-the-midi-api"><bdi class="secno">5. </bdi> The MIDI API </h2><a class="self-link" href="#the-midi-api" aria-label="Permalink for Section 5."></a></div> <section data-dfn-for="MIDIInputMap" id="midiinputmap-interface"><div class="header-wrapper"><h3 id="MIDIInputMap"><bdi class="secno">5.1 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-midiinputmap" data-idl="interface" data-title="MIDIInputMap" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIInputMap</code></dfn> Interface </h3><a class="self-link" href="#MIDIInputMap" aria-label="Permalink for Section 5.1"></a></div> <pre class="idl def" id="webidl-250474479"><span class="idlHeader"><a class="self-link" href="#webidl-250474479">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-midiinputmap" data-title="MIDIInputMap">[<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-midiinputmap" id="ref-for-dom-midiinputmap-1"><code>MIDIInputMap</code></a> {<span data-idl="" class="idlMaplike" id="idl-def-midiinputmap-maplike" data-title="maplike" data-dfn-for="MIDIInputMap"> readonly <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-maplike">maplike</a> &lt;<a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>, <a data-link-type="idl" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-1"><code>MIDIInput</code></a>&gt;;</span> };</span></code></pre> <p> The <a data-link-type="idl" data-lt="MIDIInputMap" href="#dom-midiinputmap" class="internalDFN" id="ref-for-dom-midiinputmap-2"><code>MIDIInputMap</code></a> is a maplike interface whose value is a <a data-link-type="idl" data-lt="MIDIInput" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-2"><code>MIDIInput</code></a> instance and key is its ID. </p> <p> This type is used to represent all the currently available <a data-link-type="dfn|abstract-op" href="#dfn-midi-input-port" class="internalDFN" id="ref-for-dfn-midi-input-port-1">MIDI input ports</a>. </p> </section> <section data-dfn-for="MIDIOutputMap" id="midioutputmap-interface"><div class="header-wrapper"><h3 id="MIDIOutputMap"><bdi class="secno">5.2 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-midioutputmap" data-idl="interface" data-title="MIDIOutputMap" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIOutputMap</code></dfn> Interface </h3><a class="self-link" href="#MIDIOutputMap" aria-label="Permalink for Section 5.2"></a></div> <pre class="idl def" id="webidl-127537081"><span class="idlHeader"><a class="self-link" href="#webidl-127537081">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-midioutputmap" data-title="MIDIOutputMap">[<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-midioutputmap" id="ref-for-dom-midioutputmap-1"><code>MIDIOutputMap</code></a> {<span data-idl="" class="idlMaplike" id="idl-def-midioutputmap-maplike" data-title="maplike" data-dfn-for="MIDIOutputMap"> readonly <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-maplike">maplike</a> &lt;<a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>, <a data-link-type="idl" href="#dom-midioutput" class="internalDFN" id="ref-for-dom-midioutput-1"><code>MIDIOutput</code></a>&gt;;</span> };</span></code></pre> <p> The <a data-link-type="idl" data-lt="MIDIOutputMap" href="#dom-midioutputmap" class="internalDFN" id="ref-for-dom-midioutputmap-2"><code>MIDIOutputMap</code></a> is a maplike interface whose value is a <a data-link-type="idl" data-lt="MIDIOutput" href="#dom-midioutput" class="internalDFN" id="ref-for-dom-midioutput-2"><code>MIDIOutput</code></a> instance and key is its ID. </p> <p> This type is used to represent all the currently available <a data-link-type="dfn|abstract-op" href="#dfn-midi-output-port" class="internalDFN" id="ref-for-dfn-midi-output-port-1">MIDI output ports</a>. </p> </section> <section data-dfn-for="MIDIAccess" data-link-for="MIDIAccess" id="midiaccess-interface"><div class="header-wrapper"><h3 id="MIDIAccess"><bdi class="secno">5.3 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-midiaccess" data-idl="interface" data-title="MIDIAccess" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIAccess</code></dfn> Interface </h3><a class="self-link" href="#MIDIAccess" aria-label="Permalink for Section 5.3"></a></div> <p> This interface provides the methods to list MIDI input and output devices, and obtain access to an individual device. </p> <pre class="idl def" id="webidl-769829994"><span class="idlHeader"><a class="self-link" href="#webidl-769829994">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-midiaccess" data-title="MIDIAccess">[<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://html.spec.whatwg.org/multipage/structured-data.html#transferable">Transferable</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-midiaccess" id="ref-for-dom-midiaccess-7"><code>MIDIAccess</code></a>: <span class="idlSuperclass"><a data-link-type="interface" href="https://dom.spec.whatwg.org/#eventtarget">EventTarget</a></span> {<span data-idl="" class="idlAttribute" id="idl-def-midiaccess-inputs" data-title="inputs" data-dfn-for="MIDIAccess"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-midiinputmap" class="internalDFN" id="ref-for-dom-midiinputmap-3"><code>MIDIInputMap</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiaccess-inputs" id="ref-for-dom-midiaccess-inputs-1"><code>inputs</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiaccess-outputs" data-title="outputs" data-dfn-for="MIDIAccess"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-midioutputmap" class="internalDFN" id="ref-for-dom-midioutputmap-3"><code>MIDIOutputMap</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiaccess-outputs" id="ref-for-dom-midiaccess-outputs-1"><code>outputs</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiaccess-onstatechange" data-title="onstatechange" data-dfn-for="MIDIAccess"> attribute<span class="idlType"> <a data-link-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiaccess-onstatechange" id="ref-for-dom-midiaccess-onstatechange-1"><code>onstatechange</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiaccess-sysexenabled" data-title="sysexEnabled" data-dfn-for="MIDIAccess"> readonly attribute<span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiaccess-sysexenabled" id="ref-for-dom-midiaccess-sysexenabled-1"><code>sysexEnabled</code></a>;</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiaccess-inputs" data-idl="attribute" data-title="inputs" data-dfn-for="MIDIAccess" data-type="MIDIInputMap" data-lt="inputs" data-local-lt="MIDIAccess.inputs" tabindex="0" aria-haspopup="dialog"><code>inputs</code></dfn> </dt> <dd> The <a data-link-type="dfn|abstract-op" href="#dfn-midi-input-port" class="internalDFN" id="ref-for-dfn-midi-input-port-2">MIDI input ports</a> available to the system. </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiaccess-outputs" data-idl="attribute" data-title="outputs" data-dfn-for="MIDIAccess" data-type="MIDIOutputMap" data-lt="outputs" data-local-lt="MIDIAccess.outputs" tabindex="0" aria-haspopup="dialog"><code>outputs</code></dfn> </dt> <dd> The <a data-link-type="dfn|abstract-op" href="#dfn-midi-output-port" class="internalDFN" id="ref-for-dfn-midi-output-port-2">MIDI output ports</a> available to the system. </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiaccess-onstatechange" data-idl="attribute" data-title="onstatechange" data-dfn-for="MIDIAccess" data-type="EventHandler" data-lt="onstatechange" data-local-lt="MIDIAccess.onstatechange" tabindex="0" aria-haspopup="dialog"><code>onstatechange</code></dfn> </dt> <dd> <p> The handler called when a new port is connected or an existing port changes the state attribute. </p> <p> This <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers">event handler</a>, of type <a data-link-type="idl" data-lt="MIDIConnectionEvent" href="#dom-midiconnectionevent" class="internalDFN" id="ref-for-dom-midiconnectionevent-1"><code>MIDIConnectionEvent</code></a>, <em class="rfc2119">MUST</em> be supported by all objects implementing the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-8"><code>MIDIAccess</code></a> interface. </p> <div class="note" role="note" id="issue-container-generatedID-0"><div role="heading" class="note-title marker" id="h-note-0" aria-level="4"><span>Note</span></div><p class=""> It is important to understand that leaving an <a data-link-type="typedef" data-lt="EventHandler" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> attached to this object will prevent it from being garbage-collected; when finished using the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-9"><code>MIDIAccess</code></a>, you should remove any <a data-link-type="idl" data-lt="onstatechange" href="#dom-midiaccess-onstatechange" class="internalDFN" id="ref-for-dom-midiaccess-onstatechange-2"><code>onstatechange</code></a> listeners. </p></div> <p id="event-midiaccess-statechange"> Whenever a previously unavailable MIDI port becomes available for use, or an existing port changes the state attribute, the user agent <em class="rfc2119">SHOULD</em> run the following steps: </p> <ol> <li>Let <var data-type="MIDIPort">port</var> be the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-1"><code>MIDIPort</code></a> corresponding to the newly-available, or the existing port. </li> <li> <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">Fire an event</a> named "statechange" at the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-10"><code>MIDIAccess</code></a>, using <a data-link-type="idl" data-lt="MIDIConnectionEvent" href="#dom-midiconnectionevent" class="internalDFN" id="ref-for-dom-midiconnectionevent-2"><code>MIDIConnectionEvent</code></a> with <a data-link-type="idl" href="#dom-midiconnectionevent-port" class="internalDFN" id="ref-for-dom-midiconnectionevent-port-1"><code>port</code></a> set to <var data-type="MIDIPort">port</var>. </li> </ol> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiaccess-sysexenabled" data-idl="attribute" data-title="sysexEnabled" data-dfn-for="MIDIAccess" data-type="boolean" data-lt="sysexEnabled" data-local-lt="MIDIAccess.sysexEnabled" tabindex="0" aria-haspopup="dialog"><code>sysexEnabled</code></dfn> </dt> <dd> This attribute informs the user whether <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-11">System Exclusive</a> support is enabled on this MIDIAccess. </dd> </dl> </section> <section data-dfn-for="MIDIPort" id="midiport-interface"><div class="header-wrapper"><h3 id="MIDIPort"><bdi class="secno">5.4 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-midiport" data-idl="interface" data-title="MIDIPort" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIPort</code></dfn> Interface </h3><a class="self-link" href="#MIDIPort" aria-label="Permalink for Section 5.4"></a></div> <p> This interface represents a MIDI input or output port. </p> <pre class="idl def" id="webidl-2102775472"><span class="idlHeader"><a class="self-link" href="#webidl-2102775472">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-midiport" data-title="MIDIPort">[<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-midiport" id="ref-for-dom-midiport-2"><code>MIDIPort</code></a>: <span class="idlSuperclass"><a data-link-type="interface" href="https://dom.spec.whatwg.org/#eventtarget">EventTarget</a></span> {<span data-idl="" class="idlAttribute" id="idl-def-midiport-id" data-title="id" data-dfn-for="MIDIPort"> readonly attribute<span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiport-id" id="ref-for-dom-midiport-id-1"><code>id</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiport-manufacturer" data-title="manufacturer" data-dfn-for="MIDIPort"> readonly attribute<span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiport-manufacturer" id="ref-for-dom-midiport-manufacturer-1"><code>manufacturer</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiport-name" data-title="name" data-dfn-for="MIDIPort"> readonly attribute<span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiport-name" id="ref-for-dom-midiport-name-1"><code>name</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiport-type" data-title="type" data-dfn-for="MIDIPort"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-midiporttype" class="internalDFN" id="ref-for-dom-midiporttype-1"><code>MIDIPortType</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiport-type" id="ref-for-dom-midiport-type-1"><code>type</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiport-version" data-title="version" data-dfn-for="MIDIPort"> readonly attribute<span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiport-version" id="ref-for-dom-midiport-version-1"><code>version</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiport-state" data-title="state" data-dfn-for="MIDIPort"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-midiportdevicestate" class="internalDFN" id="ref-for-dom-midiportdevicestate-1"><code>MIDIPortDeviceState</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiport-state" id="ref-for-dom-midiport-state-1"><code>state</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiport-connection" data-title="connection" data-dfn-for="MIDIPort"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-midiportconnectionstate" class="internalDFN" id="ref-for-dom-midiportconnectionstate-1"><code>MIDIPortConnectionState</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiport-connection" id="ref-for-dom-midiport-connection-1"><code>connection</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-midiport-onstatechange" data-title="onstatechange" data-dfn-for="MIDIPort"> attribute<span class="idlType"> <a data-link-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiport-onstatechange" id="ref-for-dom-midiport-onstatechange-1"><code>onstatechange</code></a>;</span><span data-idl="" class="idlMethod" id="idl-def-midiport-open" data-title="open" data-dfn-for="MIDIPort"><span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a> &lt;<a data-link-type="idl" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-3"><code>MIDIPort</code></a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-midiport-open" id="ref-for-dom-midiport-open-1"><code>open</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-midiport-close" data-title="close" data-dfn-for="MIDIPort"><span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a> &lt;<a data-link-type="idl" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-4"><code>MIDIPort</code></a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-midiport-close" id="ref-for-dom-midiport-close-1"><code>close</code></a>();</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiport-id" data-idl="attribute" data-title="id" data-dfn-for="MIDIPort" data-type="DOMString" data-lt="id" data-local-lt="MIDIPort.id" tabindex="0" aria-haspopup="dialog"><code>id</code></dfn> </dt> <dd> <p> A unique ID of the port. This can be used by developers to remember ports the user has chosen for their application. The User Agent <em class="rfc2119">MUST</em> ensure that the <a data-link-type="idl" href="#dom-midiport-id" class="internalDFN" id="ref-for-dom-midiport-id-2"><code>id</code></a> is unique to only that port. The User Agent <em class="rfc2119">SHOULD</em> ensure that the id is maintained across instances of the application - e.g., when the system is rebooted - and when a device is removed from the system. Applications may want to cache these ids locally to re-create a MIDI setup. Some systems may not support completely unique persistent identifiers; in such cases, it will be more challenging to maintain identifiers when another interface is added or removed from the system. (This might throw off the index of the requested port.) It is expected that the system will do the best it can to match a port across instances of the MIDI API: for example, an implementation may opaquely use some form of hash of the port interface manufacturer, name and index as the id, so that a reference to that port id is likely to match the port when plugged in. Applications may use the comparison of id of MIDIPorts to test for equality. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiport-manufacturer" data-idl="attribute" data-title="manufacturer" data-dfn-for="MIDIPort" data-type="DOMString" data-lt="manufacturer" data-local-lt="MIDIPort.manufacturer" tabindex="0" aria-haspopup="dialog"><code>manufacturer</code></dfn> </dt> <dd> <p> The manufacturer of the port. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiport-name" data-idl="attribute" data-title="name" data-dfn-for="MIDIPort" data-type="DOMString" data-lt="name" data-local-lt="MIDIPort.name" tabindex="0" aria-haspopup="dialog"><code>name</code></dfn> </dt> <dd> <p> The system name of the port. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiport-type" data-idl="attribute" data-title="type" data-dfn-for="MIDIPort" data-type="MIDIPortType" data-lt="type" data-local-lt="MIDIPort.type" tabindex="0" aria-haspopup="dialog"><code>type</code></dfn> </dt> <dd> <p> A descriptor property to distinguish whether the port is an input or an output port. For <a data-link-type="idl" data-lt="MIDIOutput" href="#dom-midioutput" class="internalDFN" id="ref-for-dom-midioutput-3"><code>MIDIOutput</code></a>, this <em class="rfc2119">MUST</em> be <code>"output"</code>. For <a data-link-type="idl" data-lt="MIDIInput" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-3"><code>MIDIInput</code></a>, this <em class="rfc2119">MUST</em> be <code>"input"</code>. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiport-version" data-idl="attribute" data-title="version" data-dfn-for="MIDIPort" data-type="DOMString" data-lt="version" data-local-lt="MIDIPort.version" tabindex="0" aria-haspopup="dialog"><code>version</code></dfn> </dt> <dd> <p> The version of the port. </p> </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiport-state" data-idl="attribute" data-title="state" data-dfn-for="MIDIPort" data-type="MIDIPortDeviceState" data-lt="state" data-local-lt="MIDIPort.state" tabindex="0" aria-haspopup="dialog"><code>state</code></dfn> </dt> <dd> The state of the device. </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiport-connection" data-idl="attribute" data-title="connection" data-dfn-for="MIDIPort" data-type="MIDIPortConnectionState" data-lt="connection" data-local-lt="MIDIPort.connection" tabindex="0" aria-haspopup="dialog"><code>connection</code></dfn> </dt> <dd> The state of the connection to the device. </dd> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiport-onstatechange" data-idl="attribute" data-title="onstatechange" data-dfn-for="MIDIPort" data-type="EventHandler" data-lt="onstatechange" data-local-lt="MIDIPort.onstatechange" tabindex="0" aria-haspopup="dialog"><code>onstatechange</code></dfn> </dt> <dd> <p> The handler called when an existing port changes its state or connection attributes. </p> <p> This <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers">event handler</a>, of type "statechange", <em class="rfc2119">MUST</em> be supported by all objects implementing <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-5"><code>MIDIPort</code></a> interface. </p> <div class="note" role="note" id="issue-container-generatedID-1"><div role="heading" class="note-title marker" id="h-note-1" aria-level="4"><span>Note</span></div><p class=""> It is important to understand that leaving an <a data-link-type="typedef" data-lt="EventHandler" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler"><code>EventHandler</code></a> attached to this object will prevent it from being garbage-collected; when finished using the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-6"><code>MIDIPort</code></a>, you should remove any <a data-link-type="idl" href="#dom-midiport-onstatechange" class="internalDFN" id="ref-for-dom-midiport-onstatechange-2"><code>onstatechange</code></a> listeners. </p></div> </dd> <dt> <dfn data-export="" data-dfn-type="method" id="dom-midiport-open" data-idl="operation" data-title="open" data-dfn-for="MIDIPort" data-type="Promise" data-lt="open()" data-local-lt="MIDIPort.open|MIDIPort.open()|open" tabindex="0" aria-haspopup="dialog"><code>open</code></dfn> </dt> <dd> <p> Makes the <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-6">MIDI device</a> corresponding to the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-7"><code>MIDIPort</code></a> explicitly available. Note that this call is NOT required in order to use the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-8"><code>MIDIPort</code></a>- calling <code>send()</code> on a <a data-link-type="idl" data-lt="MIDIOutput" href="#dom-midioutput" class="internalDFN" id="ref-for-dom-midioutput-4"><code>MIDIOutput</code></a> or attaching a MIDIMessageEvent handler on a <a data-link-type="idl" data-lt="MIDIInput" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-4"><code>MIDIInput</code></a> will cause an implicit open(). The underlying implementation may not need to do anything in response to this call. However, some underlying implementations may not be able to support shared access to <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-7">MIDI devices</a>, so using explicit open() and close() calls will enable MIDI applications to predictably control this exclusive access to devices. </p> <p> When invoked, this method returns a Promise object representing a request for access to the given MIDI port on the user's system. </p> <p> If the port device has a state of <a data-lt="MIDIPortDeviceState.connected" href="#dom-midiportdevicestate-connected" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportdevicestate-connected-1">"connected"</a>, when access to the port has been obtained (and the port is ready for input or output), the vended Promise is resolved. </p> <p> If access to a connected port is not available (for example, the port is already in use in an exclusive-access-only platform), the Promise is rejected (if any) is invoked. </p> <p> If <code>open()</code> is called on a port that is <a data-lt="MIDIPortDeviceState.disconnected" href="#dom-midiportdevicestate-disconnected" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportdevicestate-disconnected-1">"disconnected"</a>, the port's <a data-lt="MIDIPort.connection" href="#dom-midiport-connection" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-connection-2">.connection</a> will transition to <a data-lt="MIDIPortConnectionState.pending" href="#dom-midiportconnectionstate-pending" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportconnectionstate-pending-1">"pending"</a>, until the port becomes <a data-lt="MIDIPortDeviceState.connected" href="#dom-midiportdevicestate-connected" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportdevicestate-connected-2">"connected"</a> or all references to it are dropped. </p> <p> When this method is called, the user agent <em class="rfc2119">MUST</em> run the <dfn data-lt="open the port|algorithm to open a MIDIPort" id="dfn-open-the-port" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">algorithm to open a MIDIPort</dfn>: </p> <ol> <li> <p> Let <var>promise</var> be a new Promise object and <var>resolver</var> be its associated resolver. </p> </li> <li> <p> Return <var>promise</var> and run the following steps asynchronously. </p> </li> <li> <p> Let <var>port</var> be the given <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-9"><code>MIDIPort</code></a> object. </p> </li> <li> <p> If the device's connection is already <a data-lt="MIDIPortConnectionState.open" href="#dom-midiportconnectionstate-open" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportconnectionstate-open-1">"open"</a> (e.g. open() has already been called on this <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-10"><code>MIDIPort</code></a>, or the port has been implicitly opened), jump to the step labeled <em>success</em> below. </p> </li> <li> <p> If the device's connection is <a data-lt="MIDIPortConnectionState.pending" href="#dom-midiportconnectionstate-pending" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportconnectionstate-pending-2">"pending"</a> (i.e. the connection had been opened and the device was subsequently disconnected), jump to the step labeled <em>success</em> below. </p> </li> <li> <p> If the device's state is <a data-lt="MIDIPortDeviceState.disconnected" href="#dom-midiportdevicestate-disconnected" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportdevicestate-disconnected-2">"disconnected"</a>, change the <a href="#dom-midiport-connection" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-connection-3"><code>connection</code></a> attribute of the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-11"><code>MIDIPort</code></a> to <a data-lt="MIDIPortConnectionState.pending" href="#dom-midiportconnectionstate-pending" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportconnectionstate-pending-3">"pending"</a>, and enqueue a new <a data-lt="MIDIConnectionEvent" href="#dom-midiconnectionevent" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiconnectionevent-3"><code>MIDIConnectionEvent</code></a> to the <a data-lt="MIDIAccess.onstatechange" href="#dom-midiaccess-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiaccess-onstatechange-3">statechange</a> handler of the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-11"><code>MIDIAccess</code></a> and to the <a data-lt="MIDIPort.onstatechange" href="#dom-midiport-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-onstatechange-3">statechange</a> handler of the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-12"><code>MIDIPort</code></a> and jump to the step labeled <em>success</em> below. </p> </li> <li> <p> Attempt to obtain access to the given <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-8">MIDI device</a> in the system. If the device is unavailable (e.g. is already in use by another process and cannot be opened, or is disconnected), jump to the step labeled <em>failure</em> below. If the device is available and access is obtained, continue the following steps. </p> </li> <li> <p> Change the <code>connection</code> attribute of the MIDIPort to <code>"open"</code>, and enqueue a new <a data-link-type="idl" data-lt="MIDIConnectionEvent" href="#dom-midiconnectionevent" class="internalDFN" id="ref-for-dom-midiconnectionevent-4"><code>MIDIConnectionEvent</code></a> to the <a data-lt="MIDIAccess.onstatechange" href="#dom-midiaccess-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiaccess-onstatechange-4">statechange</a> handler of the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-12"><code>MIDIAccess</code></a> and to the <a data-lt="MIDIPort.onstatechange" href="#dom-midiport-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-onstatechange-4">statechange</a> handler of the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-13"><code>MIDIPort</code></a>. </p> </li> <li> <p> If this port is an output port and has any pending data that is waiting to be sent, asynchronously begin sending that data. </p> </li> <li> <p> <em><b>success</b></em>: Call <var>resolver</var>'s <code>accept(value)</code> method with <var>port</var> as value argument. </p> </li> <li> <p> Terminate these steps. </p> </li> <li> <p> <em><b>failure</b></em>: Let <var>error</var> be a new <a data-link-type="interface" data-lt="DOMException" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a>. This exception's .name should be <code>"InvalidAccessError"</code> if the port is unavailable. </p> </li> <li> <p> Call <var>resolver</var>'s <code>reject(value)</code> method with <var>error</var> as value argument. </p> </li> </ol> </dd> <dt> <dfn data-export="" data-dfn-type="method" id="dom-midiport-close" data-idl="operation" data-title="close" data-dfn-for="MIDIPort" data-type="Promise" data-lt="close()" data-local-lt="MIDIPort.close|MIDIPort.close()|close" tabindex="0" aria-haspopup="dialog"><code>close</code></dfn> </dt> <dd> <p> Makes the <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-9">MIDI device</a> corresponding to the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-14"><code>MIDIPort</code></a> explicitly unavailable (subsequently changing the state from "open" to "closed"). Note that successful invocation of this method will result in <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-5">MIDI messages</a> no longer being delivered to MIDIMessageEvent handlers on a <a data-link-type="idl" data-lt="MIDIInput" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-5"><code>MIDIInput</code></a> (although setting a new handler will cause an implicit open()). </p> <p> The underlying implementation may not need to do anything in response to this call. However, some underlying implementations may not be able to support shared access to <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-10">MIDI devices</a>, and the explicit close() call enables MIDI applications to ensure other applications can gain access to devices. </p> <p> When invoked, this method returns a Promise object representing a request for access to the given MIDI port on the user's system. When the port has been closed (and therefore, in exclusive access systems, the port is available to other applications), the vended Promise is resolved. If the port is disconnected, the Promise is rejected. </p> <p> When the <code>close()</code> method is called, the user agent <em class="rfc2119">MUST</em> run the following steps: </p> <ol> <li> <p> Let <var>promise</var> be a new Promise object and <var>resolver</var> be its associated resolver. </p> </li> <li> <p> Return <var>promise</var> and run the following steps asynchronously. </p> </li> <li> <p> Let <var>port</var> be the given <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-15"><code>MIDIPort</code></a> object. </p> </li> <li> <p> If the port is already closed (its <a data-lt="MIDIPort.connection" href="#dom-midiport-connection" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-connection-4">.connection</a> is <a data-lt="MIDIPortConnectionState.closed" href="#dom-midiportconnectionstate-closed" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportconnectionstate-closed-1">"closed"</a> - e.g. the port has not yet been implicitly or explicitly opened, or <a data-lt="MIDIPort.close" href="#dom-midiport-close" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-close-2"><code>close()</code></a> has already been called on this <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-16"><code>MIDIPort</code></a>), jump to the step labeled <em><b>closed</b></em> below. </p> </li> <li> <p> If the port is an input port, skip to the next step. If the output port's <a data-lt="MIDIPort.state" href="#dom-midiport-state" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-state-2">.state</a> is not <a data-lt="MIDIPortDeviceState.connected" href="#dom-midiportdevicestate-connected" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportdevicestate-connected-3">"connected"</a>, clear all pending send data and skip to the next step. Clear any pending send data in the system with timestamps in the future, then finish sending any send messages with no timestamp or with a timestamp in the past or present, prior to proceeding to the next step. </p> </li> <li> <p> Close access to the port in the underlying system if open, and release any blocking resources in the underlying system. </p> </li> <li> <p> Change the <code>connection</code> attribute of the MIDIPort to <code>"closed"</code>, and enqueue a new <a data-link-type="idl" data-lt="MIDIConnectionEvent" href="#dom-midiconnectionevent" class="internalDFN" id="ref-for-dom-midiconnectionevent-5"><code>MIDIConnectionEvent</code></a> to the <a data-lt="MIDIAccess.onstatechange" href="#dom-midiaccess-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiaccess-onstatechange-5">statechange</a> handler of the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-13"><code>MIDIAccess</code></a> and to the <a data-lt="MIDIPort.onstatechange" href="#dom-midiport-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-onstatechange-5">statechange</a> handler of the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-17"><code>MIDIPort</code></a>. </p> </li> <li> <p> <em><b>closed</b></em>: Call <var>resolver</var>'s <code>accept(value)</code> method with <var>port</var> as value argument. </p> </li> <li> <p> Terminate these steps. </p> </li> </ol> </dd> </dl> <p id="event-midiport-statechange"> Whenever the MIDI port corresponding to the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-18"><code>MIDIPort</code></a> changes the state attribute, the user agent <em class="rfc2119">SHOULD</em> run the following steps: </p> <ol> <li> <p> Let <var data-type="MIDIPort">port</var> be the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-19"><code>MIDIPort</code></a>. </p> </li> <li> <p> <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">Fire an event</a> named <a data-lt="MIDIPort.onstatechange" href="#dom-midiport-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-onstatechange-6">statechange</a> at the <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-20"><code>MIDIPort</code></a>, and <a data-lt="MIDIAccess.onstatechange" href="#dom-midiaccess-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiaccess-onstatechange-6">statechange</a> at the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-14"><code>MIDIAccess</code></a>, using <a data-link-type="idl" data-lt="MIDIConnectionEvent" href="#dom-midiconnectionevent" class="internalDFN" id="ref-for-dom-midiconnectionevent-6"><code>MIDIConnectionEvent</code></a> with the <a data-link-type="idl" href="#dom-midiconnectionevent-port" class="internalDFN" id="ref-for-dom-midiconnectionevent-port-2"><code>port</code></a> attribute set to <var data-type="MIDIPort">port</var>. </p> </li> </ol> <section data-dfn-for="MIDIInput" id="midiinput-interface"><div class="header-wrapper"><h4 id="MIDIInput"><bdi class="secno">5.4.1 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-midiinput" data-idl="interface" data-title="MIDIInput" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIInput</code></dfn> Interface </h4><a class="self-link" href="#MIDIInput" aria-label="Permalink for Section 5.4.1"></a></div> <pre class="idl def" id="webidl-373232923"><span class="idlHeader"><a class="self-link" href="#webidl-373232923">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-midiinput" data-title="MIDIInput">[<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-midiinput" id="ref-for-dom-midiinput-6"><code>MIDIInput</code></a>: <span class="idlSuperclass"><a data-link-type="idl" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-21"><code>MIDIPort</code></a></span> {<span data-idl="" class="idlAttribute" id="idl-def-midiinput-onmidimessage" data-title="onmidimessage" data-dfn-for="MIDIInput"> attribute<span class="idlType"> <a data-link-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiinput-onmidimessage" id="ref-for-dom-midiinput-onmidimessage-1"><code>onmidimessage</code></a>;</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiinput-onmidimessage" data-idl="attribute" data-title="onmidimessage" data-dfn-for="MIDIInput" data-type="EventHandler" data-lt="onmidimessage" data-local-lt="MIDIInput.onmidimessage" tabindex="0" aria-haspopup="dialog"><code>onmidimessage</code></dfn> </dt> <dd> <p> This <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers">event handler</a>, of type "midimessage", <em class="rfc2119">MUST</em> be supported by all objects implementing <a data-link-type="idl" data-lt="MIDIInput" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-7"><code>MIDIInput</code></a> interface. </p> <p> If the handler is set and the state attribute is not <code>"opened"</code>, underlying implementation tries to make the port available, and change the state attribute to <code>"opened"</code>. If succeeded, <a data-link-type="idl" data-lt="MIDIConnectionEvent" href="#dom-midiconnectionevent" class="internalDFN" id="ref-for-dom-midiconnectionevent-7"><code>MIDIConnectionEvent</code></a> is delivered to the corresponding <code>MIDIPort</code> and <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-15"><code>MIDIAccess</code></a>. </p> </dd> </dl> <p id="event-midiinput-message"> Whenever the MIDI port corresponding to the <a data-link-type="idl" data-lt="MIDIInput" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-8"><code>MIDIInput</code></a> finishes receiving one or more <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-6">MIDI messages</a>, the user agent <em class="rfc2119">MUST</em> run the following steps: </p> <ol> <li> <p> Let <var data-type="MIDIInput">port</var> be the <a data-link-type="idl" data-lt="MIDIInput" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-9"><code>MIDIInput</code></a>. </p> </li> <li> <p> If the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-16"><code>MIDIAccess</code></a> did not enable <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-12">System Exclusive</a> access, and the message is a <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-13">System Exclusive</a> message, abort this process. </p> </li> <li> <p> <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">Fire an event</a> named "midimessage" at <var data-type="MIDIInput">port</var>, using <a data-link-type="idl" data-lt="MIDIMessageEvent" href="#dom-midimessageevent" class="internalDFN" id="ref-for-dom-midimessageevent-1"><code>MIDIMessageEvent</code></a> with the <a data-link-type="attribute" href="https://dom.spec.whatwg.org/#dom-event-timestamp"><code>timeStamp</code></a> attribute set to the time the message was received by the system, and with the <a data-link-type="idl" href="#dom-midimessageevent-data" class="internalDFN" id="ref-for-dom-midimessageevent-data-1"><code>data</code></a> attribute set to a <a data-link-type="interface" data-lt="Uint8Array" href="https://webidl.spec.whatwg.org/#idl-Uint8Array"><code>Uint8Array</code></a> of MIDI data bytes representing a single <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-7">MIDI message</a>. </p> </li> </ol> <p> It is specifically noted that MIDI <a data-link-type="dfn|abstract-op" href="#dfn-system-real-time" class="internalDFN" id="ref-for-dfn-system-real-time-1">System Real Time</a> messages may actually occur in the middle of other messages in the input stream; in this case, the <a data-link-type="dfn|abstract-op" href="#dfn-system-real-time" class="internalDFN" id="ref-for-dfn-system-real-time-2">System Real Time</a> messages will be dispatched as they occur, while the normal messages will be buffered until they are complete (and then dispatched). </p> </section> <section data-dfn-for="MIDIOutput" id="midioutput-interface"><div class="header-wrapper"><h4 id="MIDIOutput"><bdi class="secno">5.4.2 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-midioutput" data-idl="interface" data-title="MIDIOutput" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIOutput</code></dfn> Interface </h4><a class="self-link" href="#MIDIOutput" aria-label="Permalink for Section 5.4.2"></a></div> <pre class="idl def" id="webidl-1392954274"><span class="idlHeader"><a class="self-link" href="#webidl-1392954274">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-midioutput" data-title="MIDIOutput">[<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-midioutput" id="ref-for-dom-midioutput-5"><code>MIDIOutput</code></a> : <span class="idlSuperclass"><a data-link-type="idl" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-22"><code>MIDIPort</code></a></span> {<span data-idl="" class="idlMethod" id="idl-def-midioutput-send-data-timestamp" data-title="send" data-dfn-for="MIDIOutput"><span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-midioutput-send" id="ref-for-dom-midioutput-send-1"><code>send</code></a>(<span class="idlType"><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#idl-sequence">sequence</a>&lt;<a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-octet">octet</a>&gt;</span> <span class="idlParamName">data</span>, optional<span class="idlType"> <a data-link-type="typedef" href="https://www.w3.org/TR/hr-time-3/#dom-domhighrestimestamp">DOMHighResTimeStamp</a></span> <span class="idlParamName">timestamp</span> = 0);</span><span data-idl="" class="idlMethod" id="idl-def-midioutput-clear" data-title="clear" data-dfn-for="MIDIOutput"><span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-undefined">undefined</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-midioutput-clear" id="ref-for-dom-midioutput-clear-1"><code>clear</code></a>();</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="method" id="dom-midioutput-send" data-idl="operation" data-title="send" data-dfn-for="MIDIOutput" data-type="undefined" data-lt="send()|send(data)|send(data, timestamp)" data-local-lt="MIDIOutput.send|MIDIOutput.send()|send" tabindex="0" aria-haspopup="dialog"><code>send</code></dfn> </dt> <dd> <p> Enqueues the message to be sent to the corresponding MIDI port. The underlying implementation will (if necessary) coerce each member of the sequence to an unsigned 8-bit integer. The use of sequence rather than a Uint8Array enables developers to use the convenience of <code>output.send( [ 0x90, 0x45, 0x7f ] );</code> rather than having to create a Uint8Array, e.g. <code>output.send( new Uint8Array( [ 0x90, 0x45, 0x7f ] ) );</code> </p> <p> The data contains one or more complete, <a data-link-type="dfn|abstract-op" href="#dfn-valid-midi-message" class="internalDFN" id="ref-for-dfn-valid-midi-message-1">valid MIDI messages</a>. Running status is not allowed in the data, as underlying systems may not support it. </p> <p> If <var>data</var> is not a valid sequence or does not contain a <a data-link-type="dfn|abstract-op" href="#dfn-valid-midi-message" class="internalDFN" id="ref-for-dfn-valid-midi-message-2">valid MIDI message</a>, throw a <code>TypeError</code> exception. </p> <p> If <var>data</var> is a <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-14">System Exclusive</a> message, and the <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-17"><code>MIDIAccess</code></a> did not enable <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-15">System Exclusive</a> access, throw an <code>InvalidAccessError</code> exception. </p> <p> If the port is <a data-lt="MIDIPortDeviceState.disconnected" href="#dom-midiportdevicestate-disconnected" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportdevicestate-disconnected-3">"disconnected"</a>, throw an <code>InvalidStateError</code> exception. </p> <p> If the port is <a data-lt="MIDIPortDeviceState.connected" href="#dom-midiportdevicestate-connected" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportdevicestate-connected-4">"connected"</a> but the connection is <a data-lt="MIDIPortConnectionState.closed" href="#dom-midiportconnectionstate-closed" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportconnectionstate-closed-2">"closed"</a>, asynchronously try to <a data-link-type="dfn|abstract-op" href="#dfn-open-the-port" class="internalDFN" id="ref-for-dfn-open-the-port-1">open the port</a>. </p> <dl class="parameters"> <dt> sequence&lt;octet&gt; data </dt> <dd> The data to be enqueued, with each sequence entry representing a single byte of data. </dd> <dt> optional DOMHighResTimeStamp timestamp </dt> <dd> The time at which to begin sending the data to the port (as a <a data-link-type="typedef" data-lt="DOMHighResTimeStamp" href="https://www.w3.org/TR/hr-time-3/#dom-domhighrestimestamp"><code>DOMHighResTimeStamp</code></a> - a number of milliseconds measured relative to the navigation start of the document). If <code>timestamp</code> is set to zero (or another time in the past), the data is to be sent as soon as possible. </dd> </dl> </dd> <dt> <dfn data-export="" data-dfn-type="method" id="dom-midioutput-clear" data-idl="operation" data-title="clear" data-dfn-for="MIDIOutput" data-type="undefined" data-lt="clear()" data-local-lt="MIDIOutput.clear|MIDIOutput.clear()|clear" tabindex="0" aria-haspopup="dialog"><code>clear</code></dfn> </dt> <dd> <p> Clears any enqueued send data that has not yet been sent from the <a data-link-type="idl" data-lt="MIDIOutput" href="#dom-midioutput" class="internalDFN" id="ref-for-dom-midioutput-6"><code>MIDIOutput</code></a>'s queue. The implementation will need to ensure the MIDI stream is left in a good state, so if the output port is in the middle of a sysex message, a sysex termination byte (0xf7) should be sent. </p> </dd> </dl> </section> <section data-dfn-for="MIDIPortType" id="midiporttype-enum"><div class="header-wrapper"><h4 id="x5-4-3-midiporttype-enum"><bdi class="secno">5.4.3 </bdi> <dfn data-export="" data-dfn-type="enum" id="dom-midiporttype" data-idl="enum" data-title="MIDIPortType" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIPortType</code></dfn> Enum </h4><a class="self-link" href="#midiporttype-enum" aria-label="Permalink for Section 5.4.3"></a></div> <pre class="idl def" id="webidl-1197514421"><span class="idlHeader"><a class="self-link" href="#webidl-1197514421">WebIDL</a></span><code><span data-idl="" class="idlEnum" id="idl-def-midiporttype" data-title="MIDIPortType">enum <a class="internalDFN idlID" data-link-type="enum" href="#dom-midiporttype" id="ref-for-dom-midiporttype-2"><code>MIDIPortType</code></a> { <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-midiporttype-input" id="ref-for-dom-midiporttype-input-1"><code>input</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-midiporttype-output" id="ref-for-dom-midiporttype-output-1"><code>output</code></a>"</span>, };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-midiporttype-input" data-idl="enum-value" data-title="input" data-dfn-for="MIDIPortType" tabindex="0" aria-haspopup="dialog"><code>input</code></dfn> </dt> <dd> If a <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-23"><code>MIDIPort</code></a> is an input port, the type member <em class="rfc2119">MUST</em> be this value. </dd> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-midiporttype-output" data-idl="enum-value" data-title="output" data-dfn-for="MIDIPortType" tabindex="0" aria-haspopup="dialog"><code>output</code></dfn> </dt> <dd> If a <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-24"><code>MIDIPort</code></a> is an output port, the type member <em class="rfc2119">MUST</em> be this value. </dd> </dl> </section> <section data-dfn-for="MIDIPortDeviceState" id="midiportdevicestate-enum"><div class="header-wrapper"><h4 id="x5-4-4-midiportdevicestate-enum"><bdi class="secno">5.4.4 </bdi> <dfn data-export="" data-dfn-type="enum" id="dom-midiportdevicestate" data-idl="enum" data-title="MIDIPortDeviceState" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIPortDeviceState</code></dfn> Enum </h4><a class="self-link" href="#midiportdevicestate-enum" aria-label="Permalink for Section 5.4.4"></a></div> <pre class="idl def" id="webidl-920861751"><span class="idlHeader"><a class="self-link" href="#webidl-920861751">WebIDL</a></span><code><span data-idl="" class="idlEnum" id="idl-def-midiportdevicestate" data-title="MIDIPortDeviceState">enum <a class="internalDFN idlID" data-link-type="enum" href="#dom-midiportdevicestate" id="ref-for-dom-midiportdevicestate-2"><code>MIDIPortDeviceState</code></a> { <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-midiportdevicestate-disconnected" id="ref-for-dom-midiportdevicestate-disconnected-4"><code>disconnected</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-midiportdevicestate-connected" id="ref-for-dom-midiportdevicestate-connected-5"><code>connected</code></a>"</span>, };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-midiportdevicestate-disconnected" data-idl="enum-value" data-title="disconnected" data-dfn-for="MIDIPortDeviceState" tabindex="0" aria-haspopup="dialog"><code>disconnected</code></dfn> </dt> <dd> The device that <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-25"><code>MIDIPort</code></a> represents is disconnected from the system. When a device is disconnected from the system, it should not appear in the relevant map of input and output ports. </dd> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-midiportdevicestate-connected" data-idl="enum-value" data-title="connected" data-dfn-for="MIDIPortDeviceState" tabindex="0" aria-haspopup="dialog"><code>connected</code></dfn> </dt> <dd> The device that <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-26"><code>MIDIPort</code></a> represents is connected, and should appear in the map of input and output ports. </dd> </dl> </section> <section data-dfn-for="MIDIPortConnectionState" id="midiportconnectionstate-enum"><div class="header-wrapper"><h4 id="x5-4-5-midiportconnectionstate-enum"><bdi class="secno">5.4.5 </bdi> <dfn data-export="" data-dfn-type="enum" id="dom-midiportconnectionstate" data-idl="enum" data-title="MIDIPortConnectionState" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIPortConnectionState</code></dfn> Enum </h4><a class="self-link" href="#midiportconnectionstate-enum" aria-label="Permalink for Section 5.4.5"></a></div> <pre class="idl def" id="webidl-1389110906"><span class="idlHeader"><a class="self-link" href="#webidl-1389110906">WebIDL</a></span><code><span data-idl="" class="idlEnum" id="idl-def-midiportconnectionstate" data-title="MIDIPortConnectionState">enum <a class="internalDFN idlID" data-link-type="enum" href="#dom-midiportconnectionstate" id="ref-for-dom-midiportconnectionstate-2"><code>MIDIPortConnectionState</code></a> { <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-midiportconnectionstate-open" id="ref-for-dom-midiportconnectionstate-open-2"><code>open</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-midiportconnectionstate-closed" id="ref-for-dom-midiportconnectionstate-closed-3"><code>closed</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-midiportconnectionstate-pending" id="ref-for-dom-midiportconnectionstate-pending-4"><code>pending</code></a>"</span>, };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-midiportconnectionstate-open" data-idl="enum-value" data-title="open" data-dfn-for="MIDIPortConnectionState" tabindex="0" aria-haspopup="dialog"><code>open</code></dfn> </dt> <dd> The device that <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-27"><code>MIDIPort</code></a> represents has been opened (either <a data-lt="MIDIPort.open" href="#dom-midiport-open" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-open-2">implicitly or explicitly</a>) and is available for use. </dd> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-midiportconnectionstate-closed" data-idl="enum-value" data-title="closed" data-dfn-for="MIDIPortConnectionState" tabindex="0" aria-haspopup="dialog"><code>closed</code></dfn> </dt> <dd> The device that <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-28"><code>MIDIPort</code></a> represents has not been opened, or has been explicitly closed. Until a <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-29"><code>MIDIPort</code></a> has been opened either explicitly (through <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-30"><code>MIDIPort</code></a>.<a data-link-type="idl" data-lt="open()" href="#dom-midiport-open" class="internalDFN" id="ref-for-dom-midiport-open-3"><code>open</code></a><code>()</code>) or implicitly (by adding a <a data-lt="MIDIInput.onmidimessage" href="#dom-midiinput-onmidimessage" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiinput-onmidimessage-2">midimessage</a> event handler on an input port, or calling <a data-link-type="idl" data-lt="MIDIOutput" href="#dom-midioutput" class="internalDFN" id="ref-for-dom-midioutput-7"><code>MIDIOutput</code></a>.<a data-link-type="idl" data-lt="send()" href="#dom-midioutput-send" class="internalDFN" id="ref-for-dom-midioutput-send-2"><code>send</code></a><code>()</code> on an output port, this should be the default state of the device. </dd> <dt> <dfn data-export="" data-dfn-type="enum-value" id="dom-midiportconnectionstate-pending" data-idl="enum-value" data-title="pending" data-dfn-for="MIDIPortConnectionState" tabindex="0" aria-haspopup="dialog"><code>pending</code></dfn> </dt> <dd> The device that <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-31"><code>MIDIPort</code></a> represents has been opened (either <a data-lt="MIDIPortConnectionState.open" href="#dom-midiportconnectionstate-open" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportconnectionstate-open-3">implicitly or explicitly</a>), but the device has subsequently been disconnected and is unavailable for use. If the device is reconnected, prior to sending a <a data-lt="MIDIPort.onstatechange" href="#dom-midiport-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiport-onstatechange-7">statechange</a> event, the system should attempt to reopen the device (following the <a data-link-type="dfn|abstract-op" href="#dfn-open-the-port" class="internalDFN" id="ref-for-dfn-open-the-port-2">algorithm to open a MIDIPort</a>); this will result in either the connection state transitioning to "open" or to "closed". </dd> </dl> </section> </section> <section data-dfn-for="MIDIMessageEvent" id="midimessageevent-interface"><div class="header-wrapper"><h3 id="MIDIMessageEvent"><bdi class="secno">5.5 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-midimessageevent" data-idl="interface" data-title="MIDIMessageEvent" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIMessageEvent</code></dfn> Interface </h3><a class="self-link" href="#MIDIMessageEvent" aria-label="Permalink for Section 5.5"></a></div> <p> An event object implementing this interface is passed to a <a data-link-type="idl" data-lt="MIDIInput" href="#dom-midiinput" class="internalDFN" id="ref-for-dom-midiinput-10"><code>MIDIInput</code></a>'s onmidimessage handler when <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-8">MIDI messages</a> are received. Note that the DOM <a data-link-type="interface" data-lt="Event" href="https://dom.spec.whatwg.org/#event"><code>Event</code></a> <code>timeStamp</code> attribute is defined as a <a data-link-type="typedef" data-lt="DOMHighResTimeStamp" href="https://www.w3.org/TR/hr-time-3/#dom-domhighrestimestamp"><code>DOMHighResTimeStamp</code></a>, and represents the high-resolution time of when the event was received or is to be sent. </p> <pre class="idl def" id="webidl-1283774063"><span class="idlHeader"><a class="self-link" href="#webidl-1283774063">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-midimessageevent" data-title="MIDIMessageEvent">[<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-midimessageevent" id="ref-for-dom-midimessageevent-2"><code>MIDIMessageEvent</code></a> : <span class="idlSuperclass"><a data-link-type="interface" href="https://dom.spec.whatwg.org/#event">Event</a></span> {<span data-idl="" class="idlConstructor" id="idl-def-midimessageevent-constructor-type-eventinitdict" data-title="constructor" data-dfn-for="MIDIMessageEvent"> <dfn data-export="" data-dfn-type="constructor" id="dom-midimessageevent-constructor" data-idl="constructor" data-title="constructor" data-dfn-for="MIDIMessageEvent" data-lt="constructor()|constructor(type)|constructor(type, eventInitDict)" data-local-lt="MIDIMessageEvent.constructor|MIDIMessageEvent.constructor()|constructor" tabindex="0" aria-haspopup="dialog"><code>constructor</code></dfn>(<span class="idlType"><a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>, optional<span class="idlType"> <a data-link-type="idl" href="#dom-midimessageeventinit" class="internalDFN" id="ref-for-dom-midimessageeventinit-1"><code>MIDIMessageEventInit</code></a></span> <span class="idlParamName">eventInitDict</span> = {});</span><span data-idl="" class="idlAttribute" id="idl-def-midimessageevent-data" data-title="data" data-dfn-for="MIDIMessageEvent"> readonly attribute<span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array">Uint8Array</a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midimessageevent-data" id="ref-for-dom-midimessageevent-data-2"><code>data</code></a>;</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midimessageevent-data" data-idl="attribute" data-title="data" data-dfn-for="MIDIMessageEvent" data-type="Uint8Array" data-lt="data" data-local-lt="MIDIMessageEvent.data" tabindex="0" aria-haspopup="dialog"><code>data</code></dfn> </dt> <dd> <p> A Uint8Array containing the MIDI data bytes of a single <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-9">MIDI message</a>. </p> </dd> </dl> <section data-dfn-for="MIDIMessageEventInit" id="midimessageeventinit-dictionary"><div class="header-wrapper"><h4 id="MIDIMessageEventInit"><bdi class="secno">5.5.1 </bdi> <dfn data-export="" data-dfn-type="dictionary" id="dom-midimessageeventinit" data-idl="dictionary" data-title="MIDIMessageEventInit" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIMessageEventInit</code></dfn> Dictionary </h4><a class="self-link" href="#MIDIMessageEventInit" aria-label="Permalink for Section 5.5.1"></a></div> <pre class="idl def" id="webidl-1056778819"><span class="idlHeader"><a class="self-link" href="#webidl-1056778819">WebIDL</a></span><code><span data-idl="" class="idlDictionary" id="idl-def-midimessageeventinit" data-title="MIDIMessageEventInit">dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-midimessageeventinit" id="ref-for-dom-midimessageeventinit-2"><code>MIDIMessageEventInit</code></a>: <span class="idlSuperclass"><a data-link-type="dictionary" href="https://dom.spec.whatwg.org/#dictdef-eventinit">EventInit</a></span> {<span data-idl="" class="idlMember" id="idl-def-midimessageeventinit-data" data-title="data" data-dfn-for="MIDIMessageEventInit"><span class="idlType"> <a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array">Uint8Array</a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-midimessageeventinit-data" id="ref-for-dom-midimessageeventinit-data-1"><code>data</code></a>;</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="dict-member" id="dom-midimessageeventinit-data" data-idl="field" data-title="data" data-dfn-for="MIDIMessageEventInit" data-type="Uint8Array" tabindex="0" aria-haspopup="dialog"><code>data</code></dfn> </dt> <dd> <p> A Uint8Array containing the MIDI data bytes of a single <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-10">MIDI message</a>. </p> </dd> </dl> </section> </section> <section data-dfn-for="MIDIConnectionEvent" id="midiconnectionevent-interface"><div class="header-wrapper"><h3 id="MIDIConnectionEvent"><bdi class="secno">5.6 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-midiconnectionevent" data-idl="interface" data-title="MIDIConnectionEvent" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIConnectionEvent</code></dfn> Interface </h3><a class="self-link" href="#MIDIConnectionEvent" aria-label="Permalink for Section 5.6"></a></div> <p> An event object implementing this interface is passed to a <a data-link-type="idl" data-lt="MIDIAccess" href="#dom-midiaccess" class="internalDFN" id="ref-for-dom-midiaccess-18"><code>MIDIAccess</code></a>' <a data-lt="MIDIAccess.onstatechange" href="#dom-midiaccess-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiaccess-onstatechange-7"><code>onstatechange</code></a> handler when a new port becomes available (for example, when a <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-11">MIDI device</a> is first plugged in to the computer), when a previously-available port becomes unavailable, or becomes available again (for example, when a <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-2">MIDI interface</a> is disconnected, then reconnected) and (if present) is also passed to the <a data-link-type="idl" href="#dom-midiport-onstatechange" class="internalDFN" id="ref-for-dom-midiport-onstatechange-8"><code>onstatechange</code></a> handlers for any <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-32"><code>MIDIPort</code></a>s referencing the port. </p> <p> When a <a data-link-type="idl" data-lt="MIDIPort" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-33"><code>MIDIPort</code></a> is in the <a data-lt="MIDIPortConnectionState.pending" href="#dom-midiportconnectionstate-pending" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiportconnectionstate-pending-5">"pending"</a> state and the device is reconnected to the host system, prior to firing a <a data-lt="MIDIAccess.onstatechange" href="#dom-midiaccess-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiaccess-onstatechange-8">statechange</a> event the <a data-link-type="dfn|abstract-op" href="#dfn-open-the-port" class="internalDFN" id="ref-for-dfn-open-the-port-3">algorithm to open a MIDIPort</a> is run on it to attempt to reopen the port. If this transition fails (e.g. the Port is reserved by something else in the underlying system, and therefore unavailable for use), the connection state moves to "closed", else it transitions back to "open". This is done prior to the <a data-lt="MIDIAccess.onstatechange" href="#dom-midiaccess-onstatechange" class="internalDFN" data-link-type="idl" id="ref-for-dom-midiaccess-onstatechange-9">statechange</a> event for the device state change so that the event will reflect the final connection state as well as the device state. </p> <p> Some underlying systems may not provide notification events for device connection status; such systems may have long time delays as they poll for new devices infrequently. As such, it is suggested that heavy reliance on connection events not be used. </p> <pre class="idl def" id="webidl-960759427"><span class="idlHeader"><a class="self-link" href="#webidl-960759427">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-midiconnectionevent" data-title="MIDIConnectionEvent">[<span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>, <span class="extAttr"><a data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-midiconnectionevent" id="ref-for-dom-midiconnectionevent-8"><code>MIDIConnectionEvent</code></a> : <span class="idlSuperclass"><a data-link-type="interface" href="https://dom.spec.whatwg.org/#event">Event</a></span> {<span data-idl="" class="idlConstructor" id="idl-def-midiconnectionevent-constructor-type-eventinitdict" data-title="constructor" data-dfn-for="MIDIConnectionEvent"> <dfn data-export="" data-dfn-type="constructor" id="dom-midiconnectionevent-constructor" data-idl="constructor" data-title="constructor" data-dfn-for="MIDIConnectionEvent" data-lt="constructor()|constructor(type)|constructor(type, eventInitDict)" data-local-lt="MIDIConnectionEvent.constructor|MIDIConnectionEvent.constructor()|constructor" tabindex="0" aria-haspopup="dialog"><code>constructor</code></dfn>(<span class="idlType"><a data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>, optional<span class="idlType"> <a data-link-type="idl" href="#dom-midiconnectioneventinit" class="internalDFN" id="ref-for-dom-midiconnectioneventinit-1"><code>MIDIConnectionEventInit</code></a></span> <span class="idlParamName">eventInitDict</span> = {});</span><span data-idl="" class="idlAttribute" id="idl-def-midiconnectionevent-port" data-title="port" data-dfn-for="MIDIConnectionEvent"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-34"><code>MIDIPort</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-midiconnectionevent-port" id="ref-for-dom-midiconnectionevent-port-3"><code>port</code></a>;</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="attribute" id="dom-midiconnectionevent-port" data-idl="attribute" data-title="port" data-dfn-for="MIDIConnectionEvent" data-type="MIDIPort" data-lt="port" data-local-lt="MIDIConnectionEvent.port" tabindex="0" aria-haspopup="dialog"><code>port</code></dfn> </dt> <dd> <p> The port that has been connected or disconnected. </p> </dd> </dl> <section data-dfn-for="MIDIConnectionEventInit" id="midiconnectioneventinit-dictionary"><div class="header-wrapper"><h4 id="MIDIConnectionEventInit"><bdi class="secno">5.6.1 </bdi> <dfn data-export="" data-dfn-type="dictionary" id="dom-midiconnectioneventinit" data-idl="dictionary" data-title="MIDIConnectionEventInit" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>MIDIConnectionEventInit</code></dfn> Dictionary </h4><a class="self-link" href="#MIDIConnectionEventInit" aria-label="Permalink for Section 5.6.1"></a></div> <pre class="idl def" id="webidl-825586432"><span class="idlHeader"><a class="self-link" href="#webidl-825586432">WebIDL</a></span><code><span data-idl="" class="idlDictionary" id="idl-def-midiconnectioneventinit" data-title="MIDIConnectionEventInit">dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-midiconnectioneventinit" id="ref-for-dom-midiconnectioneventinit-2"><code>MIDIConnectionEventInit</code></a>: <span class="idlSuperclass"><a data-link-type="dictionary" href="https://dom.spec.whatwg.org/#dictdef-eventinit">EventInit</a></span> {<span data-idl="" class="idlMember" id="idl-def-midiconnectioneventinit-port" data-title="port" data-dfn-for="MIDIConnectionEventInit"><span class="idlType"> <a data-link-type="idl" href="#dom-midiport" class="internalDFN" id="ref-for-dom-midiport-35"><code>MIDIPort</code></a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-midiconnectioneventinit-port" id="ref-for-dom-midiconnectioneventinit-port-1"><code>port</code></a>;</span> };</span></code></pre> <dl> <dt> <dfn data-export="" data-dfn-type="dict-member" id="dom-midiconnectioneventinit-port" data-idl="field" data-title="port" data-dfn-for="MIDIConnectionEventInit" data-type="MIDIPort" tabindex="0" aria-haspopup="dialog"><code>port</code></dfn> </dt> <dd> <p> The port that has been connected or disconnected. </p> </dd> </dl> </section> </section> </section> <section id="privacy-considerations"><div class="header-wrapper"><h2 id="x6-privacy-considerations"><bdi class="secno">6. </bdi> Privacy Considerations </h2><a class="self-link" href="#privacy-considerations" aria-label="Permalink for Section 6."></a></div> <p> Allowing the enumeration of the user's <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-3">MIDI interfaces</a> is a potential target for fingerprinting; that is, uniquely identifying a user by the specific <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-4">MIDI interfaces</a> they have connected. </p> <p> Note that in this context what can be enumerated is the MIDI <i>interfaces</i>. This includes most devices connected to the host computer with USB, since USB-<a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-12">MIDI devices</a> typically have their own <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-5">MIDI interface</a> and would be enumerated. An individual sampler or synthesizer <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-13">MIDI device</a> plugged into a <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-6">MIDI interface</a> with a 5-pin DIN cable would not be enumerated. The interfaces that could be fingerprinted are equivalent to MIDI "ports", and for each <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-7">MIDI interface</a> the API will expose the name of the device, manufacturer, and opaque identifier of the <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-8">MIDI interface</a>. </p> <p> Most systems have no <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-9">MIDI interfaces</a> attached. Few systems will have large numbers of <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-10">MIDI interfaces</a> attached. Thus, the additional fingerprinting exposure of enumerating MIDI devices is similar to the Gamepad API’s additional fingerprinting exposure through gamepad enumeration: typical users will have at most a few devices connected, their configuration may change, and the information exposed is about the interface itself (i.e., no user-configured data). </p> </section> <section id="security-considerations"><div class="header-wrapper"><h2 id="x7-security-considerations"><bdi class="secno">7. </bdi> Security Considerations </h2><a class="self-link" href="#security-considerations" aria-label="Permalink for Section 7."></a></div> <p> The first <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-14">MIDI devices</a> were released in 1983, before the web platform and its security risks existed. Many <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-15">MIDI devices</a> are still in use long after their manufacturers stopped supporting them. <a data-link-type="dfn|abstract-op" href="#dfn-midi" class="internalDFN" id="ref-for-dfn-midi-2">MIDI</a> has adapted to transports beyond the original serial connection, such as FireWire, USB, and Bluetooth. This poses a security challenge, with a long tail of devices from different eras that do not have official support but are still actively in use, connected to computers and the web in ways their designers did not expect. </p> <section id="malicious-firmware-updates"><div class="header-wrapper"><h3 id="x7-1-malicious-firmware-updates"><bdi class="secno">7.1 </bdi> Malicious Firmware Updates </h3><a class="self-link" href="#malicious-firmware-updates" aria-label="Permalink for Section 7.1"></a></div> <p> One concerning theoretical attack involves malicious firmware updates for USB-<a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-16">MIDI devices</a>. USB devices in general can do things based on their device descriptor, which is sent from the USB device itself. If a USB-<a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-17">MIDI device</a>'s firmware can modify what descriptor is sent, it could make itself act as a human interface device. This could allow a malicious website to read or inject keystrokes or other events on the host computer, which could lead to a total compromise of the system. </p> <p> The attack would proceed as follows: </p> <ol> <li> A malicious site tricks the user into granting Web MIDI permission. </li> <li> The malicious site enumerates the <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-18">MIDI devices</a> connected to the user's machine, and identifies a vulnerable device. </li> <li> The malicious site sends a pre-crafted set of <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-11">MIDI messages</a> to the vulnerable device, compromising the device by overwriting its firmware and adding a human interface device to its USB descriptor. </li> <li> The compromised device injects keystrokes to download or otherwise reproduce a pre-crafted security exploit and execute it, compromising the system. </li> </ol> <p> In order to enable to the above attack, a <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-19">MIDI device</a> would need <em>all</em> of the following to be true: </p> <ul> <li> Be vulnerable to malicious firmware updates. <em>All</em> of the following must be true: <ul> <li> Have user-programmable firmware. Many <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-20">MIDI devices</a> have re-programmable firmware. Those that do not are not vulnerable. </li> <li> Allow firmware updates via sending <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-12">MIDI messages</a>. Many <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-21">MIDI devices</a> use <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-16">System Exclusive</a> messages to perform firmware updates. This is a common use of <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-17">System Exclusive</a> messages. It is technically possible to make a device that uses non-<a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-18">System Exclusive</a> messages to perform firmware updates, but this is not an intended use of non-<a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-19">System Exclusive</a> messages. Other devices may use out-of-band USB communication or require the user to connect a storage device directly to the <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-22">MIDI device</a> to perform firmware updates, which cannot be done using the Web MIDI API, and are not vulnerable. </li> <li> Allow firmware updates without explicit user interaction on the device. There are known <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-23">MIDI devices</a> which do not require any user interaction to initiate a firmware update. Most <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-24">MIDI devices</a> require the user to place them in a special update mode first, such as by holding down a button or selecting a menu option, and are not vulnerable unless the attacker tricks the user into cooperating. </li> </ul> </li> <li> Be a USB-<a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-25">MIDI device</a>. Most modern <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-26">MIDI devices</a> have a USB <a data-link-type="dfn|abstract-op" href="#dfn-midi-interface" class="internalDFN" id="ref-for-dfn-midi-interface-11">MIDI interface</a>. Some older <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-27">MIDI devices</a> only have a serial connection, and would not enable this attack. </li> <li> The <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-28">MIDI device</a>'s firmware would have to be able to modify the USB controller's firmware. Many <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-29">MIDI devices</a> have USB controller firmware that is not addressable from the main firmware, and would not enable this attack. </li> </ul> <p> <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-30">MIDI devices</a> that are vulnerable to malicious firmware updates but do not satisfy the other conditions cannot be used with this attack to compromise the host system. A malicious firmware update could still cause these <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-31">MIDI devices</a> to stop working or behave in undesired ways. </p> <p> To mitigate this risk, implementers should emphasize the following in their implementations: </p> <ul> <li> Implement <a data-lt="Navigator.requestMIDIAccess" href="#dom-navigator-requestmidiaccess" class="internalDFN" data-link-type="idl" id="ref-for-dom-navigator-requestmidiaccess-6"><code>requestMIDIAccess()</code></a> in a way that informs users of the risks of firmware updates, such as through text in permission prompts. </li> <li> Implement SecureContext as specified to prevent user-initiated legitimate firmware updates from being modified. </li> <li> Handle the sysex parameter as specified, to encourage developers to only request <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-20">System Exclusive</a> messages when necessary, since most firmware updates use <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-21">System Exclusive</a> messages. </li> </ul> <p> Explicitly allowing or blocking lists of known MIDI devices may also help mitigate this specific attack, but many small companies and individuals build MIDI devices, and many MIDI devices are no longer supported, so doing this would significantly reduce the usability of the Web MIDI API. </p> </section> <section id="additional-security-considerations"><div class="header-wrapper"><h3 id="x7-2-additional-security-considerations"><bdi class="secno">7.2 </bdi> Additional Security Considerations </h3><a class="self-link" href="#additional-security-considerations" aria-label="Permalink for Section 7.2"></a></div> <p> Separate from the fingerprinting concerns of identifying the available ports are concerns around sending and receiving <a data-link-type="dfn|abstract-op" href="#dfn-midi-message" class="internalDFN" id="ref-for-dfn-midi-message-13">MIDI messages</a>. Those issues are explored in more depth below. </p> <p> MIDI messages can be divided into <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-22">System Exclusive</a> messages, and short (non-<a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-23">System Exclusive</a>) messages. <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-24">System Exclusive</a> messages can be further subdivided into Universal System Exclusive messages such as the commonly recognized MIDI Time Code and MIDI Sample Dump Standard, and device-specific messages like “patch control data for a Roland Jupiter-80 synthesizer” that do not apply to other devices. </p> <p> Before discussing security concerns, it's useful to examine what scenarios are enabled by MIDI using these features: </p> <ul> <li> Receiving short messages from <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-32">MIDI devices</a> - this enables getting input from keyboards, drum pads, guitars, wind controllers, DJ/controllerist controllers, and more, and using those messages as input to control instruments and features in the <a data-link-type="dfn|abstract-op" href="#WebAudio" class="internalDFN" id="ref-for-WebAudio-2">Web Audio API</a> as well as other control scenarios. MIDI is the protocol of choice for the multi-billion-dollar music production industry for getting physical controllers like knobs and buttons attached to your computer, both in pro/prosumer audio and media applications as well as consumer applications like Garageband. </li> <li> Sending short messages to <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-33">MIDI devices</a> - it’s tempting to say sending is significantly less interesting, as the scenario of attached output devices like hardware synthesizers is less common in today's market. The major exception to this is that many MIDI controllers have external host control of their indicator lights, and this makes them dramatically more useful. For example, the very popular Novation Launchpad controller uses MIDI note on/off messages sent to it to turn on/off and change colors of the buttons. The same is true of nearly all DJ controllers. </li> <li> Sending and receiving <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-25">System Exclusive</a> messages - for more advanced communication with high-end hardware devices, <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-26">System Exclusive</a> messages are required. Some common MIDI commands are also sent as Universal <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-27">System Exclusive</a> messages, such as MIDI Machine Control - generic start/stop/rewind/fast-forward commands. Many devices use device-specific <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-28">System Exclusive</a> messages to program patches, send advanced controller messages, download firmware, etc., which are much-demanded scenarios for Web MIDI. Some devices use <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-29">System Exclusive</a> as a direct control protocol, as they can pack more data into a single “message”, and most devices use <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-30">System Exclusive</a> as a way to save and restore patches and configuration information on less-expensive computer storage. Several of the major music hardware producers have expressed strong interest in using Web MIDI to provide web-based configuration and programming interfaces to their hardware. In short, disabling <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-31">System Exclusive</a> altogether does not only disable high-end scenarios. </li> </ul> <p> The potential security impact of each of these is as follows: </p> <ul> <li> Sending short messages to a <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-34">MIDI device</a> - sending note-on/note-off/controller messages could cause sounds to be played by attached devices, including (on Mac and Windows) any default virtual synthesizers. This by itself does not cause any concerning exposure - you can already make sounds without interaction, through &lt;audio&gt; or Web Audio. Some attached devices might be professional lighting control systems, so it’s possible to control stage lighting; however, this is rare, and no known system has the ability to cause lasting damage or information leakage based solely on short messages. At worst, a malicious page could flash lights, and the user could close the page and reset their lighting controller. The additional concerns about sending short messages are analogous to any audio output - you cannot overwrite user information or expose user information, but you can make sounds happen, change patches, or (in rare configurations) toggle lights - but non-destructively, and not persistently. </li> <li> Receiving short messages from a <a data-link-type="dfn|abstract-op" href="#dfn-midi-device" class="internalDFN" id="ref-for-dfn-midi-device-35">MIDI device</a> - receiving note-on/note-off/controller messages would not cause information exposure or security issues, as there is no identifying data being received, just a stream of controller messages - all of which must be initiated by the user on that MIDI device (except clock-type messages). This is analogous to listening to keyboard, mouse, mobile/laptop accelerometer, touch input or gamepad events; there is no additional information exposed, and all messages other than clock signals must be initiated by the user. </li> <li> Sending and receiving <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-32">System Exclusive</a> messages - this is the biggest concern, because it is possible to write code that looks for system-specific responses to <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-33">System Exclusive</a> messages, which could identify the hardware available, and then use it to download data - e.g. samples stored in a sampler - or replace that data (erasing sample data or patches in the device), although both these scenarios would have to be coded for a particular device. It is also possible that some samplers might enable a System Exclusive message to start recording a sample - so if the sampler happened to have a dedicated microphone attached (uncommon in practice, but possible), it would be possible to write code specific to a particular device that could record a short sample of sound and then upload it to the network without further user intervention. You could not stream audio from the device, and most samplers have fairly limited memory, and MIDI Sample Dump sysex is a slow way to transfer data - it has to transcode into 7-bit - so it’s unlikely you could listen in for long periods. More explicit fingerprinting is a concern, as the patch information/stored samples/user configuration could uniquely identify the system. Again, this requires much device-specific code; there is not standardized “grab all patches and hash it” capability. This suggests that <a data-link-type="dfn|abstract-op" href="#dfn-system-exclusive" class="internalDFN" id="ref-for-dfn-system-exclusive-34">System Exclusive</a> messages are in a security category of their own. Because of this less bounded potential, it seems that distinguishing requests for SysEx separately in the API is a good idea, in order to more carefully provide user security hooks. The <a data-lt="Navigator.requestMIDIAccess" href="#dom-navigator-requestmidiaccess" class="internalDFN" data-link-type="idl" id="ref-for-dom-navigator-requestmidiaccess-7">suggested security model</a> explicitly allows user agents to require the user's approval before giving access to MIDI devices, although it is not currently required to prompt the user for this approval - but it is also detailed that System Exclusive support must be requested as part of that request. </li> </ul> </section> </section> <section id="changelog"><div class="header-wrapper"><h2 id="x8-changelog"><bdi class="secno">8. </bdi> Changelog </h2><a class="self-link" href="#changelog" aria-label="Permalink for Section 8."></a></div> <section id="changes-since-working-draft-17-march-2015"><div class="header-wrapper"><h3 id="x8-1-changes-since-working-draft-17-march-2015"><bdi class="secno">8.1 </bdi> Changes since Working Draft 17 March 2015 </h3><a class="self-link" href="#changes-since-working-draft-17-march-2015" aria-label="Permalink for Section 8.1"></a></div> <rs-changelog from="f7632e65a5708b01fcb78ca04e254e00b5864465"><ul> <li><a href="https://github.com/WebAudio/web-midi-api/commit/eb60649">Merge pull request #270 from mjwilson-google/var</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/fc3d013">Use let instead of var in examples</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/c7ca48d">Merge pull request #269 from mjwilson-google/valid-midi-message</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/332d469">Revise wording for normative definition</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/cd3575b">Add non-normative definition of a valid MIDI message</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/3c36dcb">Merge pull request #267 from mjwilson-google/not-allowed-error</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/4f5f567">Merge pull request #268 from mjwilson-google/privacy-considerations</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/d2d1e65">Change the majority of to most</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/a60f67c">Update privacy section</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/b7806b8">Use NotAllowedError instead of SecurityError</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/75f9aa2">Merge pull request #265 from mjwilson-google/unlink-definitions</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/c53805b">Merge pull request #264 from mjwilson-google/clarify-clear</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/b360b7d">Don't use &lt;dfn&gt; tag on algorithms that aren't referenced elsewhere in…</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/974bd77">Update README.md to reference the gh-pages branch</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/c1ba21d">Clarify that MIDIOutput.clear() should clear enqueued send data</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/192b269">Merge pull request #263 from mjwilson-google/update-token</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f21b747">Update echidna token name</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/4314762">Merge pull request #256 from mjwilson-google/worker-availability</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/c24c1ff">Merge pull request #262 from mjwilson-google/spec-prod</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/566a36e">Remove extra parameter from p tag</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/ea0cbd1">Add auto-publish.yml</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/34fe72c">Merge pull request #259 from mjwilson-google/changelog</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/5576837">Add changelog</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/32a4224">Expose all interfaces</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/4b5f6c6">Make MIDIAccess transferable and exposed to workers</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/1dbbfc8">Merge pull request #255 from mjwilson-google/link-definitions</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/0ba3507">Add links and update link format according to Respec rules</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/5d8e193">Merge pull request #252 from mjwilson-google/168-require-init</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/a53a40c">Don't need to explicitly nullify dictionaries</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/82fd9c4">Make types nullable</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/b45b011">Merge branch 'WebAudio:gh-pages' into 168-require-init</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/21b4bc8">Merge pull request #254 from mjwilson-google/link-webaudio</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/308f2cb">Link Web Audio API to definition and add some punctuation</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/e880e26">Merge pull request #253 from mjwilson-google/242-no-implementation-re…</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/6af910e">Add statement that no implementation report currently exists</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/7758d15">Merge pull request #251 from mjwilson-google/add-test-suite-uri</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/13b09ff">Make init dictionaries required</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f97f937">Add test suite URI</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/52aecbd">Merge pull request #250 from mjwilson-google/185-split-privacy-and-se…</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f4cb70a">Split the existing Security and Privacy Considerations section into t…</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/242c7cb">Merge pull request #249 from mjwilson-google/fix-headings</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/045c4a9">Organize sections</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/7e6e141">Merge pull request #248 from mjwilson-google/174-move-examples-to-exp…</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/64da06c">Move examples to explainer</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/423a5ee">Merge pull request #247 from mjwilson-google/244-system-real-time</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/1316439">Merge branch 'gh-pages' into 244-system-real-time</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/b95b2bb">Merge pull request #246 from mjwilson-google/244-system-exclusive</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/e4e3f8b">Merge branch 'WebAudio:gh-pages' into 244-system-exclusive</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/bfbbfac">Wrap at 80 columns</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/b4ab121">Link definition of System Real Time</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/d717e08">Capitalize and link System Exclusive definition</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/52604e1">Merge pull request #245 from mjwilson-google/default-allowlist</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f9fa7f8">Fix links to user agent and default allowlist</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/5b48e78">Merge pull request #243 from mjwilson-google/move-sotd</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/cb6d8fd">Move sotd to just after abstract</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/95f6dc7">Merge pull request #241 from mjwilson-google/editor-maintenance</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/7510d80">Move Jussi to former editor, add URL for Michael</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/e0db063">Merge pull request #237 from WebAudio/mp-edit</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/4578f5e">Update index.html</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/fa3e14f">fix for #142 https://github.com/WebAudio/web-midi-api/issues/142</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/eb39ffe">Merge pull request #234 from dontcallmedom/respec-fixes</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/29e654c">Merge pull request #224 from marcoscaceres/dont_exclude</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/1ecc0db">Merge pull request #236 from WebAudio/mp-edit</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/c8848b0">fix for issue #205 https://github.com/WebAudio/web-midi-api/issues/205</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/2c6c05f">Simplify pharsing of event firing</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/71df0a7">Use group's shortname as now required by respec</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/b7752bf">Editorial: don't exclude Permissions IDL</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/59e174f">Merge pull request #222 from tidoust/flag-midipermissiondescriptor</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/66c77c9">Flag MidiPermissionDescriptor definition as non normative</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f3373f4">Merge pull request #221 from marcoscaceres/patch-1</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/2a86fd5">Merge pull request #219 from miketaylr/permissions/issue/294</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/59cff75">Editorial: fix event.timeStamp typo</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/9bf65d7">Fold in @marcoscaceres' suggestions.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/21f1bf8">Chore: Move specs from data-cite to xref config.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/09f593a">Editorial: Add a Permissions integration section</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/3a4b378">Editorial: Edits to permissions policy section.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/e31a420">Chore: stray whitespace cleanup</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/8bd3611">Editorial: Default allowlist value should be a string, not a sequence.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/3c77a2c">Merge pull request #218 from ZingBlue/patch-1</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/ae904d6">Use HTTPS in URLs</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/db473bc">Update URL to use github.io</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/da1fd64">Merge pull request #214 from autokagami/webmidi</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/653d50a">Merge pull request #213 from sidvishnoi/gh-pages</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/30cf0c3">Merge pull request #209 from hughrawlinson/patch-1</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/5330906">Editorial: Align with Web IDL specification</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/07a666c">Editorial: rename feature-policy to permissions-policy</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f6f0c80">chore: fix feature-policy linking errors</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/08ac76e">Remove errant character</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/c7b6843">chore: tidy doc</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/04bcdb5">Editorial: use new constructor syntax</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f5e7352">Chore: ReSpec fixes + enable xref</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/b64a190">Additional fixes</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/7f05d43">fix Exposed warnings</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/6279f53">Chore: ReSpec fixes + enable xref</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/53b752d">chore(.pr-preview.json): enable pull request previews</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/88d7455">set default for optional dictionary</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/3a883c8">Chore(.pr-preview.json): enable pull request previews</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/0c79114">set default for optional dictionary</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/2604127">Merge pull request #200 from toyoshim/securecontext_maplikes</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/8a32c28">Making MIDI{Input|Output}Map interfaces as [SecureContext]</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/7dd278a">Merge pull request #196 from WebAudio/dontcallmedom-patch-1</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/6415b89">Mark repo as host of rec-track work</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/8f53a23">Merge pull request #194 from WebAudio/fixup</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/78545ce">fixup IDL, cross refs</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/05de4f0">Merge pull request #192 from cwilso/gh-pages</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/c1868dd">Resolve review comments</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/ea872cb">Marking interfaces as [SecureContext]</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/53e5bec">Merge pull request #188 from foolip/update-wpt-url</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/2fa719a">Update web-platform-tests URLs</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/35403b1">Adding baseline CODE_OF_CONDUCT.md</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/6380c3c">Create CONTRIBUTING.md</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f9b025f">Create LICENSE.md</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/fac6808">Create w3c.json</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/98c8057">Merge pull request #181 from raymeskhoury/gh-pages</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/01853e3">Merge pull request #182 from foolip/patch-1</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/66762f1">Describe that a SecurityError should be returned if the request is de…</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/6d49546">Ask for tests for normative changes in README.md</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/0ec8576">Add Feature Policy integration for WebMidi</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/543b0fd">Merge pull request #178 from eyqs/gh-pages</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/ca70ccc">Silence respec whining about https</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/3a7de92">Fix minor typos</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/cab3589">Merge pull request #175 from WebAudio/modernize_idl</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f72328d">chore: use new school WebIDL (closes #170)</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/1b79aed">Clarify onstatechange's effect on lifetime.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/4bc44eb">Add a "software" option to enable requests of software synths.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/cbc0fbe">Remove receivedTime (in favor of DOM Event timeStamp)</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/549d2a3">More permissive copyright license</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/e476fe1">WD-&gt;ED</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/689ef96">Merge pull request #130 from natevw/patch-1</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/cdf067e">Fix typo (fixes issue #163)</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/7b7374d">Merge pull request #155 from natevw/patch-2</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/1594149">Fix up inputs enumeration example</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/cb450a0">Remove callback references</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/0de9357">Fix up double-&gt;DOMHighResTimeStamp references.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/807867c">default value for timestamp</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/2890480">Removed reference to software synthesizers. Fixes issue #153.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/439c238">Fixes #149.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/51c537d">Merge pull request #147 from ryoyakawai/submission/update</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/44a1614">Fixed #146 : Removed "value." between "entry." and "onmidimessage" in…</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/3d8587f">Remove reference to Typed-Arrays for Uint8Array</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/bb5c9f0">https for editor's draft link</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/6083126">REALLY fix #135.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/efdfb8a">Typo correction: fixes #135.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/ab65963">"state"-&gt;"connection"</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/7ae727c">Fixes #132.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/3866ff8">Fixes #131.</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/7ebce3d">fix typo in close method</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/400deb4">Merge pull request #271 from mjwilson-google/security</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/f6b931b">Address reviewer comments</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/2db6f3b">Merge branch 'WebAudio:gh-pages' into security</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/1ec82dc">Remove spaces around slashes</a></li><li><a href="https://github.com/WebAudio/web-midi-api/commit/b1ca3d8">Add more detail to security section</a></li> </ul></rs-changelog> </section> </section> <section id="references" class="appendix"><div class="header-wrapper"><h2 id="a-references"><bdi class="secno">A. </bdi>References</h2><a class="self-link" href="#references" aria-label="Permalink for Appendix A."></a></div><section id="normative-references"><div class="header-wrapper"><h3 id="a-1-normative-references"><bdi class="secno">A.1 </bdi>Normative references</h3><a class="self-link" href="#normative-references" aria-label="Permalink for Appendix A.1"></a></div> <dl class="bibliography"><dt id="bib-dom">[dom]</dt><dd> <a href="https://dom.spec.whatwg.org/"><cite>DOM Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a> </dd><dt id="bib-hr-time">[hr-time]</dt><dd> <a href="https://www.w3.org/TR/hr-time-3/"><cite>High Resolution Time</cite></a>. Yoav Weiss. W3C. 7 November 2024. W3C Working Draft. URL: <a href="https://www.w3.org/TR/hr-time-3/">https://www.w3.org/TR/hr-time-3/</a> </dd><dt id="bib-html">[html]</dt><dd> <a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Anne van Kesteren; Domenic Denicola; Dominic Farolino; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> </dd><dt id="bib-infra">[infra]</dt><dd> <a href="https://infra.spec.whatwg.org/"><cite>Infra Standard</cite></a>. Anne van Kesteren; Domenic Denicola. WHATWG. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a> </dd><dt id="bib-midi">[MIDI]</dt><dd> <a href="https://midi.org/midi-1-0-core-specifications"><cite>MIDI 1.0 Core Specifications</cite></a>. The MIDI Manufacturers Association. 2014. URL: <a href="https://midi.org/midi-1-0-core-specifications">https://midi.org/midi-1-0-core-specifications</a> </dd><dt id="bib-permissions">[Permissions]</dt><dd> <a href="https://www.w3.org/TR/permissions/"><cite>Permissions</cite></a>. Marcos Caceres; Mike Taylor. W3C. 19 March 2024. W3C Working Draft. URL: <a href="https://www.w3.org/TR/permissions/">https://www.w3.org/TR/permissions/</a> </dd><dt id="bib-permissions-policy">[permissions-policy]</dt><dd> <a href="https://www.w3.org/TR/permissions-policy-1/"><cite>Permissions Policy</cite></a>. Ian Clelland. W3C. 25 September 2024. W3C Working Draft. URL: <a href="https://www.w3.org/TR/permissions-policy-1/">https://www.w3.org/TR/permissions-policy-1/</a> </dd><dt id="bib-rfc2119">[RFC2119]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. S. Bradner. IETF. March 1997. Best Current Practice. URL: <a href="https://www.rfc-editor.org/rfc/rfc2119">https://www.rfc-editor.org/rfc/rfc2119</a> </dd><dt id="bib-rfc8174">[RFC8174]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc8174"><cite>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</cite></a>. B. Leiba. IETF. May 2017. Best Current Practice. URL: <a href="https://www.rfc-editor.org/rfc/rfc8174">https://www.rfc-editor.org/rfc/rfc8174</a> </dd><dt id="bib-webaudio">[webaudio]</dt><dd> <a href="https://www.w3.org/TR/webaudio-1.0/"><cite>Web Audio API</cite></a>. Paul Adenot; Hongchan Choi. W3C. 17 June 2021. W3C Recommendation. URL: <a href="https://www.w3.org/TR/webaudio-1.0/">https://www.w3.org/TR/webaudio-1.0/</a> </dd><dt id="bib-webidl">[WEBIDL]</dt><dd> <a href="https://webidl.spec.whatwg.org/"><cite>Web IDL Standard</cite></a>. Edgar Chen; Timothy Gu. WHATWG. Living Standard. URL: <a href="https://webidl.spec.whatwg.org/">https://webidl.spec.whatwg.org/</a> </dd></dl> </section></section><p role="navigation" id="back-to-top"> <a href="#title"><abbr title="Back to Top">↑</abbr></a> </p><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-WebAudio" aria-label="Links in this document to definition: Web Audio API"> <span class="caret"></span> <div> <a class="self-link" href="#WebAudio" aria-label="Permalink for definition: Web Audio API. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-WebAudio-1" title="§ Abstract">§ Abstract</a> </li><li> <a href="#ref-for-WebAudio-2" title="§ 7.2 Additional Security Considerations">§ 7.2 Additional Security Considerations</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-midi" aria-label="Links in this document to definition: MIDI"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-midi" aria-label="Permalink for definition: MIDI. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-midi-1" title="§ 4.3 Extensions to the Navigator interface">§ 4.3 Extensions to the Navigator interface</a> </li><li> <a href="#ref-for-dfn-midi-2" title="§ 7. Security Considerations">§ 7. Security Considerations</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-midi-device" aria-label="Links in this document to definition: MIDI device"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-midi-device" aria-label="Permalink for definition: MIDI device. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-midi-device-1" title="§ Abstract">§ Abstract</a> </li><li> <a href="#ref-for-dfn-midi-device-2" title="§ 1. Introduction">§ 1. Introduction</a> </li><li> <a href="#ref-for-dfn-midi-device-3" title="§ 4. Obtaining Access to MIDI Devices">§ 4. Obtaining Access to MIDI Devices</a> </li><li> <a href="#ref-for-dfn-midi-device-4" title="§ 4.3 Extensions to the Navigator interface">§ 4.3 Extensions to the Navigator interface</a> <a href="#ref-for-dfn-midi-device-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-midi-device-6" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dfn-midi-device-7" title="Reference 2">(2)</a> <a href="#ref-for-dfn-midi-device-8" title="Reference 3">(3)</a> <a href="#ref-for-dfn-midi-device-9" title="Reference 4">(4)</a> <a href="#ref-for-dfn-midi-device-10" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-midi-device-11" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li><li> <a href="#ref-for-dfn-midi-device-12" title="§ 6. Privacy Considerations">§ 6. Privacy Considerations</a> <a href="#ref-for-dfn-midi-device-13" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-midi-device-14" title="§ 7. Security Considerations">§ 7. Security Considerations</a> <a href="#ref-for-dfn-midi-device-15" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-midi-device-16" title="§ 7.1 Malicious Firmware Updates">§ 7.1 Malicious Firmware Updates</a> <a href="#ref-for-dfn-midi-device-17" title="Reference 2">(2)</a> <a href="#ref-for-dfn-midi-device-18" title="Reference 3">(3)</a> <a href="#ref-for-dfn-midi-device-19" title="Reference 4">(4)</a> <a href="#ref-for-dfn-midi-device-20" title="Reference 5">(5)</a> <a href="#ref-for-dfn-midi-device-21" title="Reference 6">(6)</a> <a href="#ref-for-dfn-midi-device-22" title="Reference 7">(7)</a> <a href="#ref-for-dfn-midi-device-23" title="Reference 8">(8)</a> <a href="#ref-for-dfn-midi-device-24" title="Reference 9">(9)</a> <a href="#ref-for-dfn-midi-device-25" title="Reference 10">(10)</a> <a href="#ref-for-dfn-midi-device-26" title="Reference 11">(11)</a> <a href="#ref-for-dfn-midi-device-27" title="Reference 12">(12)</a> <a href="#ref-for-dfn-midi-device-28" title="Reference 13">(13)</a> <a href="#ref-for-dfn-midi-device-29" title="Reference 14">(14)</a> <a href="#ref-for-dfn-midi-device-30" title="Reference 15">(15)</a> <a href="#ref-for-dfn-midi-device-31" title="Reference 16">(16)</a> </li><li> <a href="#ref-for-dfn-midi-device-32" title="§ 7.2 Additional Security Considerations">§ 7.2 Additional Security Considerations</a> <a href="#ref-for-dfn-midi-device-33" title="Reference 2">(2)</a> <a href="#ref-for-dfn-midi-device-34" title="Reference 3">(3)</a> <a href="#ref-for-dfn-midi-device-35" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-midi-input-port" aria-label="Links in this document to definition: MIDI input port"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-midi-input-port" aria-label="Permalink for definition: MIDI input port. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-midi-input-port-1" title="§ 5.1 MIDIInputMap Interface">§ 5.1 MIDIInputMap Interface</a> </li><li> <a href="#ref-for-dfn-midi-input-port-2" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-midi-output-port" aria-label="Links in this document to definition: MIDI output port"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-midi-output-port" aria-label="Permalink for definition: MIDI output port. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-midi-output-port-1" title="§ 5.2 MIDIOutputMap Interface">§ 5.2 MIDIOutputMap Interface</a> </li><li> <a href="#ref-for-dfn-midi-output-port-2" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-midi-interface" aria-label="Links in this document to definition: MIDI interface"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-midi-interface" aria-label="Permalink for definition: MIDI interface. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-midi-interface-1" title="§ 4.3 Extensions to the Navigator interface">§ 4.3 Extensions to the Navigator interface</a> </li><li> <a href="#ref-for-dfn-midi-interface-2" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li><li> <a href="#ref-for-dfn-midi-interface-3" title="§ 6. Privacy Considerations">§ 6. Privacy Considerations</a> <a href="#ref-for-dfn-midi-interface-4" title="Reference 2">(2)</a> <a href="#ref-for-dfn-midi-interface-5" title="Reference 3">(3)</a> <a href="#ref-for-dfn-midi-interface-6" title="Reference 4">(4)</a> <a href="#ref-for-dfn-midi-interface-7" title="Reference 5">(5)</a> <a href="#ref-for-dfn-midi-interface-8" title="Reference 6">(6)</a> <a href="#ref-for-dfn-midi-interface-9" title="Reference 7">(7)</a> <a href="#ref-for-dfn-midi-interface-10" title="Reference 8">(8)</a> </li><li> <a href="#ref-for-dfn-midi-interface-11" title="§ 7.1 Malicious Firmware Updates">§ 7.1 Malicious Firmware Updates</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-midi-message" aria-label="Links in this document to definition: MIDI message"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-midi-message" aria-label="Permalink for definition: MIDI message. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-midi-message-1" title="§ Abstract">§ Abstract</a> <a href="#ref-for-dfn-midi-message-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-midi-message-3" title="§ 1. Introduction">§ 1. Introduction</a> <a href="#ref-for-dfn-midi-message-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-midi-message-5" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li><li> <a href="#ref-for-dfn-midi-message-6" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> <a href="#ref-for-dfn-midi-message-7" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-midi-message-8" title="§ 5.5 MIDIMessageEvent Interface">§ 5.5 MIDIMessageEvent Interface</a> <a href="#ref-for-dfn-midi-message-9" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-midi-message-10" title="§ 5.5.1 MIDIMessageEventInit Dictionary">§ 5.5.1 MIDIMessageEventInit Dictionary</a> </li><li> <a href="#ref-for-dfn-midi-message-11" title="§ 7.1 Malicious Firmware Updates">§ 7.1 Malicious Firmware Updates</a> <a href="#ref-for-dfn-midi-message-12" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-midi-message-13" title="§ 7.2 Additional Security Considerations">§ 7.2 Additional Security Considerations</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-system-real-time" aria-label="Links in this document to definition: System Real Time"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-system-real-time" aria-label="Permalink for definition: System Real Time. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-system-real-time-1" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> <a href="#ref-for-dfn-system-real-time-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-system-exclusive" aria-label="Links in this document to definition: System Exclusive"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-system-exclusive" aria-label="Permalink for definition: System Exclusive. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-system-exclusive-1" title="§ 3. Terminology">§ 3. Terminology</a> <a href="#ref-for-dfn-system-exclusive-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-system-exclusive-3" title="§ 4.3 Extensions to the Navigator interface">§ 4.3 Extensions to the Navigator interface</a> <a href="#ref-for-dfn-system-exclusive-4" title="Reference 2">(2)</a> <a href="#ref-for-dfn-system-exclusive-5" title="Reference 3">(3)</a> <a href="#ref-for-dfn-system-exclusive-6" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-system-exclusive-7" title="§ 4.3.1 MIDIOptions Dictionary">§ 4.3.1 MIDIOptions Dictionary</a> <a href="#ref-for-dfn-system-exclusive-8" title="Reference 2">(2)</a> <a href="#ref-for-dfn-system-exclusive-9" title="Reference 3">(3)</a> <a href="#ref-for-dfn-system-exclusive-10" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-system-exclusive-11" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li><li> <a href="#ref-for-dfn-system-exclusive-12" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> <a href="#ref-for-dfn-system-exclusive-13" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-system-exclusive-14" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> <a href="#ref-for-dfn-system-exclusive-15" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-system-exclusive-16" title="§ 7.1 Malicious Firmware Updates">§ 7.1 Malicious Firmware Updates</a> <a href="#ref-for-dfn-system-exclusive-17" title="Reference 2">(2)</a> <a href="#ref-for-dfn-system-exclusive-18" title="Reference 3">(3)</a> <a href="#ref-for-dfn-system-exclusive-19" title="Reference 4">(4)</a> <a href="#ref-for-dfn-system-exclusive-20" title="Reference 5">(5)</a> <a href="#ref-for-dfn-system-exclusive-21" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dfn-system-exclusive-22" title="§ 7.2 Additional Security Considerations">§ 7.2 Additional Security Considerations</a> <a href="#ref-for-dfn-system-exclusive-23" title="Reference 2">(2)</a> <a href="#ref-for-dfn-system-exclusive-24" title="Reference 3">(3)</a> <a href="#ref-for-dfn-system-exclusive-25" title="Reference 4">(4)</a> <a href="#ref-for-dfn-system-exclusive-26" title="Reference 5">(5)</a> <a href="#ref-for-dfn-system-exclusive-27" title="Reference 6">(6)</a> <a href="#ref-for-dfn-system-exclusive-28" title="Reference 7">(7)</a> <a href="#ref-for-dfn-system-exclusive-29" title="Reference 8">(8)</a> <a href="#ref-for-dfn-system-exclusive-30" title="Reference 9">(9)</a> <a href="#ref-for-dfn-system-exclusive-31" title="Reference 10">(10)</a> <a href="#ref-for-dfn-system-exclusive-32" title="Reference 11">(11)</a> <a href="#ref-for-dfn-system-exclusive-33" title="Reference 12">(12)</a> <a href="#ref-for-dfn-system-exclusive-34" title="Reference 13">(13)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-valid-midi-message" aria-label="Links in this document to definition: Valid MIDI message"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-valid-midi-message" aria-label="Permalink for definition: Valid MIDI message. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-valid-midi-message-1" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> <a href="#ref-for-dfn-valid-midi-message-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midipermissiondescriptor" aria-label="Links in this document to definition: MidiPermissionDescriptor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midipermissiondescriptor" aria-label="Permalink for definition: MidiPermissionDescriptor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midipermissiondescriptor-sysex" aria-label="Links in this document to definition: sysex"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midipermissiondescriptor-sysex" aria-label="Permalink for definition: sysex. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-midi-0" aria-label="Links in this document to definition: &quot;midi&quot;"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-midi-0" aria-label="Permalink for definition: &quot;midi&quot;. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-midi-0-1" title="§ 4.1 Permissions Integration">§ 4.1 Permissions Integration</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-navigator" aria-label="Links in this document to definition: Navigator"> <span class="caret"></span> <div> <a class="self-link" href="#dom-navigator" aria-label="Permalink for definition: Navigator. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-navigator-1" title="§ 4.3 Extensions to the Navigator interface">§ 4.3 Extensions to the Navigator interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-navigator-requestmidiaccess" aria-label="Links in this document to definition: requestMIDIAccess()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-navigator-requestmidiaccess" aria-label="Permalink for definition: requestMIDIAccess(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1402413408">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-navigator-requestmidiaccess-1" title="§ 4.3 Extensions to the Navigator interface">§ 4.3 Extensions to the Navigator interface</a> <a href="#ref-for-dom-navigator-requestmidiaccess-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-navigator-requestmidiaccess-3" title="§ 4.3.1 MIDIOptions Dictionary">§ 4.3.1 MIDIOptions Dictionary</a> <a href="#ref-for-dom-navigator-requestmidiaccess-4" title="Reference 2">(2)</a> <a href="#ref-for-dom-navigator-requestmidiaccess-5" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-navigator-requestmidiaccess-6" title="§ 7.1 Malicious Firmware Updates">§ 7.1 Malicious Firmware Updates</a> </li><li> <a href="#ref-for-dom-navigator-requestmidiaccess-7" title="§ 7.2 Additional Security Considerations">§ 7.2 Additional Security Considerations</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midioptions" aria-label="Links in this document to definition: MIDIOptions"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midioptions" aria-label="Permalink for definition: MIDIOptions. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1327204285">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midioptions-1" title="§ 4.3 Extensions to the Navigator interface">§ 4.3 Extensions to the Navigator interface</a> </li><li> <a href="#ref-for-dom-midioptions-2" title="§ 4.3.1 MIDIOptions Dictionary">§ 4.3.1 MIDIOptions Dictionary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midioptions-sysex" aria-label="Links in this document to definition: sysex"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midioptions-sysex" aria-label="Permalink for definition: sysex. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1327204285">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midioptions-sysex-1" title="§ 4.3.1 MIDIOptions Dictionary">§ 4.3.1 MIDIOptions Dictionary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midioptions-software" aria-label="Links in this document to definition: software"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midioptions-software" aria-label="Permalink for definition: software. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1327204285">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midioptions-software-1" title="§ 4.3.1 MIDIOptions Dictionary">§ 4.3.1 MIDIOptions Dictionary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiinputmap" aria-label="Links in this document to definition: MIDIInputMap"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiinputmap" aria-label="Permalink for definition: MIDIInputMap. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-250474479">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiinputmap-1" title="§ 5.1 MIDIInputMap Interface">§ 5.1 MIDIInputMap Interface</a> <a href="#ref-for-dom-midiinputmap-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midiinputmap-3" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midioutputmap" aria-label="Links in this document to definition: MIDIOutputMap"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midioutputmap" aria-label="Permalink for definition: MIDIOutputMap. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-127537081">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midioutputmap-1" title="§ 5.2 MIDIOutputMap Interface">§ 5.2 MIDIOutputMap Interface</a> <a href="#ref-for-dom-midioutputmap-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midioutputmap-3" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiaccess" aria-label="Links in this document to definition: MIDIAccess"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiaccess" aria-label="Permalink for definition: MIDIAccess. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-769829994">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiaccess-1" title="§ 4.3 Extensions to the Navigator interface">§ 4.3 Extensions to the Navigator interface</a> <a href="#ref-for-dom-midiaccess-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiaccess-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-midiaccess-4" title="§ 4.3.1 MIDIOptions Dictionary">§ 4.3.1 MIDIOptions Dictionary</a> <a href="#ref-for-dom-midiaccess-5" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiaccess-6" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-midiaccess-7" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> <a href="#ref-for-dom-midiaccess-8" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiaccess-9" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiaccess-10" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-midiaccess-11" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiaccess-12" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiaccess-13" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiaccess-14" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-midiaccess-15" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> <a href="#ref-for-dom-midiaccess-16" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midiaccess-17" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> </li><li> <a href="#ref-for-dom-midiaccess-18" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiaccess-inputs" aria-label="Links in this document to definition: inputs"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiaccess-inputs" aria-label="Permalink for definition: inputs. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-769829994">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiaccess-inputs-1" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiaccess-outputs" aria-label="Links in this document to definition: outputs"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiaccess-outputs" aria-label="Permalink for definition: outputs. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-769829994">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiaccess-outputs-1" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiaccess-onstatechange" aria-label="Links in this document to definition: onstatechange"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiaccess-onstatechange" aria-label="Permalink for definition: onstatechange. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-769829994">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiaccess-onstatechange-1" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> <a href="#ref-for-dom-midiaccess-onstatechange-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midiaccess-onstatechange-3" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiaccess-onstatechange-4" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiaccess-onstatechange-5" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiaccess-onstatechange-6" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-midiaccess-onstatechange-7" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> <a href="#ref-for-dom-midiaccess-onstatechange-8" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiaccess-onstatechange-9" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiaccess-sysexenabled" aria-label="Links in this document to definition: sysexEnabled"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiaccess-sysexenabled" aria-label="Permalink for definition: sysexEnabled. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-769829994">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiaccess-sysexenabled-1" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport" aria-label="Links in this document to definition: MIDIPort"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport" aria-label="Permalink for definition: MIDIPort. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-1" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li><li> <a href="#ref-for-dom-midiport-2" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiport-3" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiport-4" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiport-5" title="Reference 4">(4)</a> <a href="#ref-for-dom-midiport-6" title="Reference 5">(5)</a> <a href="#ref-for-dom-midiport-7" title="Reference 6">(6)</a> <a href="#ref-for-dom-midiport-8" title="Reference 7">(7)</a> <a href="#ref-for-dom-midiport-9" title="Reference 8">(8)</a> <a href="#ref-for-dom-midiport-10" title="Reference 9">(9)</a> <a href="#ref-for-dom-midiport-11" title="Reference 10">(10)</a> <a href="#ref-for-dom-midiport-12" title="Reference 11">(11)</a> <a href="#ref-for-dom-midiport-13" title="Reference 12">(12)</a> <a href="#ref-for-dom-midiport-14" title="Reference 13">(13)</a> <a href="#ref-for-dom-midiport-15" title="Reference 14">(14)</a> <a href="#ref-for-dom-midiport-16" title="Reference 15">(15)</a> <a href="#ref-for-dom-midiport-17" title="Reference 16">(16)</a> <a href="#ref-for-dom-midiport-18" title="Reference 17">(17)</a> <a href="#ref-for-dom-midiport-19" title="Reference 18">(18)</a> <a href="#ref-for-dom-midiport-20" title="Reference 19">(19)</a> </li><li> <a href="#ref-for-dom-midiport-21" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> </li><li> <a href="#ref-for-dom-midiport-22" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> </li><li> <a href="#ref-for-dom-midiport-23" title="§ 5.4.3 MIDIPortType Enum">§ 5.4.3 MIDIPortType Enum</a> <a href="#ref-for-dom-midiport-24" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midiport-25" title="§ 5.4.4 MIDIPortDeviceState Enum">§ 5.4.4 MIDIPortDeviceState Enum</a> <a href="#ref-for-dom-midiport-26" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midiport-27" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> <a href="#ref-for-dom-midiport-28" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiport-29" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiport-30" title="Reference 4">(4)</a> <a href="#ref-for-dom-midiport-31" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-midiport-32" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> <a href="#ref-for-dom-midiport-33" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiport-34" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-midiport-35" title="§ 5.6.1 MIDIConnectionEventInit Dictionary">§ 5.6.1 MIDIConnectionEventInit Dictionary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-id" aria-label="Links in this document to definition: id"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-id" aria-label="Permalink for definition: id. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-id-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiport-id-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-manufacturer" aria-label="Links in this document to definition: manufacturer"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-manufacturer" aria-label="Permalink for definition: manufacturer. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-manufacturer-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-name" aria-label="Links in this document to definition: name"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-name" aria-label="Permalink for definition: name. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-name-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-type" aria-label="Links in this document to definition: type"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-type" aria-label="Permalink for definition: type. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-type-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-version" aria-label="Links in this document to definition: version"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-version" aria-label="Permalink for definition: version. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-version-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-state" aria-label="Links in this document to definition: state"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-state" aria-label="Permalink for definition: state. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-state-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiport-state-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-connection" aria-label="Links in this document to definition: connection"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-connection" aria-label="Permalink for definition: connection. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-connection-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiport-connection-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiport-connection-3" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiport-connection-4" title="Reference 4">(4)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-onstatechange" aria-label="Links in this document to definition: onstatechange"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-onstatechange" aria-label="Permalink for definition: onstatechange. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-onstatechange-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiport-onstatechange-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiport-onstatechange-3" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiport-onstatechange-4" title="Reference 4">(4)</a> <a href="#ref-for-dom-midiport-onstatechange-5" title="Reference 5">(5)</a> <a href="#ref-for-dom-midiport-onstatechange-6" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dom-midiport-onstatechange-7" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> </li><li> <a href="#ref-for-dom-midiport-onstatechange-8" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-open" aria-label="Links in this document to definition: open"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-open" aria-label="Permalink for definition: open. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-open-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li><li> <a href="#ref-for-dom-midiport-open-2" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> <a href="#ref-for-dom-midiport-open-3" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-open-the-port" aria-label="Links in this document to definition: algorithm to open a MIDIPort"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-open-the-port" aria-label="Permalink for definition: algorithm to open a MIDIPort. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-open-the-port-1" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> </li><li> <a href="#ref-for-dfn-open-the-port-2" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> </li><li> <a href="#ref-for-dfn-open-the-port-3" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiport-close" aria-label="Links in this document to definition: close"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiport-close" aria-label="Permalink for definition: close. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2102775472">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiport-close-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiport-close-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiinput" aria-label="Links in this document to definition: MIDIInput"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiinput" aria-label="Permalink for definition: MIDIInput. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-373232923">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiinput-1" title="§ 5.1 MIDIInputMap Interface">§ 5.1 MIDIInputMap Interface</a> <a href="#ref-for-dom-midiinput-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midiinput-3" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiinput-4" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiinput-5" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-midiinput-6" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> <a href="#ref-for-dom-midiinput-7" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiinput-8" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiinput-9" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-midiinput-10" title="§ 5.5 MIDIMessageEvent Interface">§ 5.5 MIDIMessageEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiinput-onmidimessage" aria-label="Links in this document to definition: onmidimessage"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiinput-onmidimessage" aria-label="Permalink for definition: onmidimessage. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-373232923">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiinput-onmidimessage-1" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> </li><li> <a href="#ref-for-dom-midiinput-onmidimessage-2" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midioutput" aria-label="Links in this document to definition: MIDIOutput"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midioutput" aria-label="Permalink for definition: MIDIOutput. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1392954274">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midioutput-1" title="§ 5.2 MIDIOutputMap Interface">§ 5.2 MIDIOutputMap Interface</a> <a href="#ref-for-dom-midioutput-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midioutput-3" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midioutput-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midioutput-5" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> <a href="#ref-for-dom-midioutput-6" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midioutput-7" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midioutput-send" aria-label="Links in this document to definition: send"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midioutput-send" aria-label="Permalink for definition: send. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1392954274">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midioutput-send-1" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> </li><li> <a href="#ref-for-dom-midioutput-send-2" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midioutput-clear" aria-label="Links in this document to definition: clear"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midioutput-clear" aria-label="Permalink for definition: clear. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1392954274">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midioutput-clear-1" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiporttype" aria-label="Links in this document to definition: MIDIPortType"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiporttype" aria-label="Permalink for definition: MIDIPortType. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1197514421">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiporttype-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li><li> <a href="#ref-for-dom-midiporttype-2" title="§ 5.4.3 MIDIPortType Enum">§ 5.4.3 MIDIPortType Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiporttype-input" aria-label="Links in this document to definition: input"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiporttype-input" aria-label="Permalink for definition: input. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1197514421">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiporttype-input-1" title="§ 5.4.3 MIDIPortType Enum">§ 5.4.3 MIDIPortType Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiporttype-output" aria-label="Links in this document to definition: output"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiporttype-output" aria-label="Permalink for definition: output. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1197514421">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiporttype-output-1" title="§ 5.4.3 MIDIPortType Enum">§ 5.4.3 MIDIPortType Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiportdevicestate" aria-label="Links in this document to definition: MIDIPortDeviceState"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiportdevicestate" aria-label="Permalink for definition: MIDIPortDeviceState. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-920861751">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiportdevicestate-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li><li> <a href="#ref-for-dom-midiportdevicestate-2" title="§ 5.4.4 MIDIPortDeviceState Enum">§ 5.4.4 MIDIPortDeviceState Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiportdevicestate-disconnected" aria-label="Links in this document to definition: disconnected"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiportdevicestate-disconnected" aria-label="Permalink for definition: disconnected. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-920861751">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiportdevicestate-disconnected-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiportdevicestate-disconnected-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midiportdevicestate-disconnected-3" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> </li><li> <a href="#ref-for-dom-midiportdevicestate-disconnected-4" title="§ 5.4.4 MIDIPortDeviceState Enum">§ 5.4.4 MIDIPortDeviceState Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiportdevicestate-connected" aria-label="Links in this document to definition: connected"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiportdevicestate-connected" aria-label="Permalink for definition: connected. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-920861751">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiportdevicestate-connected-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiportdevicestate-connected-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiportdevicestate-connected-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-midiportdevicestate-connected-4" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> </li><li> <a href="#ref-for-dom-midiportdevicestate-connected-5" title="§ 5.4.4 MIDIPortDeviceState Enum">§ 5.4.4 MIDIPortDeviceState Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiportconnectionstate" aria-label="Links in this document to definition: MIDIPortConnectionState"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiportconnectionstate" aria-label="Permalink for definition: MIDIPortConnectionState. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1389110906">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiportconnectionstate-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li><li> <a href="#ref-for-dom-midiportconnectionstate-2" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiportconnectionstate-open" aria-label="Links in this document to definition: open"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiportconnectionstate-open" aria-label="Permalink for definition: open. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1389110906">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiportconnectionstate-open-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li><li> <a href="#ref-for-dom-midiportconnectionstate-open-2" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> <a href="#ref-for-dom-midiportconnectionstate-open-3" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiportconnectionstate-closed" aria-label="Links in this document to definition: closed"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiportconnectionstate-closed" aria-label="Permalink for definition: closed. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1389110906">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiportconnectionstate-closed-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li><li> <a href="#ref-for-dom-midiportconnectionstate-closed-2" title="§ 5.4.2 MIDIOutput Interface">§ 5.4.2 MIDIOutput Interface</a> </li><li> <a href="#ref-for-dom-midiportconnectionstate-closed-3" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiportconnectionstate-pending" aria-label="Links in this document to definition: pending"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiportconnectionstate-pending" aria-label="Permalink for definition: pending. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1389110906">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiportconnectionstate-pending-1" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiportconnectionstate-pending-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiportconnectionstate-pending-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-midiportconnectionstate-pending-4" title="§ 5.4.5 MIDIPortConnectionState Enum">§ 5.4.5 MIDIPortConnectionState Enum</a> </li><li> <a href="#ref-for-dom-midiportconnectionstate-pending-5" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midimessageevent" aria-label="Links in this document to definition: MIDIMessageEvent"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midimessageevent" aria-label="Permalink for definition: MIDIMessageEvent. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1283774063">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midimessageevent-1" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> </li><li> <a href="#ref-for-dom-midimessageevent-2" title="§ 5.5 MIDIMessageEvent Interface">§ 5.5 MIDIMessageEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midimessageevent-constructor" aria-label="Links in this document to definition: constructor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midimessageevent-constructor" aria-label="Permalink for definition: constructor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midimessageevent-data" aria-label="Links in this document to definition: data"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midimessageevent-data" aria-label="Permalink for definition: data. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1283774063">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midimessageevent-data-1" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> </li><li> <a href="#ref-for-dom-midimessageevent-data-2" title="§ 5.5 MIDIMessageEvent Interface">§ 5.5 MIDIMessageEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midimessageeventinit" aria-label="Links in this document to definition: MIDIMessageEventInit"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midimessageeventinit" aria-label="Permalink for definition: MIDIMessageEventInit. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1056778819">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midimessageeventinit-1" title="§ 5.5 MIDIMessageEvent Interface">§ 5.5 MIDIMessageEvent Interface</a> </li><li> <a href="#ref-for-dom-midimessageeventinit-2" title="§ 5.5.1 MIDIMessageEventInit Dictionary">§ 5.5.1 MIDIMessageEventInit Dictionary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midimessageeventinit-data" aria-label="Links in this document to definition: data"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midimessageeventinit-data" aria-label="Permalink for definition: data. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1056778819">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midimessageeventinit-data-1" title="§ 5.5.1 MIDIMessageEventInit Dictionary">§ 5.5.1 MIDIMessageEventInit Dictionary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiconnectionevent" aria-label="Links in this document to definition: MIDIConnectionEvent"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiconnectionevent" aria-label="Permalink for definition: MIDIConnectionEvent. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-960759427">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiconnectionevent-1" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> <a href="#ref-for-dom-midiconnectionevent-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-midiconnectionevent-3" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> <a href="#ref-for-dom-midiconnectionevent-4" title="Reference 2">(2)</a> <a href="#ref-for-dom-midiconnectionevent-5" title="Reference 3">(3)</a> <a href="#ref-for-dom-midiconnectionevent-6" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-midiconnectionevent-7" title="§ 5.4.1 MIDIInput Interface">§ 5.4.1 MIDIInput Interface</a> </li><li> <a href="#ref-for-dom-midiconnectionevent-8" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiconnectionevent-constructor" aria-label="Links in this document to definition: constructor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiconnectionevent-constructor" aria-label="Permalink for definition: constructor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiconnectionevent-port" aria-label="Links in this document to definition: port"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiconnectionevent-port" aria-label="Permalink for definition: port. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-960759427">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiconnectionevent-port-1" title="§ 5.3 MIDIAccess Interface">§ 5.3 MIDIAccess Interface</a> </li><li> <a href="#ref-for-dom-midiconnectionevent-port-2" title="§ 5.4 MIDIPort Interface">§ 5.4 MIDIPort Interface</a> </li><li> <a href="#ref-for-dom-midiconnectionevent-port-3" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiconnectioneventinit" aria-label="Links in this document to definition: MIDIConnectionEventInit"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiconnectioneventinit" aria-label="Permalink for definition: MIDIConnectionEventInit. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-825586432">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiconnectioneventinit-1" title="§ 5.6 MIDIConnectionEvent Interface">§ 5.6 MIDIConnectionEvent Interface</a> </li><li> <a href="#ref-for-dom-midiconnectioneventinit-2" title="§ 5.6.1 MIDIConnectionEventInit Dictionary">§ 5.6.1 MIDIConnectionEventInit Dictionary</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-midiconnectioneventinit-port" aria-label="Links in this document to definition: port"> <span class="caret"></span> <div> <a class="self-link" href="#dom-midiconnectioneventinit-port" aria-label="Permalink for definition: port. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-825586432">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-midiconnectioneventinit-port-1" title="§ 5.6.1 MIDIConnectionEventInit Dictionary">§ 5.6.1 MIDIConnectionEventInit Dictionary</a> </li> </ul> </div><script id="respec-dfn-panel">(() => { // @ts-check if (document.respec) { document.respec.ready.then(setupPanel); } else { setupPanel(); } function setupPanel() { const listener = panelListener(); document.body.addEventListener("keydown", listener); document.body.addEventListener("click", listener); } function panelListener() { /** @type {HTMLElement} */ let panel = null; return event => { const { target, type } = event; if (!(target instanceof HTMLElement)) return; // For keys, we only care about Enter key to activate the panel // otherwise it's activated via a click. if (type === "keydown" && event.key !== "Enter") return; const action = deriveAction(event); switch (action) { case "show": { hidePanel(panel); /** @type {HTMLElement} */ const dfn = target.closest("dfn, .index-term"); panel = document.getElementById(`dfn-panel-for-${dfn.id}`); const coords = deriveCoordinates(event); displayPanel(dfn, panel, coords); break; } case "dock": { panel.style.left = null; panel.style.top = null; panel.classList.add("docked"); break; } case "hide": { hidePanel(panel); panel = null; break; } } }; } /** * @param {MouseEvent|KeyboardEvent} event */ function deriveCoordinates(event) { const target = /** @type HTMLElement */ (event.target); // We prevent synthetic AT clicks from putting // the dialog in a weird place. The AT events sometimes // lack coordinates, so they have clientX/Y = 0 const rect = target.getBoundingClientRect(); if ( event instanceof MouseEvent && event.clientX >= rect.left && event.clientY >= rect.top ) { // The event probably happened inside the bounding rect... return { x: event.clientX, y: event.clientY }; } // Offset to the middle of the element const x = rect.x + rect.width / 2; // Placed at the bottom of the element const y = rect.y + rect.height; return { x, y }; } /** * @param {Event} event */ function deriveAction(event) { const target = /** @type {HTMLElement} */ (event.target); const hitALink = !!target.closest("a"); if (target.closest("dfn:not([data-cite]), .index-term")) { return hitALink ? "none" : "show"; } if (target.closest(".dfn-panel")) { if (hitALink) { return target.classList.contains("self-link") ? "hide" : "dock"; } const panel = target.closest(".dfn-panel"); return panel.classList.contains("docked") ? "hide" : "none"; } if (document.querySelector(".dfn-panel:not([hidden])")) { return "hide"; } return "none"; } /** * @param {HTMLElement} dfn * @param {HTMLElement} panel * @param {{ x: number, y: number }} clickPosition */ function displayPanel(dfn, panel, { x, y }) { panel.hidden = false; // distance (px) between edge of panel and the pointing triangle (caret) const MARGIN = 20; const dfnRects = dfn.getClientRects(); // Find the `top` offset when the `dfn` can be spread across multiple lines let closestTop = 0; let minDiff = Infinity; for (const rect of dfnRects) { const { top, bottom } = rect; const diffFromClickY = Math.abs((top + bottom) / 2 - y); if (diffFromClickY < minDiff) { minDiff = diffFromClickY; closestTop = top; } } const top = window.scrollY + closestTop + dfnRects[0].height; const left = x - MARGIN; panel.style.left = `${left}px`; panel.style.top = `${top}px`; // Find if the panel is flowing out of the window const panelRect = panel.getBoundingClientRect(); const SCREEN_WIDTH = Math.min(window.innerWidth, window.screen.width); if (panelRect.right > SCREEN_WIDTH) { const newLeft = Math.max(MARGIN, x + MARGIN - panelRect.width); const newCaretOffset = left - newLeft; panel.style.left = `${newLeft}px`; /** @type {HTMLElement} */ const caret = panel.querySelector(".caret"); caret.style.left = `${newCaretOffset}px`; } // As it's a dialog, we trap focus. // TODO: when <dialog> becomes a implemented, we should really // use that. trapFocus(panel, dfn); } /** * @param {HTMLElement} panel * @param {HTMLElement} dfn * @returns */ function trapFocus(panel, dfn) { /** @type NodeListOf<HTMLAnchorElement> elements */ const anchors = panel.querySelectorAll("a[href]"); // No need to trap focus if (!anchors.length) return; // Move focus to first anchor element const first = anchors.item(0); first.focus(); const trapListener = createTrapListener(anchors, panel, dfn); panel.addEventListener("keydown", trapListener); // Hiding the panel releases the trap const mo = new MutationObserver(records => { const [record] = records; const target = /** @type HTMLElement */ (record.target); if (target.hidden) { panel.removeEventListener("keydown", trapListener); mo.disconnect(); } }); mo.observe(panel, { attributes: true, attributeFilter: ["hidden"] }); } /** * * @param {NodeListOf<HTMLAnchorElement>} anchors * @param {HTMLElement} panel * @param {HTMLElement} dfn * @returns */ function createTrapListener(anchors, panel, dfn) { const lastIndex = anchors.length - 1; let currentIndex = 0; return event => { switch (event.key) { // Hitting "Tab" traps us in a nice loop around elements. case "Tab": { event.preventDefault(); currentIndex += event.shiftKey ? -1 : +1; if (currentIndex < 0) { currentIndex = lastIndex; } else if (currentIndex > lastIndex) { currentIndex = 0; } anchors.item(currentIndex).focus(); break; } // Hitting "Enter" on an anchor releases the trap. case "Enter": hidePanel(panel); break; // Hitting "Escape" returns focus to dfn. case "Escape": hidePanel(panel); dfn.focus(); return; } }; } /** @param {HTMLElement} panel */ function hidePanel(panel) { if (!panel) return; panel.hidden = true; panel.classList.remove("docked"); } })()</script><script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10