Closed Bug 1030363 Opened 11 years ago Closed 11 years ago

Create Sound.jsm for Android

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mcomella, Assigned: mcomella)

References

Details

Attachments

(1 file, 1 obsolete file)

And look how this might tie into the pre-existing nsISound interface [1]. [1]: https://mxr.mozilla.org/mozilla-central/source/widget/nsISound.idl
Attached patch (WIP) Add Sound.jsm for Fennec. (obsolete) — Splinter Review
This patch creates an abstraction layer to load and play Sounds using webaudio. An add-on using the module can be found at: https://github.com/mcomella/sound-jsm-test/tree/v1
Comment on attachment 8452777 [details] [diff] [review] (WIP) Add Sound.jsm for Fennec. Looks pretty good. I'm not sure how Promises would improve the API. Might be worth a look. Rename: loadFile -> loadURI
Attachment #8452777 - Flags: feedback?(mark.finkle) → feedback+
This version fixes an issue where the module would only work if the addon was installed with the browser already fully loaded by using lazy context getters. This has a side effect of making the first play of most sound effects not playing, which can be fixed with an observer. I thought this complicated the code a bit too much, so I opted to leave it out for this version.
Attachment #8456543 - Flags: feedback?(mark.finkle)
Comment on attachment 8456543 [details] [diff] [review] Add Sound.jsm for Fennec Sound.jsm looks good. I don't know where we want to put it yet though. Let's talk to Margaret (or someone) about creating a mozilla/addons (or similar) on github where we can add cool helper modules like this one.
Attachment #8456543 - Flags: feedback?(mark.finkle) → feedback+
Flags: needinfo?(margaret.leibovic)
(In reply to Mark Finkle (:mfinkle) from comment #4) > Comment on attachment 8456543 [details] [diff] [review] > Add Sound.jsm for Fennec > > Sound.jsm looks good. I don't know where we want to put it yet though. Let's > talk to Margaret (or someone) about creating a mozilla/addons (or similar) > on github where we can add cool helper modules like this one. I would love to make a github repo for handy add-on scripts. I have the power to make a new repo on the mozilla account, but maybe we should give it a Fennec/Android specific name if it's just going to hold code that will work for Fennec add-ons. Jorge, do you know if there's already a place where add-on authors share scripts with each other? I also wonder if we could add this to the add-on SDK.
Flags: needinfo?(margaret.leibovic) → needinfo?(jorge)
There's an MDN page that lists all useful JSMs in Firefox code: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules. If Sounds.jsm makes sense for Firefox as well, then I would suggest putting it in a more general location and documenting it on MDN. We don't have a single place for sharing scripts. The mozilla github repo would be a good place, and we can help to broadcast the message.
Flags: needinfo?(jorge)
Jorge, how might we get this jsm into the mozilla github repo?
Flags: needinfo?(jorge)
There's info about our github repo here: https://wiki.mozilla.org/Github. I think it's just a matter of contacting the owners list to set up the repo for you.
Flags: needinfo?(jorge)
I have the powers to create repos in the mozilla account. I could a make a new repo for Fennec add-on goodies. We could put mfinkle's skeleton add-on and my hub boilerplate add-on in there as well, to give those a more official home. What should we name the repo? mobile-addons? fennec-addons? I propose we have one top-level directory for helper scripts (that's where Sound.jsm) could live, another top-level directory for boilerplate/skeleton code (that's where the skeleton/hub boilerplate add-ons could live), and another top-level directory for some example add-ons. We could also link to a bunch of known open source add-on examples in the README. What does everyone think of this plan?
Sounds good to me. (In reply to :Margaret Leibovic from comment #9) > What should we name the repo? mobile-addons? fennec-addons? I don't like mobile-addons because it could be conflated with b2g. fennec-addons could be nice, but I'm concerned how many people are familiar with Firefox for Android's codename. I would vote `android-addons` or, since I'm slightly concerned people may interpret "android-addons" as addons to the OS, `firefox-for-android-addons`.
(In reply to Michael Comella (:mcomella) from comment #10) > Sounds good to me. > > (In reply to :Margaret Leibovic from comment #9) > > What should we name the repo? mobile-addons? fennec-addons? > > I don't like mobile-addons because it could be conflated with b2g. > fennec-addons could be nice, but I'm concerned how many people are familiar > with Firefox for Android's codename. > > I would vote `android-addons` or, since I'm slightly concerned people may > interpret "android-addons" as addons to the OS, `firefox-for-android-addons`. Done! https://github.com/mozilla/firefox-for-android-addons You should have permission to push to it. I created /modules and /boilerplate directories. Feel free to add stuff (and improve the README files).
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Filed bug 1059534 to flesh out the support code around Sound.jsm.
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: