JS Audio Playback on 28?

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 663
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California
Contact:

JS Audio Playback on 28?

Unread post by RealityRipple » 2018-08-16, 19:16

One of my extensions, TimerFox, uses the Audio object to play a custom sound file if the user chooses. As of v28, this doesn't seem to work any longer. The audio object isn't undefined, the player doesn't appear to error, it just... doesn't play any sound.

Here's an excerpt of the code being used:

Code: Select all

var simpleBeep = 0;
if (typeof Audio == "undefined")
{
 simpleBeep = 1;
}
if (!priv.bAudio)
{
 simpleBeep = 1;
}
if (simpleBeep == 0)
{
 try
 {
  priv.mAPlayer = new Audio(priv.sAudio);
  priv.mAPlayer.onerror = function()
  {
   var mPlayer = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
   mPlayer.init;
   mPlayer.beep();
  }
  priv.mAPlayer.play();
  priv.mAPlayer.onended = function()
  {
   priv.mAPlayer = null;
  }
 }
 catch(e)
 {
  simpleBeep = 1;
 }
}
if (simpleBeep == 1)
{
 var mPlayer = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
 mPlayer.init;
 mPlayer.beep();
}
simpleBeep is not being set to 1, none of the error handlers are triggered, and onended is never called.

User avatar
Nigaikaze
Board Warrior
Board Warrior
Posts: 1322
Joined: 2014-02-02, 22:15
Location: Chicagoland

Re: JS Audio Playback on 28?

Unread post by Nigaikaze » 2018-08-16, 19:24

RealityRipple wrote:As of v28, this doesn't seem to work any longer.
I just visited the TimerFox web page using PM 28 and it told me:
NOTICE: The version of Pale Moon you are running is too new to run TimerFox. I'm probably working on a new version, so check back again soon!
My recommendation is to contact the TimerFox developers and let them know about this problem. Hopefully they will be able to correct it in the not-too-distant future.

EDIT: Erp ... very sorry, I just realized you ARE the developer. <Emily Litella> Never mind. </Emily Litella>
Last edited by Nigaikaze on 2018-08-16, 19:27, edited 1 time in total.
Nichi nichi kore ko jitsu = Every day is a good day.

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 663
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California
Contact:

Re: JS Audio Playback on 28?

Unread post by RealityRipple » 2018-08-16, 19:44

Nigaikaze wrote:
RealityRipple wrote:As of v28, this doesn't seem to work any longer.
I just visited the TimerFox web page using PM 28 and it told me:
NOTICE: The version of Pale Moon you are running is too new to run TimerFox. I'm probably working on a new version, so check back again soon!
My recommendation is to contact the TimerFox developers and let them know about this problem. Hopefully they will be able to correct it in the not-too-distant future.

EDIT: Erp ... very sorry, I just realized you ARE the developer. <Emily Litella> Never mind. </Emily Litella>
Sorry, when I said "one of my extensions" I meant one that I'd created, not one I had installed.

JustOff

Re: JS Audio Playback on 28?

Unread post by JustOff » 2018-08-16, 20:41

RealityRipple wrote:One of my extensions, TimerFox, uses the Audio object to play a custom sound file if the user chooses. As of v28, this doesn't seem to work any longer.
It works just fine for me (tested with mp3 and flac files).
Last edited by JustOff on 2018-08-16, 20:42, edited 1 time in total.

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 663
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California
Contact:

Re: JS Audio Playback on 28?

Unread post by RealityRipple » 2018-08-16, 23:36

Found the problem. It appears this component is now restricted by the "media.autoplay.enabled" which I always set to false. This seems like... not a good design, since the element has no interface to allow playback from...
Last edited by RealityRipple on 2018-08-17, 00:03, edited 1 time in total.

Locked