upload image as video on publication solved

This commit is contained in:
Equilibrium ITO
2024-03-11 16:05:59 +01:00
parent c49cd411e3
commit 689a6299cc
2 changed files with 30 additions and 36 deletions
@@ -277,43 +277,37 @@ export class NewPublicationPage implements OnInit {
} }
} }
async loadVideo() { async loadVideo() {
const result = await FilePicker.pickMedia ({ multiple: true, });
const result = await FilePicker.pickMedia console.log(result.files)
({ result.files.forEach(async element => {
multiple: true, this.filesSizeSum = this.filesSizeSum + element.size
}); if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
console.log(result.files) console.log('pass size verificartion')
result.files.forEach(async element => { if (this.checkFileType.checkFileType(element.mimeType) == 'video' && this.platform.is('ios')) {
let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl)
this.filesSizeSum = this.filesSizeSum + element.size try {
if (this.fileSizeToMB(this.filesSizeSum) <= 20) { this.recordevideoIos(resultUrl)
console.log('pass size verificartion') } catch (error) {
if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') { console.log('upload video error: ', error)
}
} else if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') {
let resultUrl = decodeURIComponent(element.path); let resultUrl = decodeURIComponent(element.path);
console.log('pass type verification ', resultUrl) console.log('pass type verification ', resultUrl)
try {
this.loadVideoAndroid(resultUrl,element)
} catch (error) {
console.log('upload video error: ', error)
}
}
} else {
if (this.seletedContent.length === 0)
this.filesSizeSum = 0
try { this.httpErrorHandle.validationMessagge('filessize')
}
if(this.platform.is('ios')) { });
this.recordevideoIos(resultUrl) };
} else {
this.loadVideoAndroid(resultUrl,element)
}
} catch (error) {
console.log('upload video error: ', error)
}
}
} else {
if (this.seletedContent.length === 0)
this.filesSizeSum = 0
this.httpErrorHandle.validationMessagge('filessize')
}
});
};
chossePhotoOrVideo() { chossePhotoOrVideo() {
+1 -1
View File
@@ -68,7 +68,7 @@ export class AttachmentsService {
downloadFile(guid: any) { downloadFile(guid: any) {
let downloadUrl = environment.apiURL + 'objectserver/streamfiles?path=' + guid; let downloadUrl = environment.apiURL + 'objectserver/StreamChatFiles?path=' + guid;
var name = new Date().getTime(); var name = new Date().getTime();
return this.http.get(downloadUrl, { return this.http.get(downloadUrl, {
responseType: "arraybuffer", responseType: "arraybuffer",