Coder Social home page Coder Social logo

Voice feedback support about siri-api HOT 3 CLOSED

robinmeis avatar robinmeis commented on August 16, 2024
Voice feedback support

from siri-api.

Comments (3)

RobinMeis avatar RobinMeis commented on August 16, 2024

I already played with this API and wanted to implement it in the next version. But as far as I know it is not possible to start the speech automatically. So the user would have to click on a button to start the playback which is useless in my opinion.
Please let me know if you have an idea how to start the playback automatically.

from siri-api.

JBX028 avatar JBX028 commented on August 16, 2024

Hi,

I didn't realized this limitation that will have a big impact on the user experience. It's seems that this user found a workaround : http://www.broken-links.com/2013/09/20/web-speech-api-part-one-speech-synthesis/

"Update: From a little further experimentation it looks like on iOS the speech must be initiated by a user action, rather than on page load (for example). Also, I’ve added a little easter egg to my site: if you’re using Chrome Canary or Safari 6.1/7 (both for OSX), try using the site search box…"

copy/past of his source code (not yet tested)

    window.addEventListener('DOMContentLoaded', function(){
        if(window.speechSynthesis != 'undefined') {
            var frm = document.getElementById('say'),
                pitchRange = document.getElementById('pitch'),
                rateRange = document.getElementById('rate'),
                volRange = document.getElementById('volume'),
                foo, txt, langRadio;
            frm.addEventListener('submit',function(e){
                e.preventDefault();
                var voices = window.speechSynthesis.getVoices();
                //console.log(voices);
                langRadio = document.querySelector('input[type=radio]:checked');
                txt = document.getElementById('sayit').value;
                foo = new SpeechSynthesisUtterance(txt);
                foo.lang = langRadio;
                foo.pitch = pitchRange.value;
                foo.rate = rateRange.value;
                foo.voice = voices[10];
                foo.voiceURI = 'native';
                foo.volume = volRange.value;
                window.speechSynthesis.speak(foo);
                //console.log('Said',foo);
            });
        }
    });

I hope you will find useful info otherwise, i will try to create a static page and make some investigations on my side.

Johnny -

from siri-api.

RobinMeis avatar RobinMeis commented on August 16, 2024

This workaround only works on Chrome and Safari on Mac OS X but not on iOS. I tried the easter egg on my iPad and iPhone with iOS 7 and as expected it did not work.

from siri-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.