Pubcoder support for Web Audio API?

  1. 4 years ago

    Is the any support of the Web Audio API in Pubcoder/XPUB2?
    https://www.html5rocks.com/en/tutorials/webaudio/intro/

    I got a few examples to run in PubReader on iOS but haven't been able to come further.

  2. Angelo S

    27 Feb 2020 Administrator

    Hello John,
    Yes, WebAudio is fully supported in XPUB2, iOS App, Android App and HTML outputs.
    BUT, it will not work in the built-in preview, for mainly 2 reasons:

    1. the preview is based on UIWebView
    2. the examples requires a web server (using XMLHttpRequest)

    So, to see it working, you have to use PubReader (XPUB2), or export an app (iOS or Android) or export HTML in a browser.

    Here's a working example project:
    https://www.dropbox.com/s/nssp07e2mpwvrie/audio-tests.pubcoder?dl=0

    Check the last page in the project.

  3. Thanks, Angelo - that's really great.

  4. Hi Angelo,

    I am trying to get Howler.js to work with Web Audio (in PubReader on iPad).
    I have the script below. But it doesn't work.
    I have checked that both the Howler,js and the sound file is atached in the XPUB file.
    Do you have experience with Pubcoder and Howler.js?

    Best
    John

    //---- On "Page HTML Head" --------------------------------------------//
    <script type="text/javascript" src="../uncategorized/howler.js"></script>

    <script type="text/javascript"><![CDATA[

    $(document).ready(function() {
    var sound = new Howl({
    src: ['../audio/Horse.mp3']
    });
    }); // end document ready

    ]]></script>
    //---------------------------------------------------------------------//

    //---- On a button ----------------------------------------------------//

    sound.play();

    //---------------------------------------------------------------------//

  5. I have got it to work by editing the HTML Head script to:

    <script type="text/javascript">
    //<![CDATA[
    //############### BEGIN ON DOCUMENT READY ###################//
    $(document).ready(function() {

    sound = new Howl({
    src: ['../audio/Horse.mp3']
    });

    }); // end document ready
    //############### END ON DOCUMENT READY #####################//
    var sound;
    //]]>
    </script>

 

or Sign Up to reply!