Step to reproduce:
1. Open chrome-extension://neajdppkdcdipfabeoofebfddakdcjhd/_generated_background_page.html on a Tab;
2. On a different Tab run the following in DevTools console or Snippets
speechSynthesis.cancel();
var recorder;
var text = `
1. XML parse: An XML parser is used to extract the document tree
and content from the incoming text document. The structure, tags
and attributes obtained in this step influence each of the following steps.
2. Structure analysis: The structure of a document influences the way
in which a document should be read. For example, there are common speaking
patterns associated with paragraphs and sentences.`;
var utterance = new SpeechSynthesisUtterance(text);
console.log(utterance);
utterance.onend = (e) => {
console.log(e.type);
recorder.stop();
}
utterance.onpause = (e) => {
console.log(e.type);
}
utterance.onstart = async(e) => {
console.log(e.type);
speechSynthesis.pause();
console.log(speechSynthesis.paused, speechSynthesis.speaking);
stream = await navigator.mediaDevices.getDisplayMedia({audio: true, video: true, echoCancellation: false,
noiseSupression: false,
autoGainControl: false,});
[track] = stream.getAudioTracks();
stream.removeTrack(stream.getVideoTracks()[0]);
console.log(track);
recorder = new MediaRecorder(stream);
recorder.onstop = () => recorder.stream.getAudioTracks()[0].stop();
recorder.ondataavailable = ({data}) => console.log(URL.createObjectURL(data));
recorder.start();
speechSynthesis.resume();
}
speechSynthesis.speak(utterance);
3. Select the extension background page at getDisplayMedia() prompt
What happens:
1. start event of SpeechSynthesisUtterance is fired twice; should be fired at most once;
2. speechSynthesis.pause() does not pause speech synthesis audio output;
3. Audio is output on the opened Tab and the background extension page; when chrome-extension://neajdppkdcdipfabeoofebfddakdcjhd/_generated_background_page.html are loaded on multiple tabs the audio will be output on each Tab.
4. When the calling Web page reloads the Google voice continues audio output on each Tab.