Support videos with C2PA info

This commit is contained in:
N-Pex 2025-11-14 13:00:06 +01:00
parent 69b950512f
commit 834a519f15
3 changed files with 77 additions and 44 deletions

View file

@ -45,23 +45,45 @@ onMounted(() => {
const a = attachment;
loadingProof.value = true;
metaStripped.value = true;
a.loadSrc()
.then((data) => {
if (data && data.data) {
return proofmode.proofCheckSource(data.data).then((res) => {
a.proof = res;
if (res?.integrity?.c2pa) {
// If we have proof, overwrite the flags
a.mediaMetadata = extractMediaMetadata(a.proof);
}
updateMetaStripped(a);
});
}
})
.catch(() => {})
.finally(() => {
loadingProof.value = false;
});
const isVideo = a.event.getContent().msgtype == "m.video";
if (isVideo) {
a.loadBlob()
.then((data) => {
if (data && data.data) {
return proofmode.proofCheckFile(new File([data.data], a.name)).then((res) => {
a.proof = res;
if (res?.integrity?.c2pa) {
// If we have proof, overwrite the flags
a.mediaMetadata = extractMediaMetadata(a.proof);
}
updateMetaStripped(a);
});
}
})
.catch(() => { })
.finally(() => {
loadingProof.value = false;
});
} else {
a.loadSrc()
.then((data) => {
if (data && data.data) {
return proofmode.proofCheckSource(data.data).then((res) => {
a.proof = res;
if (res?.integrity?.c2pa) {
// If we have proof, overwrite the flags
a.mediaMetadata = extractMediaMetadata(a.proof);
}
updateMetaStripped(a);
});
}
})
.catch(() => { })
.finally(() => {
loadingProof.value = false;
});
}
} else {
updateMetaStripped(attachment);
}