Dear community, I need your help.
Yesterday I implemented the tus video upload in a React based dashboard I’m crafting. I am using the tus js library from GitHub - tus/tus-js-client: A pure JavaScript client for the tus resumable upload protocol and the call seems to work. The only weird thing is that upon upload, I can see my video on Cloudflare, except the name is blank.
The call I’m making, where my intended filename is in the metadata object:
uploadHighlightTus(videoName, onProgress, onSuccess) {
var highlightVideoInputFile = document.getElementById("highlightVideo").files[0];
var upload = new tus.Upload(highlightVideoInputFile, {
endpoint: `https://api.cloudflare.com/client/v4/accounts/${this.accountId}/stream`,
retryDelays: [0, 3000, 5000, 10000, 20000],
metadata: {
filename: `highlight_${videoName.replace(/ /g, "_")}`,
filetype: highlightVideoInputFile.type
},
headers: {
'X-Auth-Email': this.accountEmail,
'X-Auth-Key': this.apiKey
},
chunkSize: 100 * 1024 * 1024,
onError: function (error) {
console.log("Failed because: " + error);
},
onProgress: function (bytesUploaded, bytesTotal) {
var percentage = Math.floor(bytesUploaded / bytesTotal * 100);
onProgress(percentage);
},
onSuccess: function () {
onSuccess();
}
});
upload.start();
}
Afterwards, the video appears on Cloudflare, with the name being empty (masked the content):
Do any of you have an idea of what might be going wrong? I have logged the filename to the console and it seems fine.