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
@@ -278,33 +278,27 @@ export class NewPublicationPage implements OnInit {
} }
async loadVideo() { async loadVideo() {
const result = await FilePicker.pickMedia ({ multiple: true, });
const result = await FilePicker.pickMedia
({
multiple: true,
});
console.log(result.files) console.log(result.files)
result.files.forEach(async element => { result.files.forEach(async element => {
this.filesSizeSum = this.filesSizeSum + element.size this.filesSizeSum = this.filesSizeSum + element.size
if (this.fileSizeToMB(this.filesSizeSum) <= 20) { if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
console.log('pass size verificartion') console.log('pass size verificartion')
if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') { if (this.checkFileType.checkFileType(element.mimeType) == 'video' && this.platform.is('ios')) {
let resultUrl = decodeURIComponent(element.path); let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl)
console.log('pass type verification ', resultUrl)
try { try {
if(this.platform.is('ios')) {
this.recordevideoIos(resultUrl) this.recordevideoIos(resultUrl)
} else {
this.loadVideoAndroid(resultUrl,element)
}
} catch (error) { } catch (error) {
console.log('upload video error: ', error) 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);
console.log('pass type verification ', resultUrl)
try {
this.loadVideoAndroid(resultUrl,element)
} catch (error) {
console.log('upload video error: ', error)
}
} }
} else { } else {
if (this.seletedContent.length === 0) if (this.seletedContent.length === 0)
+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",