Skip to content

Commit

Permalink
Merge pull request #53 from sudeeppr1998/audio-upload-to-s3
Browse files Browse the repository at this point in the history
add logic to get channel as a s3 folder and add content id from localstorage to file name
  • Loading branch information
gouravmore authored Aug 25, 2023
2 parents 4ed330f + 83d7f72 commit 0000bdf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/components/AudioRecorderTamil/AudioRecorderTamil.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ function Mic({
let word_result = (result_per_words == 100) ? "correct" : "incorrect";

if (process.env.REACT_APP_CAPTURE_AUDIO === 'true') {

var audioFileName = `${process.env.REACT_APP_AWS_s3_BUCKET_FOLDER_NAME}/${localStorage.getItem('contentSessionId')}-${Date.now()}.wav`;
let getContentId = parseInt(localStorage.getItem('content_random_id')) + 1;
var audioFileName = `${process.env.REACT_APP_CHANNEL}/${localStorage.getItem('contentSessionId')}-${Date.now()}-${getContentId}.wav`;

const command = new PutObjectCommand({
Bucket: process.env.REACT_APP_AWS_s3_BUCKET_NAME,
Expand All @@ -242,7 +242,7 @@ function Mic({

response(
{ // Required
"target": process.env.REACT_APP_CAPTURE_AUDIO === 'true' ? `${process.env.REACT_APP_AWS_s3_BUCKET_URL}/${audioFileName}` : '', // Required. Target of the response
"target": process.env.REACT_APP_CAPTURE_AUDIO === 'true' ? `${audioFileName}` : '', // Required. Target of the response
//"qid": "", // Required. Unique assessment/question id
"type": "SPEAK", // Required. Type of response. CHOOSE, DRAG, SELECT, MATCH, INPUT, SPEAK, WRITE
"values": [
Expand Down
6 changes: 3 additions & 3 deletions src/components/VoiceCompair/VoiceCompair.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ const VoiceCompair = props => {
let word_result = (result_per_words == 100) ? "correct" : "incorrect";

if (process.env.REACT_APP_CAPTURE_AUDIO === 'true') {

var audioFileName = `${process.env.REACT_APP_AWS_s3_BUCKET_FOLDER_NAME}/${localStorage.getItem('contentSessionId')}-${Date.now()}.wav`;
let getContentId = parseInt(localStorage.getItem('content_random_id')) + 1;
var audioFileName = `${process.env.REACT_APP_CHANNEL}/${localStorage.getItem('contentSessionId')}-${Date.now()}-${getContentId}.wav`;

const command = new PutObjectCommand({
Bucket: process.env.REACT_APP_AWS_s3_BUCKET_NAME,
Expand All @@ -236,7 +236,7 @@ const VoiceCompair = props => {
}

response({ // Required
"target": process.env.REACT_APP_CAPTURE_AUDIO === 'true' ? `${process.env.REACT_APP_AWS_s3_BUCKET_URL}/${audioFileName}` : '', // Required. Target of the response
"target": process.env.REACT_APP_CAPTURE_AUDIO === 'true' ? `${audioFileName}` : '', // Required. Target of the response
//"qid": "", // Required. Unique assessment/question id
"type": "SPEAK", // Required. Type of response. CHOOSE, DRAG, SELECT, MATCH, INPUT, SPEAK, WRITE
"values": [
Expand Down
1 change: 1 addition & 0 deletions src/services/telementryService.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if (localStorage.getItem('contentSessionId') !== null) {
contentSessionId = localStorage.getItem('contentSessionId');
} else {
contentSessionId = uniqueId();
localStorage.setItem('contentSessionId', contentSessionId);
}

let getUrl = window.location.href;
Expand Down

0 comments on commit 0000bdf

Please sign in to comment.