Support videos with C2PA info
This commit is contained in:
parent
69b950512f
commit
834a519f15
3 changed files with 77 additions and 44 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue