locked
Could not find speechSynthesisStream.position for finding the position

    Question

  • Hi,

    While building a metroapp,used speech synthesis class to speak out the text that is given as input in the textbox.

    and found play and pause events but no way resume event.

    While trying to figure out a way to handle resume, found position property, but could not able to write it in the code.

    The problem is when user pauses and then again clicks on play it starts from the beginning.

    below is my code snippet used

    could some one tell me how to handle resume event.

    synth.synthesizeTextToStreamAsync(txtData.value).then(function (markersStream) {
    
                // Convert the stream to a URL Blob.
                var blob = MSApp.createBlobFromRandomAccessStream(markersStream.ContentType, markersStream);
    
                audio.src = URL.createObjectURL(blob, { oneTimeOnly: true });
                markersStream.seek(0);
                audio.autoplay = Boolean(true);
                audio.onplay = function () {
                    statuslabel.innerHTML = "playing";
                };
                audio.onended = function () {
                    statuslabel.innerHTML = "Finished";
                    document.getElementById("Speak").disabled = false;
                    synth.close();
    
                };
                audio.onpause = function () {
                    statuslabel.innerHTML = "Finished";
                    //   var abc = 
    
    
                };
    
    
                audio.play();

    Trying to findout a way to know the position of the text till spoken out, so that i could provide it as input for  markersStream.seek(0); so that on resume it continues to play from the remaining.

    It could be helpful if there is any better way of doing the same.


    Thanks & Regards Tejaswi Chandrapatla

    Wednesday, October 16, 2013 2:15 PM

Answers

All replies