recette2
parent
a6a62132b0
commit
5e7b596317
|
@ -910,6 +910,8 @@ const TestUrl_New = (props) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append("file", audiofile);
|
formData.append("file", audiofile);
|
||||||
|
const stored_cookie = getCookie('tokenmysypart');
|
||||||
|
formData.append("token", stored_cookie);
|
||||||
|
|
||||||
var api_url = process.env.REACT_APP_API_URL + "myclass/api/mysy_openai_get_voice_file/";
|
var api_url = process.env.REACT_APP_API_URL + "myclass/api/mysy_openai_get_voice_file/";
|
||||||
/*
|
/*
|
||||||
|
@ -926,7 +928,6 @@ const TestUrl_New = (props) => {
|
||||||
// On efface l'_id de l'instruction en cours
|
// On efface l'_id de l'instruction en cours
|
||||||
setcollection_instruction_id("");
|
setcollection_instruction_id("");
|
||||||
|
|
||||||
console.log(" #### formData = ", formData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
|
@ -942,6 +943,9 @@ const TestUrl_New = (props) => {
|
||||||
console.log('send_audio_file_to_server_blob message == :', result['message']);
|
console.log('send_audio_file_to_server_blob message == :', result['message']);
|
||||||
console.log('send_audio_file_to_server_blob collection_instruction_id == :', result['collection_instruction_id']);
|
console.log('send_audio_file_to_server_blob collection_instruction_id == :', result['collection_instruction_id']);
|
||||||
console.log('send_audio_file_to_server_blob result == :', result);
|
console.log('send_audio_file_to_server_blob result == :', result);
|
||||||
|
if (result['repeat_instruction']) {
|
||||||
|
console.log('repeat_instruction repeat_instruction repeat_instruction == zz', result['repeat_instruction']);
|
||||||
|
}
|
||||||
//setisimgSelected(false);
|
//setisimgSelected(false);
|
||||||
|
|
||||||
|
|
||||||
|
@ -952,10 +956,16 @@ const TestUrl_New = (props) => {
|
||||||
let local_audio_file = new Audio(document_mp3);
|
let local_audio_file = new Audio(document_mp3);
|
||||||
local_audio_file.play();
|
local_audio_file.play();
|
||||||
}
|
}
|
||||||
|
if (result['repeat_instruction'] && result['repeat_instruction'] === "1" && result['collection_instruction_id']) {
|
||||||
if (result['collection_instruction_id']) {
|
|
||||||
setcollection_instruction_id(result['collection_instruction_id']);
|
setcollection_instruction_id(result['collection_instruction_id']);
|
||||||
}else{
|
}
|
||||||
|
else if (result['repeat_instruction'] && result['repeat_instruction'] !== "1" ) {
|
||||||
|
setcollection_instruction_id("");
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (result['collection_instruction_id']) {
|
||||||
|
setcollection_instruction_id(result['collection_instruction_id']);
|
||||||
|
} else {
|
||||||
setcollection_instruction_id("");
|
setcollection_instruction_id("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,7 +977,7 @@ const TestUrl_New = (props) => {
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
console.error('Error - send_audi_blob:');
|
console.error('Error - send_audi_blob:', error);
|
||||||
// setisimgSelected(true);
|
// setisimgSelected(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1243,33 +1253,18 @@ const TestUrl_New = (props) => {
|
||||||
|
|
||||||
<div style={{ width: '50%', margin: 'auto' }}>
|
<div style={{ width: '50%', margin: 'auto' }}>
|
||||||
collection_instruction_id = '{collection_instruction_id}' <br />
|
collection_instruction_id = '{collection_instruction_id}' <br />
|
||||||
{ String(collection_instruction_id).length > 5 && <nav> Confirmation instruction en cours</nav>}
|
{String(collection_instruction_id).length > 5 && <nav> Confirmation instruction en cours</nav>}
|
||||||
{ String(collection_instruction_id).length <= 5 && <nav> Enregistrer une instruction </nav>}
|
{String(collection_instruction_id).length <= 5 && <nav> Enregistrer une instruction </nav>}
|
||||||
|
|
||||||
<AudioRecorder
|
<AudioRecorder
|
||||||
onRecordingComplete={(blob) => addAudioElement(blob)}
|
onRecordingComplete={(blob) => addAudioElement(blob)}
|
||||||
recorderControls={recorderControls}
|
recorderControls={recorderControls}
|
||||||
// downloadOnSavePress={true}
|
// downloadOnSavePress={true}
|
||||||
downloadFileExtension="mp3"
|
downloadFileExtension="mp3"
|
||||||
showVisualizer="false"
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
|
||||||
<button onClick={recorderControls.stopRecording}>Stop recording</button>
|
|
||||||
<br />
|
|
||||||
|
|
||||||
file = {blob_recorded_file} <br />
|
|
||||||
<button onClick={send_audio_file_to_server_blob}> envoyer fichier</button><br />
|
|
||||||
<button onClick={Get_and_launch_audio_file}> recuperer un fichier audio yy</button><br />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div> <br />
|
|
||||||
<button onClick={handleClick_play}>Boop!</button>;
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue