mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
merge
This commit is contained in:
@@ -209,36 +209,31 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
|
||||
this.capturedImageTitle = 'foto';
|
||||
if (this.fileSizeToMB(capturedImage.base64String.length) <= 20) {
|
||||
const compressedImage = await this.compressImageBase64(
|
||||
this.capturedImage,
|
||||
800, // maxWidth
|
||||
800, // maxHeight
|
||||
0.9 // quality
|
||||
).then((picture) => {
|
||||
console.log('take picture', this.removeTextBeforeSlash(picture, ','),)
|
||||
this.filecontent = true;
|
||||
this.photoOrVideo = false;
|
||||
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: this.removeTextBeforeSlash(picture, ','),
|
||||
extension: capturedImage.format,
|
||||
OriginalFileName: "image",
|
||||
FileType: 'image'
|
||||
}
|
||||
)
|
||||
const compressedImage = await this.compressImageBase64(
|
||||
this.capturedImage,
|
||||
800, // maxWidth
|
||||
800, // maxHeight
|
||||
0.9 // quality
|
||||
).then((picture) => {
|
||||
console.log('take picture', this.removeTextBeforeSlash(picture, ','),)
|
||||
this.filecontent = true;
|
||||
this.photoOrVideo = false;
|
||||
|
||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: this.removeTextBeforeSlash(picture, ','),
|
||||
extension: capturedImage.format,
|
||||
OriginalFileName: "image",
|
||||
FileType: 'image'
|
||||
}
|
||||
)
|
||||
|
||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||
|
||||
|
||||
});
|
||||
} else {
|
||||
if (this.PublicationFromMvService.form.Files.length === 0)
|
||||
this.filesSizeSum = 0
|
||||
});
|
||||
|
||||
this.httpErrorHandle.validationMessagge('filessize');
|
||||
}
|
||||
}
|
||||
|
||||
async laodPicture() {
|
||||
@@ -271,26 +266,19 @@ export class NewPublicationPage implements OnInit {
|
||||
console.log('video record', data)
|
||||
data.forEach(async element => {
|
||||
this.filesSizeSum = this.filesSizeSum + element.size
|
||||
if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
|
||||
|
||||
try {
|
||||
if (this.platform.is('ios')) {
|
||||
this.recordevideoIos(element.fullPath, element)
|
||||
} else {
|
||||
this.recordVideoAndroid(element.fullPath, element)
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Unable to write file', e);
|
||||
}
|
||||
|
||||
// element.size
|
||||
try {
|
||||
if (this.platform.is('ios')) {
|
||||
this.recordevideoIos(element.fullPath, element)
|
||||
} else {
|
||||
if (this.PublicationFromMvService.form.Files.length === 0)
|
||||
this.filesSizeSum = 0
|
||||
|
||||
this.httpErrorHandle.validationMessagge('filessize')
|
||||
this.recordVideoAndroid(element.fullPath, element)
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Unable to write file', e);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('record video error: ', error)
|
||||
@@ -616,41 +604,41 @@ export class NewPublicationPage implements OnInit {
|
||||
if (this.checkFileType.checkFileType(FileExtension) == 'image' || this.checkFileType.checkFileType(FileExtension) == 'video') {
|
||||
let resultUrl = decodeURIComponent(element.url);
|
||||
|
||||
if(this.platform.is('ios')) {
|
||||
if (this.platform.is('ios')) {
|
||||
const stringGerada = this.gerarStringAleatoria();
|
||||
console.log(stringGerada);
|
||||
this.shareContentIso(resultUrl,FileExtension,stringGerada)
|
||||
console.log(stringGerada);
|
||||
this.shareContentIso(resultUrl, FileExtension, stringGerada)
|
||||
} else {
|
||||
this.shareContentAndroid(resultUrl,FileExtension)
|
||||
this.shareContentAndroid(resultUrl, FileExtension)
|
||||
}
|
||||
|
||||
/*
|
||||
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||
let fileObject;
|
||||
try {
|
||||
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
||||
fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
/*
|
||||
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||
let fileObject;
|
||||
try {
|
||||
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
||||
fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
|
||||
} else if (this.checkFileType.checkFileType(FileExtension) == 'video') {
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
} else if (this.checkFileType.checkFileType(FileExtension) == 'video') {
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
|
||||
}
|
||||
console.log('shared base', content.data)
|
||||
}
|
||||
console.log('shared base', content.data)
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
} catch (error) {
|
||||
console.log('error shared filesystem', error)
|
||||
}
|
||||
this.seletedContent.push(fileObject)
|
||||
} catch (error) {
|
||||
console.log('error shared filesystem', error)
|
||||
}
|
||||
|
||||
}) */
|
||||
}) */
|
||||
} else {
|
||||
this.httpErrorHandle.validationMessagge('filetype');
|
||||
}
|
||||
@@ -768,7 +756,7 @@ console.log(stringGerada);
|
||||
|
||||
}
|
||||
|
||||
loadVideoAndroid(resultUrl,element) {
|
||||
loadVideoAndroid(resultUrl, element) {
|
||||
Filesystem.readFile({ path: resultUrl })
|
||||
|
||||
.then(async (content) => {
|
||||
@@ -809,7 +797,7 @@ console.log(stringGerada);
|
||||
|
||||
}
|
||||
|
||||
gerarStringAleatoria() {
|
||||
gerarStringAleatoria() {
|
||||
const caracteres = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
let stringAleatoria = '';
|
||||
|
||||
@@ -821,7 +809,7 @@ console.log(stringGerada);
|
||||
return stringAleatoria;
|
||||
}
|
||||
|
||||
async shareContentIso(fullPath,FileExtension,filename) {
|
||||
async shareContentIso(fullPath, FileExtension, filename) {
|
||||
try {
|
||||
|
||||
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
||||
@@ -829,11 +817,11 @@ console.log(stringGerada);
|
||||
Filesystem.readFile({ path: fullPath }).then(async (content) => {
|
||||
let fileObject;
|
||||
try {
|
||||
fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
console.log('shared base', content.data)
|
||||
|
||||
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||
@@ -848,13 +836,13 @@ console.log(stringGerada);
|
||||
path: '',
|
||||
});
|
||||
|
||||
let fileObject ={};
|
||||
this.videoconvertService.convertVideo(fullPath,directory.uri,filename,'mp4').then(async () => {
|
||||
await Filesystem.readFile({ path: `${directory.uri}${filename}.mp4`})
|
||||
let fileObject = {};
|
||||
this.videoconvertService.convertVideo(fullPath, directory.uri, filename, 'mp4').then(async () => {
|
||||
await Filesystem.readFile({ path: `${directory.uri}${filename}.mp4` })
|
||||
|
||||
.then(async (content) => {
|
||||
console.log(content.data)
|
||||
this.filecontent = true;
|
||||
.then(async (content) => {
|
||||
console.log(content.data)
|
||||
this.filecontent = true;
|
||||
/* fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: 'mp4',
|
||||
@@ -883,26 +871,27 @@ console.log(stringGerada);
|
||||
console.log('delete file',value)
|
||||
fileObject ={};
|
||||
})
|
||||
})
|
||||
.catch((erro) => console.error('read converted video erro ', erro));
|
||||
.catch((erro) => console.error('read converted video erro ', erro));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.log('record video ios erro, ', error)
|
||||
console.log('record video ios erro, ', error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
shareContentAndroid(resultUrl,FileExtension) {
|
||||
|
||||
shareContentAndroid(resultUrl, FileExtension) {
|
||||
|
||||
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||
let fileObject;
|
||||
try {
|
||||
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
||||
fileObject = {
|
||||
FileBase64: 'data:image/jpeg;base64,' +this.removeTextBeforeSlash(content.data, ','),
|
||||
FileBase64: 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
src="{{'data:image/jpg;base64,' + files.FileBase64}}">
|
||||
|
||||
<video *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="metadata"
|
||||
webkit-playsinline="webkit-playsinline" (play)="StopvideoService.registerVideoWithEvent($event)" >
|
||||
playsinline webkit-playsinline="webkit-playsinline" (play)="StopvideoService.registerVideoWithEvent($event)" >
|
||||
<source [src]="files.FileBase64" type="video/mp4">
|
||||
</video>
|
||||
|
||||
|
||||
+20
-2
@@ -56,14 +56,32 @@ ion-toolbar {
|
||||
|
||||
.post-img {
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
height: 100%;
|
||||
|
||||
max-height: 400px;
|
||||
min-height: 350px;
|
||||
min-width: 350px;
|
||||
margin: 0 auto;
|
||||
border-radius: 0px !important;
|
||||
overflow: hidden;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.post-video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
max-height: 400px;
|
||||
min-height: 350px;
|
||||
min-width: 350px;
|
||||
margin: 0 auto;
|
||||
border-radius: 0px !important;
|
||||
overflow: hidden;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: 420px;
|
||||
}
|
||||
.post-img img {
|
||||
height: 100%;
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
[lazyLoad]="'data:image/jpg;base64,' + files.FileBase64">
|
||||
|
||||
<video #videoElement [appVisibility]="onVisibilityChange" *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="metadata"
|
||||
webkit-playsinline="webkit-playsinline" (play)="stopvideoService.registerVideoWithEvent($event)" (click)="preventVideoPlay($event)">
|
||||
<source [src]="files.FileBase64" type="video/mp4">
|
||||
playsinline webkit-playsinline="webkit-playsinline" (play)="stopvideoService.registerVideoWithEvent($event)" (click)="preventVideoPlay($event)">
|
||||
<source [src]="files.FileBase64" type="video/mp4" >
|
||||
</video>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user