Apply audio durations to scope immediately upon their availability #1514
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1512
Description
With our AngularJS bindings, the duration of an audio file is not displayed unless it has been loaded. Previously, the DOM was not being updated immediately upon the duration becoming available. This PR tells the $scope to apply its changes to the DOM once the "durationchange" event has occurred on the HTML audio element.
Because it takes a small amount of time for the duration to become available, there is still visible movement; there is a split second from when the entry is clicked on and the duration is not there, to when the duration appears.
Type of Change
Screenshots
Before, I was able to reproduce Chris's bug video in issue #1512, for me on Windows 10 with Google Chrome. Now I am seeing this:
video1546811699.mp4
A potential concern of mine is that the quick flash when the duration appears might be considered unpleasant to look at. But, I am not sure I can make it appear with zero delay, since our code already says the duration should appear if it's available, the instant you had clicked it.
Checklist
How to test
qa.languageforge.org testing
Testers: Check the box and put in a date/time to sign-off/attest the feature works as expected on qa.languageforge.org
durations were visible for entries with audio already (pretty quickly)
durations were visible for newly recorded audio
durations were visible for newly uploaded audio