Dejo
Dejo

Reputation: 2148

Will Web Speech API work in Cordova/Phonegap app?

Will Web Speech API work in Cordova/Phonegap based app ? I'm interested mainly if it will work on Android.

Upvotes: 0

Views: 1249

Answers (1)

Caio Ladislau
Caio Ladislau

Reputation: 1307

You can use this plugin: https://github.com/apache/cordova-plugin-media

There exists a whole step by step to use it

Example:

// Audio player
//
var my_media = new Media(src, onSuccess, onError);

// Update media position every second
var mediaTimer = setInterval(function () {
    // get media position
    my_media.getCurrentPosition(
        // success callback
        function (position) {
            if (position > -1) {
                console.log((position) + " sec");
            }
        },
        // error callback
        function (e) {
            console.log("Error getting pos=" + e);
        }
    );
}, 1000);

Upvotes: 1

Related Questions