{"action":"created","issue":{"url":"https://api.github.com/repos/atom/electron/issues/2821","labels_url":"https://api.github.com/repos/atom/electron/issues/2821/labels{/name}","comments_url":"https://api.github.com/repos/atom/electron/issues/2821/comments","events_url":"https://api.github.com/repos/atom/electron/issues/2821/events","html_url":"https://github.com/atom/electron/issues/2821","id":106977035,"number":2821,"title":"MIDI access cannot be init first time unless reload","user":{"login":"wildfiremedia","id":6618755,"avatar_url":"https://avatars.githubusercontent.com/u/6618755?v=3","gravatar_id":"","url":"https://api.github.com/users/wildfiremedia","html_url":"https://github.com/wildfiremedia","followers_url":"https://api.github.com/users/wildfiremedia/followers","following_url":"https://api.github.com/users/wildfiremedia/following{/other_user}","gists_url":"https://api.github.com/users/wildfiremedia/gists{/gist_id}","starred_url":"https://api.github.com/users/wildfiremedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildfiremedia/subscriptions","organizations_url":"https://api.github.com/users/wildfiremedia/orgs","repos_url":"https://api.github.com/users/wildfiremedia/repos","events_url":"https://api.github.com/users/wildfiremedia/events{/privacy}","received_events_url":"https://api.github.com/users/wildfiremedia/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-17T12:52:02Z","updated_at":"2015-09-26T15:07:43Z","closed_at":"2015-09-21T08:18:24Z","body":"Critical fix need for this issue on Windows, tested on 8/8.1 that can't properly initial midi port the first time Electron is run, it could only properly initialize after reload the page using remote.getCurrentWindow().reload()\r\n\r\nAll of these error have been tested exhaustively and conclude it's a bug.\r\n\r\n```\r\nvar midi = null;  // global MIDIAccess object\r\nvar output = null;\r\n\r\nfunction echoMIDIMessage( event ) {\r\n  if (output) {\r\n    output.send( event.data, event.timestamp );\r\n  }\r\n}\r\n\r\nfunction onMIDISuccess( midiAccess ) {\r\n  console.log( \"MIDI ready!\" );\r\n//  var input = midiAccess.inputs.entries.next();\r\n // if (input)\r\n //   input.onmidimessage = echoMIDIMessage;\r\n  output = midiAccess.outputs.values().next().value;\r\n  if (!output)\r\n    console.log(\"Uh oh! Couldn't get i/o ports.\");\r\n}\r\n\r\nfunction onMIDIFailure(msg) {\r\n  console.log( \"Failed to get MIDI access - \" + msg );\r\n}\r\n\r\nnavigator.requestMIDIAccess().then( onMIDISuccess, onMIDIFailure );\r\n```"},"comment":{"url":"https://api.github.com/repos/atom/electron/issues/comments/143461972","html_url":"https://github.com/atom/electron/issues/2821#issuecomment-143461972","issue_url":"https://api.github.com/repos/atom/electron/issues/2821","id":143461972,"user":{"login":"proyb2","id":1485317,"avatar_url":"https://avatars.githubusercontent.com/u/1485317?v=3","gravatar_id":"","url":"https://api.github.com/users/proyb2","html_url":"https://github.com/proyb2","followers_url":"https://api.github.com/users/proyb2/followers","following_url":"https://api.github.com/users/proyb2/following{/other_user}","gists_url":"https://api.github.com/users/proyb2/gists{/gist_id}","starred_url":"https://api.github.com/users/proyb2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/proyb2/subscriptions","organizations_url":"https://api.github.com/users/proyb2/orgs","repos_url":"https://api.github.com/users/proyb2/repos","events_url":"https://api.github.com/users/proyb2/events{/privacy}","received_events_url":"https://api.github.com/users/proyb2/received_events","type":"User","site_admin":false},"created_at":"2015-09-26T15:07:43Z","updated_at":"2015-09-26T15:07:43Z","body":"Updated Electron with Nodejs 4.1.1 works now."}}