0

Barriers for audio output from mp3 over html5 AudioContext

I have an HTML5 page that is launched from a simple autorun.brs file. Like the title says, I use a js AudioContext object to load/play the audio from an mp3. This works great on my website.

I have limited time with the brightsign (this is contract work), so before I get down to debugging it in-place: what are any known barriers to audio output given this setup? (I'm just plugging headphones directly into the brightsign for debugging)

- is there a mute button somewhere I might have accidentally hit?
- is there a volume toggle somewhere?
- do I need to "enable audio" in the .brs file?
- does audio not play if not triggered within the same stack frame as an input event?
- does brightsign not support mp3 decoding?
- does brightsign not support AudioContext?
- does brightsign not support file:// xmlHttpRequests?
- what can be done to get around any of these issues?

Like I said- when I get a chance to debug in place later tonight I will, but it would be nice to not have to test every one of these assumptions.

3 comments

  • 0
    Avatar
    Phil Dougherty

    I've had some time to work on it, and it's still not working. `ctx.decodeAudioData(aud_data, function(){/*success*/}, function(e){/*error*/});` errors with e="DOMException: Unable to decode audio data". (I'm using the remote debugger). This works fine on my website (mac, pc, chrome, firefox, safari, iphone, android). I've tried with mp3s, wavs, and oggs. Does anyone have any idea why this isn't working?

  • 0
    Avatar
    Phil Dougherty

    Ok, so now I've given up on using the AudioContext, and have just dynamically created a bunch of "Audio" objects. I construct them as follows:

    d.audio_obj = new Audio();
    var src = document.createElement("source");
    src.src = "assets/"+d.audio;
    src.type = "audio/wav";
    d.audio_obj.appendChild(src);
    d.audio_obj.load();

    (I have also tried just doing `d.audio_obj.src = "assets/"+d.audio;`, and gotten identical results)

    Then, I put "d" into an array. If the position on the screen represented by "d" is touched, then I simply run:

    d.audio_obj.play();

    Now I'm no longer getting errors, but nothing is playing. EXCEPT for the 35th object in the array of 36 objects. So good news: confirmation that my headphones aren't broken, and there isn't some config on the brightsign I'm missing allowing audio output- but WHY would the audio only work for one of the 36?! They're all loading the same "test.wav" file.

    As additional clarification regarding my previous attempt (using an AudioContext), the `aud_data` object _was_ an array populated with correct values (as shown by the remote debugger). Figured I'd throw that in for future reference.

    I am absolutely pulling my hair out over this. No matter which way I do it, it seems to work on every device except the brightsign, and now it's working on an arbitrary object but not the rest. Absolute nonsense. Please help.

  • 0
    Avatar
    Bronwen Torelli

    going to bump this thread as im also interested if there was ever a solution

Please sign in to leave a comment.