Mattflaschen has submitted this change and it was merged. Change subject: Made some UI improvements to Special:PronunciationRecording ......................................................................
Made some UI improvements to Special:PronunciationRecording * Removed the preview button, immediately after the user clicks the "Stop" button the seekbar is displayed * Disabled the upload button after it's clicked * A message prompting the user to approve the microphone Bug: 54340 Change-Id: Ic165735797240c46455e4a9fa080539a697af315 --- M PronunciationRecording.i18n.php M PronunciationRecording.php M SpecialPronunciationRecording.php M resources/ext.pronunciationRecording.pronunciationRecorder.js M resources/ext.pronunciationRecording.specialPage.js 5 files changed, 16 insertions(+), 10 deletions(-) Approvals: Mattflaschen: Verified; Looks good to me, approved diff --git a/PronunciationRecording.i18n.php b/PronunciationRecording.i18n.php index c5999e1..3571b7f 100644 --- a/PronunciationRecording.i18n.php +++ b/PronunciationRecording.i18n.php @@ -17,7 +17,6 @@ 'pronunciationrecording-title' => 'Pronunciation recording tool', 'pronunciationrecording-toolbar-record-label' => 'Record', 'pronunciationrecording-toolbar-stop-label' => 'Stop', - 'pronunciationrecording-toolbar-preview-label' => 'Preview', 'pronunciationrecording-toolbar-clear-label' => 'Clear', 'pronunciationrecording-toolbar-upload-label' => 'Upload', 'pronunciationrecording-webaudio-not-supported' => 'WebAudio API is not supported for this browser', @@ -27,6 +26,8 @@ 'pronunciationrecording-information-label' => 'Information', 'pronunciationrecording-information-word-label' => 'Word:', 'pronunciationrecording-information-language-label' => 'Language:', + 'pronunciationrecording-mic-access-notify' => 'Click "Allow" to allow the browser to access your microphone.', + 'pronunciationrecording-recording-notify' => 'Recording....', ); @@ -41,8 +42,6 @@ {{Identical|Record}}', 'pronunciationrecording-toolbar-stop-label' => 'Label text for the button to stop recording. {{Identical|Stop}}', - 'pronunciationrecording-toolbar-preview-label' => 'Label text for the button to preview the recording. -{{Identical|Preview}}', 'pronunciationrecording-toolbar-clear-label' => 'Label text for the button to clear the recording. {{Identical|Clear}}', 'pronunciationrecording-toolbar-upload-label' => 'Label text for the button to upload the recording. @@ -63,6 +62,8 @@ 'pronunciationrecording-information-label' => 'Label text for the legend', 'pronunciationrecording-information-word-label' => 'Label text for the word input field', 'pronunciationrecording-information-language-label' => 'Label text for the language dropdown list', + 'pronunciationrecording-mic-access-notify' => 'Notifies the user to click "Allow" to allow the browser to get microphone access', + 'pronunciationrecording-recording-notify' => 'Notifies the user that his pronunciation is being recorded', ); /** Akan (Akan) diff --git a/PronunciationRecording.php b/PronunciationRecording.php index 07d8340..063e589 100644 --- a/PronunciationRecording.php +++ b/PronunciationRecording.php @@ -59,6 +59,8 @@ 'pronunciationrecording-webaudio-not-supported', 'pronunciationrecording-upload-publish-succeeded', 'pronunciationrecording-upload-publish-failed', + 'pronunciationrecording-mic-access-notify', + 'pronunciationrecording-recording-notify', ), ) + $pronunciationRecordingModuleInfo; diff --git a/SpecialPronunciationRecording.php b/SpecialPronunciationRecording.php index bc273da..159f124 100644 --- a/SpecialPronunciationRecording.php +++ b/SpecialPronunciationRecording.php @@ -23,9 +23,8 @@ $output->addModules( 'ext.pronunciationRecording.specialPage' ); $output->addHTML( '<div class="mw-pronunciationrecording-message" id="mw-pronunciationrecording-message"></div>' ); $output->addHTML( '<div class="mw-pronunciationrecording-toolbar" id="mw-pronunciationrecording-toolbar" >' ); - $output->addHTML( '<button class="mw-pronunciationrecording-record" id="mw-pronunciationrecording-record" >' .wfMessage( 'pronunciationrecording-toolbar-record-label' )->escaped().'</button>' ); + $output->addHTML( '<button class="mw-pronunciationrecording-record" id="mw-pronunciationrecording-record" disabled>' .wfMessage( 'pronunciationrecording-toolbar-record-label' )->escaped().'</button>' ); $output->addHTML( '<button class="mw-pronunciationrecording-stop" id="mw-pronunciationrecording-stop" disabled >' .wfMessage( 'pronunciationrecording-toolbar-stop-label' )->escaped().'</button>' ); - $output->addHTML( '<button class="mw-pronunciationrecording-preview" id="mw-pronunciationrecording-preview" disabled >' .wfMessage( 'pronunciationrecording-toolbar-preview-label' )->escaped().'</button>' ); $output->addHTML( '<button class="mw-pronunciationrecording-clear" id="mw-pronunciationrecording-clear" disabled >' .wfMessage( 'pronunciationrecording-toolbar-clear-label' )->escaped().'</button>' ); $output->addHTML( '<div class="mw-pronunciationrecording-preview-div" id="mw-pronunciationrecording-preview-div" disabled ></div>' ); $output->addHTML( '</div>' ); diff --git a/resources/ext.pronunciationRecording.pronunciationRecorder.js b/resources/ext.pronunciationRecording.pronunciationRecorder.js index a05df62..81d60a0 100644 --- a/resources/ext.pronunciationRecording.pronunciationRecorder.js +++ b/resources/ext.pronunciationRecording.pronunciationRecorder.js @@ -4,6 +4,8 @@ var audioContext, recorder, uploadHandler, uploadWizardUpload, cachedBlob, counter, userAgent = mw.message( 'pronunciationrecording-title' ).text(); function startUserMedia( stream ) { + $( ".mw-pronunciationrecording-record" ).removeAttr('disabled'); + $( ".mw-pronunciationrecording-message" ).empty(); var input = audioContext.createMediaStreamSource( stream ); mw.log( 'Media Stream created' ); recorder = new Recorder( input ); @@ -102,6 +104,7 @@ function( blob ) { var message = $( '<br><audio controls class="mw-pronunciationrecording-preview-audio"><source src="' + URL.createObjectURL( blob ) + '" type="audio/wav"></audio>' ); var upload = $( '<br><button class="mw-pronunciationrecording-upload">' + mw.message('pronunciationrecording-toolbar-upload-label').escaped() + '</button>' ); + $( ".mw-pronunciationrecording-preview-div" ).empty(); upload.prependTo( ".mw-pronunciationrecording-preview-div" ); message.prependTo( ".mw-pronunciationrecording-preview-div" ); } diff --git a/resources/ext.pronunciationRecording.specialPage.js b/resources/ext.pronunciationRecording.specialPage.js index 0a4232b..98088dd 100644 --- a/resources/ext.pronunciationRecording.specialPage.js +++ b/resources/ext.pronunciationRecording.specialPage.js @@ -2,25 +2,25 @@ $( document ).ready( function() { try { var pronunciationRecorder = new mw.PronunciationRecorder( ); + $( ".mw-pronunciationrecording-message" ).text( mw.message( 'pronunciationrecording-mic-access-notify' ).text() ); $( ".mw-pronunciationrecording-record" ).on("click", function() { $( ".mw-pronunciationrecording-record" ).attr('disabled','disabled'); $( ".mw-pronunciationrecording-stop" ).removeAttr('disabled'); + $( ".mw-pronunciationrecording-message" ).text( mw.message( 'pronunciationrecording-recording-notify' ).text() ); pronunciationRecorder.startRecording(); }); $( ".mw-pronunciationrecording-stop" ).on("click", function() { + $( ".mw-pronunciationrecording-message" ).empty(); $( ".mw-pronunciationrecording-stop" ).attr('disabled','disabled'); - $( ".mw-pronunciationrecording-preview" ).removeAttr('disabled'); - pronunciationRecorder.stopRecording(); - }); - $( ".mw-pronunciationrecording-preview" ).on("click", function() { - $( ".mw-pronunciationrecording-preview" ).attr('disabled','disabled'); $( ".mw-pronunciationrecording-clear" ).removeAttr('disabled'); + pronunciationRecorder.stopRecording(); pronunciationRecorder.createSource(); }); $( ".mw-pronunciationrecording-clear" ).on("click", function() { $( ".mw-pronunciationrecording-record" ).removeAttr('disabled'); $( ".mw-pronunciationrecording-preview-audio" ).remove(); $( ".mw-pronunciationrecording-upload" ).remove(); + $( ".mw-pronunciationrecording-message" ).empty(); }); $( document ).on( "click", ".mw-pronunciationrecording-upload", function() { var wikiText, pronunciationRecorderFileDetails, word, username, lang_code; @@ -29,6 +29,7 @@ username = mw.user.getName(); pronunciationRecorderFileDetails = new mw.PronunciationRecorderFileDetails( word, username, lang_code ); wikiText = pronunciationRecorderFileDetails.generateWikiText(); + $( ".mw-pronunciationrecording-upload" ).attr('disabled','disabled'); pronunciationRecorder.startUploading( function() { $( ".mw-pronunciationrecording-message" ).text( mw.message( 'pronunciationrecording-upload-publish-succeeded' ).text() ); }, function() { -- To view, visit https://gerrit.wikimedia.org/r/85604 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic165735797240c46455e4a9fa080539a697af315 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/PronunciationRecording Gerrit-Branch: master Gerrit-Owner: Rahul21 <rahul14...@gmail.com> Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org> Gerrit-Reviewer: Mdale <md...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits