mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +00:00
feat: Add speech synthesis for marker labels in transcript
This commit is contained in:
parent
0acebc5916
commit
9a16b33f00
1 changed files with 22 additions and 0 deletions
|
@ -128,6 +128,25 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
document.querySelector('.transcript-container').appendChild(container);
|
document.querySelector('.transcript-container').appendChild(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to speak text using the Web Speech API
|
||||||
|
function speakText(text) {
|
||||||
|
// Check if speech synthesis is supported
|
||||||
|
if ('speechSynthesis' in window) {
|
||||||
|
// Create a new speech synthesis utterance
|
||||||
|
const utterance = new SpeechSynthesisUtterance(text);
|
||||||
|
|
||||||
|
// Optional: Configure voice properties
|
||||||
|
utterance.rate = 1.0; // Speech rate (0.1 to 10)
|
||||||
|
utterance.pitch = 1.0; // Speech pitch (0 to 2)
|
||||||
|
utterance.volume = 1.0; // Speech volume (0 to 1)
|
||||||
|
|
||||||
|
// Speak the text
|
||||||
|
window.speechSynthesis.speak(utterance);
|
||||||
|
} else {
|
||||||
|
console.warn('Speech synthesis not supported in this browser');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add event listener with safety checks
|
// Add event listener with safety checks
|
||||||
if (player && typeof player.addEventListener === 'function') {
|
if (player && typeof player.addEventListener === 'function') {
|
||||||
player.addEventListener('marker', function(event) {
|
player.addEventListener('marker', function(event) {
|
||||||
|
@ -135,6 +154,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
const { index, time, label } = event;
|
const { index, time, label } = event;
|
||||||
console.log(`marker! ${index} - ${time} - ${label}`);
|
console.log(`marker! ${index} - ${time} - ${label}`);
|
||||||
|
|
||||||
|
// Speak the marker label
|
||||||
|
speakText(label);
|
||||||
|
|
||||||
const transcriptContent = document.getElementById('transcript-content');
|
const transcriptContent = document.getElementById('transcript-content');
|
||||||
if (transcriptContent) {
|
if (transcriptContent) {
|
||||||
const markerElement = document.createElement('div');
|
const markerElement = document.createElement('div');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue