W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

Re: Web MIDI polyfill

From: Chris Wilson <cwilso@google.com>
Date: Wed, 12 Dec 2012 12:51:21 -0800
Message-ID: <CAJK2wqUddOiXXe6k_8CMzR=qOs6EQ0s_mQEoyRMQWZ9+7We11A@mail.gmail.com>
To: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>
Cc: "public-audio@w3.org" <public-audio@w3.org>
I do plan to keep the polyfill up to date with the spec, and you can
actually host the polyfill directly from Github now - see
http://cwilso.github.com/WebMIDIAPIShim/.  It may break applications in
that case, but frankly - I'm totally okay with that.  I really, really do
not want to get in a long-term "prefix" issue.  Once the spec is in LC (and
beyond), obviously, this should be less of a problem.

In short - if you code to the spec prior to LC, you're responsible for
keeping your code up to date when the spec changes (and I'll keep the
polyfill up to date).  If you take a drop of the code, you're on your own.
 Obviously, I'm fine if someone wants to fork this code and make
jazz-prefixed (and therefore more durable) - but that's not really the
point of what I'm trying to do.


On Tue, Dec 11, 2012 at 11:08 AM, Jussi Kalliokoski <
jussi.kalliokoski@gmail.com> wrote:

> Hehey, Chris!
>
> Nice work! I'll try to make a demo for it as soon as I have some time!
>
> A word (or two) about forward-polyfills though: You should have a prefix
> for it (navigator.jazzGetMIDIAccess?) and not care whether there's a native
> implementation around, that way it's not future-hostile. If future breaking
> changes are made to the API and implementations are made accordingly, the
> sites using the polyfill will possibly break in the user agents that are
> implementing the spec correctly. While it's unlikely that we'll introduce
> any breaking changes, it's possible as we're not even at LC yet, and it's a
> good practice with forward-polyfills to keep up anyway. :)
>
> Cheers,
> Jussi
>
> On Tue, Dec 11, 2012 at 3:13 AM, Chris Wilson <cwilso@google.com> wrote:
>
>> I just wanted to let the group know that I've now also updated my Web
>> MIDI API polyfill (https://github.com/cwilso/WebMIDIAPIShim), which
>> builds on top of the Jazz-soft.net NPAPI plugin to add Web MIDI API support
>> on OSX and Windows (if you install the Jazz plugin v1.2 or later).
>>
>> The polyfill uses the current syntax of the API in the specification; I
>> also added multiple simultaneous I/O support (the polyfill could previously
>> only support one input and one output at a time), sending and receiving
>> long messages (system exclusive), support for timestamps (on send and
>> receive), albeit of course with only setTimeout-level precision (it is a
>> JavaScript polyfill, after all), and (I think) proper event dispatching
>> (i.e. you can use addEventListener as well as onmessage).
>>
>> In short - you should be able to include this polyfill in a project, and
>> it will add Web MIDI support to your browser.  (Caveat: have not thoroughly
>> tested the cross-browser implementation; I know CustomEvent is not there on
>> IE<10, which would be an issue.)
>>
>> Happy to take further suggestions.
>>
>> -Chris
>>
>
>
Received on Wednesday, 12 December 2012 20:51:50 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:04 UTC