src/browser/AudioInputCaptureProxy.js
function initialize(success, error, opts) {
    console.log("AudioInputCaptureProxy: initialize: " + JSON.stringify(opts));
    onInitialized = success;
    if (!intialized) {
        sampleRate = opts[0] || sampleRate;
        bufferSize = opts[1] || bufferSize;
        channels = opts[2] || channels;
        format = opts[3] || format;
        audioSourceType = opts[4] || audioSourceType;
        fileUrl = opts[5] || fileUrl;

        if (fileUrl) {
            window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
            if (window.webkitStorageInfo && window.webkitStorageInfo.requestQuota) {
                // Chrome/Android requires calling requestQuota first
                window.webkitStorageInfo.requestQuota(
                    /file:\/\/\/temporary.*/.test(fileUrl) ? window.TEMPORARY : window.PERSISTENT,
                    10 * 1024 * 1024,
                    function (grantedBytes) {
                        console.log("AudioInputCaptureProxy: Granted " + grantedBytes + " bytes storage");
                        window.requestFileSystem(
                            /file:\/\/\/temporary.*/.test(fileUrl) ? window.TEMPORARY : window.PERSISTENT,
                            10 * 1024 * 1024,
                            function (fs) {
                                console.log("AudioInputCaptureProxy: Got file system: " + fs.name);
                                fileSystem = fs;
                                intialized = true;
                                onInitialized();
                            }, error);
                    }, error);
            }
            else {
                // Firefox and Safari/iOS require calling requestFileSystem directly
                window.requestFileSystem(
                    /file:\/\/\/temporary.*/.test(fileUrl) ? window.TEMPORARY : window.PERSISTENT,
                    10 * 1024 * 1024,
                    function (fs) {
                        console.log("AudioInputCaptureProxy: Got file system: " + fs.name);
                        fileSystem = fs;
                        intialized = true;
                        onInitialized();
                    }, error);
            }
            return;
        } // fileUrl set
        intialized = true;
    } // !initialized
    onInitialized();
}
function initialize(success, error, opts) {
    console.log("AudioInputCaptureProxy: initialize: " + JSON.stringify(opts));
    onInitialized = success;
    if (!intialized) {
        sampleRate = opts[0] || sampleRate;
        bufferSize = opts[1] || bufferSize;
        channels = opts[2] || channels;
        format = opts[3] || format;
        audioSourceType = opts[4] || audioSourceType;
        fileUrl = opts[5] || fileUrl;

        if (fileUrl) {
            window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
            if (window.webkitStorageInfo && window.webkitStorageInfo.requestQuota) {
                // Chrome/Android requires calling requestQuota first
                window.webkitStorageInfo.requestQuota(
                    /file:\/\/\/temporary.*/.test(fileUrl) ? window.TEMPORARY : window.PERSISTENT,
                    10 * 1024 * 1024,
                    function (grantedBytes) {
                        console.log("AudioInputCaptureProxy: Granted " + grantedBytes + " bytes storage");
                        window.requestFileSystem(
                            /file:\/\/\/temporary.*/.test(fileUrl) ? window.TEMPORARY : window.PERSISTENT,
                            10 * 1024 * 1024,
                            function (fs) {
                                console.log("AudioInputCaptureProxy: Got file system: " + fs.name);
                                fileSystem = fs;
                                intialized = true;
                                onInitialized();
                            }, error);
                    }, error);
            }
            else {
                // Firefox and Safari/iOS require calling requestFileSystem directly
                window.requestFileSystem(
                    /file:\/\/\/temporary.*/.test(fileUrl) ? window.TEMPORARY : window.PERSISTENT,
                    10 * 1024 * 1024,
                    function (fs) {
                        console.log("AudioInputCaptureProxy: Got file system: " + fs.name);
                        fileSystem = fs;
                        intialized = true;
                        onInitialized();
                    }, error);
            }
            return;
        } // fileUrl set
        intialized = true;
    } // !initialized
    onInitialized();
}
function initialize ( success , error , opts ) { console . log ( "AudioInputCaptureProxy: initialize: " + JSON . stringify ( opts ) ) ; onInitialized = success ; if ( ! intialized ) { sampleRate = opts [ 0 ] || sampleRate ; bufferSize = opts [ 1 ] || bufferSize ; channels = opts [ 2 ] || channels ; format = opts [ 3 ] || format ; audioSourceType = opts [ 4 ] || audioSourceType ; fileUrl = opts [ 5 ] || fileUrl ; if ( fileUrl ) { window . requestFileSystem = window . requestFileSystem || window . webkitRequestFileSystem ; if ( window . webkitStorageInfo && window . webkitStorageInfo . requestQuota ) { // Chrome/Android requires calling requestQuota first window . webkitStorageInfo . requestQuota ( / file:\/\/\/temporary.* / . test ( fileUrl ) ? window . TEMPORARY : window . PERSISTENT , 10 * 1024 * 1024 , function ( grantedBytes ) { console . log ( "AudioInputCaptureProxy: Granted " + grantedBytes + " bytes storage" ) ; window . requestFileSystem ( / file:\/\/\/temporary.* / . test ( fileUrl ) ? window . TEMPORARY : window . PERSISTENT , 10 * 1024 * 1024 , function ( fs ) { console . log ( "AudioInputCaptureProxy: Got file system: " + fs . name ) ; fileSystem = fs ; intialized = true ; onInitialized ( ) ; } , error ) ; } , error ) ; } else { // Firefox and Safari/iOS require calling requestFileSystem directly window . requestFileSystem ( / file:\/\/\/temporary.* / . test ( fileUrl ) ? window . TEMPORARY : window . PERSISTENT , 10 * 1024 * 1024 , function ( fs ) { console . log ( "AudioInputCaptureProxy: Got file system: " + fs . name ) ; fileSystem = fs ; intialized = true ; onInitialized ( ) ; } , error ) ; } return ; } // fileUrl set intialized = true ; } // !initialized onInitialized ( ) ; }
2017-10-29 robert@fromont.net.nz Implement as a Cordova plugin for the 'browser' platform Public:
2017 - 10 - 29 robert