some changes

This commit is contained in:
Eudes Inácio
2023-11-13 10:59:36 +01:00
parent 28432cc874
commit a0b0aad4a6
10 changed files with 115 additions and 24 deletions
+7
View File
@@ -40,6 +40,13 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" /> <data android:mimeType="text/plain" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
+1 -1
View File
@@ -296,7 +296,7 @@ export class HomePage implements OnInit {
if (isActive) { if (isActive) {
/* sendIntent.setRouteService(this.router) */ /* sendIntent.setRouteService(this.router) */
console.log('App is in the foreground'); console.log('App is in the foreground');
this.checkSendIntentReceived() /* this.checkSendIntentReceived() */
} else { } else {
// The app is in the background. // The app is in the background.
console.log('App is in the background'); console.log('App is in the background');
@@ -36,8 +36,8 @@
<ion-img *ngIf="fileType == 'image/jpeg'" [(ngModel)]="capturedImage" name="image" ngDefaultControl [src]="capturedImage" (click)="imageSize(capturedImage)" ></ion-img> <ion-img *ngIf="fileType == 'image/jpeg'" [(ngModel)]="capturedImage" name="image" ngDefaultControl [src]="capturedImage" (click)="imageSize(capturedImage)" ></ion-img>
<video *ngIf="fileType == 'video/mp4'" height="80px" width="80px" playsinline controls preload="auto"> <video *ngIf="fileType == 'video'" width="70" height="70" controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline">
<source src="{{capturedVideo}}" type="video/mp4" > <source type="video/mp4" [src]="capturedVideo">
</video> </video>
</ion-thumbnail> </ion-thumbnail>
@@ -83,7 +83,12 @@
</div> </div>
</ion-label> </ion-label>
</div> </div>
<div *ngIf="photoOrVideo" class="ion-item-container-no-border"> <div *ngIf="photoOrVideo" class="container-multiselect">
<button id="container-multiselect" class="multiselect-button" (click)="takePicture()">Fotografia</button>
<button id="container-multiselect" class="multiselect-button" (click)="startVideoRecording()">Video</button>
</div>
<!-- <div *ngIf="photoOrVideo" class="ion-item-container-no-border">
<ion-label (click)="takePicture()"> <ion-label (click)="takePicture()">
<div class="attach-icon"> <div class="attach-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " <ion-icon *ngIf="ThemeService.currentTheme == 'default' "
@@ -110,7 +115,7 @@
<ion-label>Video</ion-label> <ion-label>Video</ion-label>
</div> </div>
</ion-label> </ion-label>
</div> </div> -->
<!-- <div class="ion-item-container-no-border"> <!-- <div class="ion-item-container-no-border">
<ion-label (click)="laodPicture()" class="cursor-pointer"> <ion-label (click)="laodPicture()" class="cursor-pointer">
@@ -57,6 +57,24 @@ ion-toolbar{
box-shadow: 0px 0px 18px rgba(0, 0, 0, 0.6); box-shadow: 0px 0px 18px rgba(0, 0, 0, 0.6);
overflow: auto; overflow: auto;
} }
.container-multiselect {
display: grid;
}
.multiselect-button {
border-radius: 3px;
width: 40%;
border: groove;
background-color: white;
}
.container button:last-child {
--border-radius: 50px;
width: 40%;
border: groove;
background-color: white;
}
.padding{ .padding{
padding: 25px 20px 0 20px; padding: 25px 20px 0 20px;
} }
@@ -141,6 +141,7 @@ export class NewPublicationPage implements OnInit {
ngOnInit() { ngOnInit() {
if (this.intent) { if (this.intent) {
this.filecontent = true
this.capturedImage = 'data:image/jpeg;base64,' + this.intent; this.capturedImage = 'data:image/jpeg;base64,' + this.intent;
} }
@@ -151,8 +152,12 @@ export class NewPublicationPage implements OnInit {
recursive: true recursive: true
}); });
document.addEventListener("click", clickOutside, false);
// this.takePicture(); function clickOutside(e) {
const inside = document.getElementById('container-multiselect').contains(e.target);
this.photoOrVideo = false;
console.log(this.photoOrVideo)
}
} }
// in use // in use
@@ -210,19 +215,25 @@ export class NewPublicationPage implements OnInit {
const data = await this.mediaCapture.captureVideo(options) const data = await this.mediaCapture.captureVideo(options)
this.video = data[0]; this.video = data[0];
console.log(data) console.log(data)
const originalFilePath = 'file:///storage/emulated/0/DCIM/Camera/20231110_125118.mp4'; const savedFile = await Filesystem.copy({
const mediaFile = new Media(); from: data[0].fullPath, // directory prop removed, Capacitor parses filename for us
mediaFile.create(data[0].fullPath) to: "video.mp4",
console.log(mediaFile) toDirectory: FilesystemDirectory.Data
this.mediaFileToBase64(data[0])
.then((base64Data) => {
console.log('Base64 data:', base64Data);
// Now you can use the base64 data as needed
})
.catch((error) => {
console.error('Error converting to base64:', error);
// Handle errors
}); });
console.log(savedFile.uri)
Filesystem.readFile({ path: savedFile.uri })
.then(async (content) => {
console.log(content)
this.filecontent = true;
this.fileType = "video"
this.capturedVideo = content.data;
console.log(this.capturedVideo)
})
.catch((err) => console.error(err));
} catch (error) { } catch (error) {
@@ -651,4 +662,6 @@ export class NewPublicationPage implements OnInit {
} }
} }
@@ -133,7 +133,9 @@ export class PublicationsPage implements OnInit {
} }
close() { close() {
this.modalController.dismiss(); window["sharedContent"] = null;
this.intent = null;
this.router.navigateByUrl("/home/");
} }
get windowInnerWidth(): number { get windowInnerWidth(): number {
return window.innerWidth return window.innerWidth
@@ -43,10 +43,14 @@
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index"> <ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index">
<ion-card-content> <ion-card-content>
<div (click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)" class="post-img" > <div *ngIf="publication.FileExtension != 'mp4'" (click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)" class="post-img" >
<img *ngIf="publication.FileExtension != 'mp4'" [lazyLoad]="publication.FileBase64"> <img [lazyLoad]="publication.FileBase64">
<video *ngIf="publication.FileExtension == 'mp4'" controls="controls" preload="metadata" webkit-playsinline="webkit-playsinline"> </div>
<div *ngIf="publication.FileExtension == 'mp4'" (click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)" class="post-video" >
<video controls="controls" preload="metadata" webkit-playsinline="webkit-playsinline">
<source src="{{publication.FileBase64}}" type="video/mp4"> <source src="{{publication.FileBase64}}" type="video/mp4">
</video> </video>
@@ -141,6 +141,27 @@
background: black; background: black;
} }
.post-video{
width: 100%;
height: 100%;
max-height: 400px;
min-height: 350px;
min-width: 350px;
margin: 5px auto;
border-radius: 0px !important;
overflow: hidden;
background-color: white;
display: flex;
justify-content: center;
background: black;
}
video{
max-width: -webkit-fill-available;
}
.post-img img{ .post-img img{
height: 100%; height: 100%;
max-height: 420px; max-height: 420px;
@@ -43,7 +43,7 @@
<img [lazyLoad]="publication.FileBase64"> <img [lazyLoad]="publication.FileBase64">
</div> </div>
<div *ngIf="publication.FileExtension == 'mp4'" class="post-img cursor-pointer" (click)="viewPublicationDetail(publication.DocumentId, publication.ProcessId)"> <div *ngIf="publication.FileExtension == 'mp4'" class="post-video cursor-pointer" (click)="viewPublicationDetail(publication.DocumentId, publication.ProcessId)">
<video controls="controls" preload="metadata" webkit-playsinline="webkit-playsinline" class="videoPlayer"> <video controls="controls" preload="metadata" webkit-playsinline="webkit-playsinline" class="videoPlayer">
<source [src]="publication.FileBase64" type="video/mp4" /> <source [src]="publication.FileBase64" type="video/mp4" />
</video> </video>
@@ -166,6 +166,27 @@
align-items: center; align-items: center;
background: black; background: black;
}
.post-video{
width: 100%;
height: 100%;
max-height: 500px;
max-width: 468px;
min-height: 350px;
min-width: 468px;
margin: 5px auto;
border-radius: 0px !important;
overflow: hidden;
background-color: white;
display: flex;
justify-content: center;
background: black;
align-items: self-end;
} }
.post-img img{ .post-img img{
height: 100%; height: 100%;