Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] (web midi) window.navigator.requestMidiAccess() returns null #20082

Closed
DartBot opened this issue Jul 17, 2014 · 8 comments
Closed

[next] (web midi) window.navigator.requestMidiAccess() returns null #20082

DartBot opened this issue Jul 17, 2014 · 8 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. library-html P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-libraries Issues impacting dart:html, etc., libraries

Comments

@DartBot
Copy link

DartBot commented Jul 17, 2014

This issue was originally filed by dorbo...@gmail.com


What steps will reproduce the problem?

  1. Use Dartium Version 36.0.1985.97 (282401), Dart SDK version 1.6.0-dev.3.0

  2. Enable browser switch --enable-web-midi

  3. Try and run the following code in dartium


import 'dart:html';
void main() {

   window.navigator.requestMidiAccess().then( (a,b) => print("access"), (c) => print("error"));
}


What is the expected output?
The console should display either "access" or "error" text messages

What do you see instead?


Exception: The null object does not have a method 'then'.

NoSuchMethodError: method not found: 'then'
Receiver: null
Arguments: [Closure: (dynamic, dynamic) => dynamic, Closure: (dynamic) => dynamic]


What version of the product are you using?
1.6.0-dev.3.0

On what operating system?
Win7

What browser (if applicable)?
NA

Please provide any additional information below.

I'm able to use navigator.requestMidiAccess() successfully in javascript on the same dartium browser... so I know Midi works with this dartium browser.

I'm was tring to port http://webaudiodemos.appspot.com/monosynth/index.html
from javascript to dart. A similar example from the Dart Team would be really helpful.

@sethladd
Copy link
Contributor

Removed Priority-Unassigned label.
Added Priority-Medium, Library-Html, Area-Library, Triaged labels.

@anders-sandholm
Copy link
Contributor

Issue #21805 has been merged into this issue.

@anders-sandholm
Copy link
Contributor

This issue came up again on misc (https://groups.google.com/a/dartlang.org/forum/#!topic/misc/FuLyWDlPoYc) and as a duplicate in issue #21805.

As rms notes a workaround exists:
    final js.JsObject w = new js.JsObject.fromBrowserObject(html.window);
    final js.JsObject n = w['navigator'];
    if (n.hasProperty('requestMIDIAccess')) {
      n.callMethod('requestMIDIAccess').callMethod('then',
          [(js.JsObject midiAccess) {
        // ...
      }]);
    }

But this seems like a giant hack.

Let's see if we can fix this?

@alan-knight
Copy link
Contributor

Hoping this will get fixed with Terry's work on the next rev of html.


Changed the title to: "[next](web midi) window.navigator.requestMidiAccess() returns null".

@DartBot DartBot added Type-Defect library-html area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Jan 13, 2015
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Mar 1, 2016
@DanTup
Copy link
Collaborator

DanTup commented Jan 17, 2018

It's been three years since the comment above - my guess is that this didn't get fixed? (Still seems broken in current DartPad).

I might be interested in using this soon, is it something an outsider might be able to fix? Could anyone point me in the right direction to look?

@matanlurey matanlurey added closed-obsolete Closed as the reported issue is no longer relevant and removed closed-obsolete Closed as the reported issue is no longer relevant labels Jun 19, 2018
@vsmenon vsmenon added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Jul 20, 2019
@xow xow mentioned this issue Aug 11, 2021
13 tasks
@sigmundch sigmundch added the web-libraries Issues impacting dart:html, etc., libraries label Oct 25, 2021
@maks
Copy link

maks commented Jan 2, 2022

I know this is the older issue, but should it be closed in favour of #33248 which seems to be more active and has more up to date?

@maks
Copy link

maks commented Feb 8, 2022

@DanTup not sure if you are still interested in this topic, but I think I've finally tracked down what it takes to get Webmidi working with Dart (guess after almost 8 years, better late than never? 🙂 ) in my latest comment over on #33248 #33248 (comment)

But in debugging this I also found that DartPad seems to set a http policy header that also prevents use of Webmidi with Dartpad as I note your comment mentioned that you saw it not working there.

@DanTup
Copy link
Collaborator

DanTup commented Feb 8, 2022

@maks ah, interesting! I might be interested in this again in the future, but right now my drum kit (which this was a project for) is boxed up in the garage due to lack of space, so not likely something I'll look at in the near-term.

I think you're right that this is a dupe of #33248 though, so I'll subscribe there and close this one. Thanks!

@DanTup DanTup closed this as completed Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. library-html P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

10 participants