-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/94 clean up code in task after audio testing #100
Feature/94 clean up code in task after audio testing #100
Conversation
…play to finish. Put play of first letter in task in to separate useEffect, previously it tried to play for each letter. Fixed handling of undefined promise in audio.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments :)
src/components/task/task.tsx
Outdated
correctAudioElement.current.load(); | ||
wrongAudioElement.current.load(); | ||
|
||
audioElement.current) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place this on one line :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/components/task/task.tsx
Outdated
if (correctAudioElement.current) { | ||
correctAudioElement.current.setAttribute('currentTime', '0'); | ||
correctAudioElement.current.play().then(() => { | ||
if(correctKeyPressed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing after if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/components/task/task.tsx
Outdated
} | ||
}).catch(error => console.error('play current error', error)); | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else
should be placed on same line
} else {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/components/task/task.tsx
Outdated
}, [currentPos, task.exercise, ttsOptions]); | ||
|
||
useEffect(() => { | ||
speak(task.exercise[currentPos].text, ttsOptions).then(url => playAudio(audioElement, url)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add catch for playAudio
and speak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/components/audio/audio.tsx
Outdated
|
||
const promise = audio.current.play(); | ||
if (promise !== undefined) { | ||
const promise = audio.current.play().catch(error => console.error('playAudio error '+error)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add spaces in string console.error('playAudio error ' + error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
No need to merge this before the sprint demo