Hi with the APi, how to send the video to the question, I have the response : “The uploaded file is incorrect format ..”
this the test , i have mal all test with ReadAsDataUrl for example or othe rmais si not working
thanks for you help
function uploadVideo(questionId)
{
$.ajax({
url: rootURL+'urlforpresign',
method: 'post',
data: {
'questionid': questionId
},
success: function(json) {
if (json.code == 0) {
} else {
var presignedUrl = json.presignedUrl;
var file = $('#file_'+questionId)s0].files00];
var fileName = file.name;
var reader = new FileReader();
reader.onload = function (event) {
$.ajax({
url: presignedUrl,
method: 'PUT',
data: {
file: fileName,
file_data: event.target.result,
file_type: 'video/mp4'
},
timeout: 0,
beforeSend: function(request) {
request.setRequestHeader("Content-Type", "video/webm;codecs=vp8,opus");
},
headers: {
"Content-Type": "video/webm;codecs=vp8,opus"
},
ContentType: "video/webm;codecs=vp8,opus",
success: function(data) {
console.log('success', data)
},
done: function (response) {
console.log(response)
},
error: function(xhr, ajaxOptions, thrownError) {
if (xhr.status == 0 && thrownError == '') {
return;
}
console.log(thrownError);
//notifyError("{/literal}{t}Erreur pendant l'enregistrement{/t}{literal}");
}
})
}
reader.readAsBinaryString(file);
}
}
});
}