Skip to content

Commit

Permalink
Whispeak: Add timer when recording voice - refs BT#17415
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Nov 23, 2020
1 parent 5dbbc73 commit 295472c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
Expand Up @@ -348,6 +348,7 @@ protected function displayPage($isFullPage, array $variables)

$htmlHeadXtra[] = api_get_js('rtc/RecordRTC.js');
$htmlHeadXtra[] = api_get_js_simple(api_get_path(WEB_PLUGIN_PATH).'whispeakauth/assets/js/RecordAudio.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');

$pageTitle = $this->plugin->get_title();

Expand Down
1 change: 1 addition & 0 deletions plugin/whispeakauth/Controller/EnrollmentController.php
Expand Up @@ -98,6 +98,7 @@ protected function displayPage($isFullPage, array $variables)

$htmlHeadXtra[] = api_get_js('rtc/RecordRTC.js');
$htmlHeadXtra[] = api_get_js_simple(api_get_path(WEB_PLUGIN_PATH).'whispeakauth/assets/js/RecordAudio.js');
$htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');

$pageTitle = $this->plugin->get_lang('EnrollmentTitle');

Expand Down
6 changes: 6 additions & 0 deletions plugin/whispeakauth/assets/js/RecordAudio.js
Expand Up @@ -85,6 +85,9 @@ window.RecordAudio = (function () {
btnStop.prop('disabled', false).parent().removeClass('hidden');
btnStart.prop('disabled', true).parent().addClass('hidden');
tagAudio.removeClass('show').parents('#audio-wrapper').addClass('hidden');

$('.fa-microphone').addClass('text-danger');
$('#txt-timer').epiclock({mode: $.epiclock.modes.countup, format: 'e:s'});
}

function errorCallback(error) {
Expand All @@ -111,6 +114,9 @@ window.RecordAudio = (function () {
return;
}

$('.fa-microphone').removeClass('text-danger');
$('#txt-timer').text('');

recordRTC.stopRecording(function (audioURL) {
tagAudio.prop('src', audioURL);

Expand Down
1 change: 1 addition & 0 deletions plugin/whispeakauth/view/record_audio.html.twig
Expand Up @@ -6,6 +6,7 @@
<div class="row">
<div class="col-sm-3 text-center">
<span class="fa fa-microphone fa-5x fa-fw" aria-hidden="true"></span>
<span id="txt-timer" class="text-danger h3 show"></span>
</div>
<div class="col-sm-9 text-center">
<p class="lead" id="txt-sample-text">{{ sample_text }}</p>
Expand Down

0 comments on commit 295472c

Please sign in to comment.