Closed Bug 1732498 Opened 4 months ago Closed 3 months ago

Firefox returns SpeechSynthesisEvent.elapsedTime in milliseconds, not seconds

Categories

(Core :: Web Speech, defect)

Firefox 92
defect

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: micolous+moz, Assigned: m_kato)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0

Steps to reproduce:

  1. Visit https://mdn.github.io/web-speech-api/speak-easy-synthesis/
  2. Add a breakpoint at line 65 of script.js: synth.speak(utterThis);
  3. Select one of the system TTS voices (not Google TTS)
  4. Enter the text: "hello world"
  5. Press "play"
  6. When the breakpoint is hit, run the following code in the Console to log word boundary events:
utterThis.onboundary = (e) => { if (e.name == 'word') { console.log(`@ ${e.elapsedTime}: ${e.target.text.substr(e.charIndex, e.charLength)}`); }};

Actual results:

SpeechSynthesisEvent.elapsedTime events are in milliseconds:

@ 177: Hello
@ 577: world

I also see the same issue with Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=1253036

Expected results:

SpeechSynthesisEvent.elapsedTime events should be in seconds, eg:

@ 0.17: Hello
@ 0.57: world

MDN's documentation erroneously stated the event was in milliseconds, which has been corrected: https://github.com/mdn/content/issues/6581

Spec: https://wicg.github.io/speech-api/#dom-speechsynthesisevent-elapsedtime

elapsedTime attribute, of type float, readonly
This attribute indicates the time, in seconds, that this event triggered, relative to when this utterance has begun to be spoken.

Safari 14.1.2 on macOS appears to have correct behaviour.

Summary: SpeechSynthesisEvent.elapsedTime in milliseconds, not seconds → Firefox returns SpeechSynthesisEvent.elapsedTime in milliseconds, not seconds

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

m_kato, it looks to me like the fix here would be in changing duration.ToSeconds() in SpeechTaskCallback::GetTimeDurationFromStart here, but that's platform-specific code, and I'm not able to find the corresponding places to change for other platforms. Do you have any idea?

Severity: -- → S4
Flags: needinfo?(m_kato)
Priority: -- → P5

Yes, that's correct. Also, I guess that Windows version has same problem.

Assignee: nobody → m_kato
Component: Audio/Video: Playback → Web Speech
Flags: needinfo?(m_kato)
Status: UNCONFIRMED → NEW
Ever confirmed: true

The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P5 → --
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/e53c0a42c964
Duration of nsISpeechTask should be second. r=eeejay
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
Keywords: dev-doc-needed

FYI docs work for this can be tracked in https://github.com/mdn/content/issues/10221

In summary it is the addition of a subfeature in browser compatibility to track removal of milliseconds, and the docs have been updated with a note to check the compatibility table. There is also a release note.

You need to log in before you can comment on or make changes to this bug.