mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
bugs before presantation
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && checkTableDivice() == true" width="70" height="70"
|
||||
preload="metadata" webkit-playsinline="webkit-playsinline">
|
||||
<source type="video/mp4" [src]="'data:video/mp4;base64,' +seleted.FileBase64">
|
||||
<source type="video/mp4" [src]="seleted.FileBase64">
|
||||
</video>
|
||||
|
||||
|
||||
|
||||
@@ -258,26 +258,26 @@ export class NewPublicationPage implements OnInit {
|
||||
multiple: true,
|
||||
});
|
||||
|
||||
console.log(result)
|
||||
console.log(result)
|
||||
|
||||
result.files.forEach(async blobFile => {
|
||||
console.log(blobFile)
|
||||
if (this.checkFileType.checkFileType(blobFile.mimeType) == 'image' || this.checkFileType.checkFileType(blobFile.mimeType) == 'video') {
|
||||
/* console.log('converte new way',this.getBase64(blobFile)) */
|
||||
/* console.log('converte new way',this.getBase64(blobFile)) */
|
||||
|
||||
/* const blob = await fetch(
|
||||
Capacitor.convertFileSrc(blobFile.path)
|
||||
).then(r => r.blob()); */
|
||||
/* const blob = await fetch(
|
||||
Capacitor.convertFileSrc(blobFile.path)
|
||||
).then(r => r.blob()); */
|
||||
|
||||
/* console.log(await blob.arrayBuffer());
|
||||
|
||||
|
||||
/* console.log(await blob.arrayBuffer());
|
||||
|
||||
|
||||
console.log("base64 :data:video/mp4;base64,",this.arrayBufferToBase64(await blob.arrayBuffer())) */
|
||||
|
||||
console.log("base64 :data:video/mp4;base64,",this.arrayBufferToBase64(await blob.arrayBuffer())) */
|
||||
|
||||
this.convertBlobToBase64(blobFile.blob).then((value) => {
|
||||
|
||||
console.log(value)
|
||||
console.log(this.removeTextBeforeSlash(value, ','))
|
||||
|
||||
this.filesSizeSum = this.filesSizeSum + blobFile.size
|
||||
if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
|
||||
@@ -288,7 +288,7 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: value,
|
||||
base64: this.removeTextBeforeSlash(value, ','),
|
||||
extension: FileExtension,
|
||||
blobFile: file,
|
||||
FileType: this.checkFileType.checkFileType(FileExtension)
|
||||
@@ -315,7 +315,7 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
|
||||
@@ -347,7 +347,7 @@ export class NewPublicationPage implements OnInit {
|
||||
({
|
||||
multiple: true,
|
||||
});
|
||||
console.log(result.files)
|
||||
console.log(result.files)
|
||||
result.files.forEach(element => {
|
||||
|
||||
this.filesSizeSum = this.filesSizeSum + element.size
|
||||
@@ -359,15 +359,16 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
.then(async (content) => {
|
||||
console.log(result)
|
||||
console.log('load video tablet base64',content)
|
||||
console.log('load video tablet base64', content)
|
||||
this.filecontent = true;
|
||||
let fileObject = new PublicationAttachmentEntity ({
|
||||
let fileObject = new PublicationAttachmentEntity({
|
||||
base64: content.data,
|
||||
extension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
OriginalFileName: 'video',
|
||||
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/'))
|
||||
FileType: this.checkFileType.checkFileType(this.removeTextBeforeSlash(element.mimeType, '/'))
|
||||
})
|
||||
this.seletedContent.push(fileObject)
|
||||
console.log('Files array',this.seletedContent)
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
} catch (error) {
|
||||
@@ -607,17 +608,59 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
|
||||
convertBlobToBase64(blob: Blob) {
|
||||
console.log('Convert blob ',blob)
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader;
|
||||
reader.onerror = reject;
|
||||
reader.onload = () => {
|
||||
resolve(reader.result)
|
||||
}
|
||||
reader.readAsDataURL(blob)
|
||||
},)
|
||||
try {
|
||||
return new Promise((resolve, reject) => {
|
||||
const chunkSize = 5000000; // 5 MB
|
||||
const fileSize = blob.size;
|
||||
const chunks = Math.ceil(fileSize / chunkSize);
|
||||
let currentChunk = 0;
|
||||
const base64Chunks = [];
|
||||
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = function () {
|
||||
base64Chunks.push(reader.result);
|
||||
currentChunk++;
|
||||
|
||||
if (currentChunk < chunks) {
|
||||
loadNextChunk();
|
||||
} else {
|
||||
const base64Data = base64Chunks.join("");
|
||||
resolve(base64Data);
|
||||
}
|
||||
};
|
||||
|
||||
reader.onerror = function (error) {
|
||||
reject(error);
|
||||
};
|
||||
|
||||
function loadNextChunk() {
|
||||
const start = currentChunk * chunkSize;
|
||||
const end = Math.min(start + chunkSize, fileSize);
|
||||
const chunk = blob.slice(start, end);
|
||||
reader.readAsDataURL(chunk);
|
||||
}
|
||||
|
||||
loadNextChunk();
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* convertBlobToBase64(blob: Blob) {
|
||||
console.log('Convert blob ',blob)
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader;
|
||||
reader.onerror = reject;
|
||||
reader.onload = () => {
|
||||
resolve(reader.result)
|
||||
}
|
||||
reader.readAsDataURL(blob)
|
||||
},)
|
||||
} */
|
||||
|
||||
getBase64(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
@@ -625,7 +668,7 @@ export class NewPublicationPage implements OnInit {
|
||||
reader.onload = () => resolve(reader.result);
|
||||
reader.onerror = error => reject(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
removeTextBeforeSlash(inputString, mark) {
|
||||
if (inputString.includes(mark)) {
|
||||
@@ -1002,7 +1045,7 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
.then(async (content) => {
|
||||
this.filecontent = true;
|
||||
console.log('',content)
|
||||
console.log('', content)
|
||||
let fileObject = new PublicationAttachmentEntity({
|
||||
base64: content.data,
|
||||
extension: 'mp4',
|
||||
@@ -1028,7 +1071,7 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
|
||||
checkTableDivice() {
|
||||
if (!this.platform.is('desktop'))
|
||||
if (this.platform.is('tablet'))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -225,6 +225,7 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
if (!found) {
|
||||
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
|
||||
this.publicationFolderService.revertPublicationOrder(folderId)
|
||||
} else {
|
||||
|
||||
let a: any = Object.assign({},this.publicationFolderService.publicationList[folderId][findIndex])
|
||||
|
||||
Reference in New Issue
Block a user