mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
ios shared works on ipad
This commit is contained in:
@@ -31,6 +31,7 @@ def capacitor_pods
|
|||||||
pod 'CapacitorVoiceRecorder', :path => '../../node_modules/capacitor-voice-recorder'
|
pod 'CapacitorVoiceRecorder', :path => '../../node_modules/capacitor-voice-recorder'
|
||||||
pod 'SendIntent', :path => '../../node_modules/send-intent'
|
pod 'SendIntent', :path => '../../node_modules/send-intent'
|
||||||
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
|
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
|
||||||
|
pod 'CordovaPluginsStatic', :path => '../capacitor-cordova-ios-plugins'
|
||||||
pod 'CordovaPluginsResources', :path => '../capacitor-cordova-ios-plugins'
|
pod 'CordovaPluginsResources', :path => '../capacitor-cordova-ios-plugins'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Generated
+31
-23
@@ -29,6 +29,7 @@
|
|||||||
"@angular/router": "~12.1.2",
|
"@angular/router": "~12.1.2",
|
||||||
"@awesome-cordova-plugins/core": "^5.40.0",
|
"@awesome-cordova-plugins/core": "^5.40.0",
|
||||||
"@awesome-cordova-plugins/document-viewer": "^5.41.0",
|
"@awesome-cordova-plugins/document-viewer": "^5.41.0",
|
||||||
|
"@awesome-cordova-plugins/ffmpeg": "^6.6.0",
|
||||||
"@awesome-cordova-plugins/file": "^5.41.0",
|
"@awesome-cordova-plugins/file": "^5.41.0",
|
||||||
"@awesome-cordova-plugins/file-opener": "^5.41.0",
|
"@awesome-cordova-plugins/file-opener": "^5.41.0",
|
||||||
"@awesome-cordova-plugins/media-capture": "^6.4.0",
|
"@awesome-cordova-plugins/media-capture": "^6.4.0",
|
||||||
@@ -116,6 +117,7 @@
|
|||||||
"cordova": "^11.0.0",
|
"cordova": "^11.0.0",
|
||||||
"cordova-plugin-crop": "^0.4.0",
|
"cordova-plugin-crop": "^0.4.0",
|
||||||
"cordova-plugin-document-viewer": "^1.0.0",
|
"cordova-plugin-document-viewer": "^1.0.0",
|
||||||
|
"cordova-plugin-ffmpeg": "github:MaximBelov/cordova-plugin-ffmpeg",
|
||||||
"cordova-plugin-file": "^6.0.2",
|
"cordova-plugin-file": "^6.0.2",
|
||||||
"cordova-plugin-file-opener2": "^3.0.5",
|
"cordova-plugin-file-opener2": "^3.0.5",
|
||||||
"cordova-plugin-file-transfer": "github:apache/cordova-plugin-file-transfer",
|
"cordova-plugin-file-transfer": "github:apache/cordova-plugin-file-transfer",
|
||||||
@@ -206,7 +208,6 @@
|
|||||||
"cordova-plugin-androidx-adapter": "^1.1.3",
|
"cordova-plugin-androidx-adapter": "^1.1.3",
|
||||||
"cordova-plugin-device": "^2.0.2",
|
"cordova-plugin-device": "^2.0.2",
|
||||||
"cordova-plugin-dialogs": "^2.0.2",
|
"cordova-plugin-dialogs": "^2.0.2",
|
||||||
"cordova-plugin-fingerprint-aio": "^4.0.2",
|
|
||||||
"cordova-plugin-globalization": "^1.11.0",
|
"cordova-plugin-globalization": "^1.11.0",
|
||||||
"cordova-plugin-inappbrowser": "^4.0.0",
|
"cordova-plugin-inappbrowser": "^4.0.0",
|
||||||
"cordova-plugin-media": "^5.0.4",
|
"cordova-plugin-media": "^5.0.4",
|
||||||
@@ -1869,6 +1870,18 @@
|
|||||||
"rxjs": "^5.5.0 || ^6.5.0 || ^7.3.0"
|
"rxjs": "^5.5.0 || ^6.5.0 || ^7.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@awesome-cordova-plugins/ffmpeg": {
|
||||||
|
"version": "6.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/ffmpeg/-/ffmpeg-6.6.0.tgz",
|
||||||
|
"integrity": "sha512-Js27Q1+ehahZddmsrpewq6Luo7yunNQwSWDlKZEb/HXxzBe/mXXJQI0W1BgL2IZkG/PGsoR1Vqk65WhV/+1ZSA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/cordova": "latest"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@awesome-cordova-plugins/core": "^6.0.1",
|
||||||
|
"rxjs": "^5.5.0 || ^6.5.0 || ^7.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@awesome-cordova-plugins/file": {
|
"node_modules/@awesome-cordova-plugins/file": {
|
||||||
"version": "5.41.0",
|
"version": "5.41.0",
|
||||||
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/file/-/file-5.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/file/-/file-5.41.0.tgz",
|
||||||
@@ -12703,6 +12716,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cordova-plugin-ffmpeg": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "git+ssh://git@github.com/MaximBelov/cordova-plugin-ffmpeg.git#535a64e437f81b34bacf090da7fc97e6754189c7",
|
||||||
|
"license": "Apache-2"
|
||||||
|
},
|
||||||
"node_modules/cordova-plugin-file": {
|
"node_modules/cordova-plugin-file": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-6.0.2.tgz",
|
||||||
@@ -12745,22 +12763,6 @@
|
|||||||
"integrity": "sha512-DwKuH5tXhZJImU/rHDzQhG3bY2ihAUw5QqdNllso96MZ9TQTAbFvKPLppuJwx21XxYS2g3uB9R17AXEEme+sKA==",
|
"integrity": "sha512-DwKuH5tXhZJImU/rHDzQhG3bY2ihAUw5QqdNllso96MZ9TQTAbFvKPLppuJwx21XxYS2g3uB9R17AXEEme+sKA==",
|
||||||
"deprecated": "No longer maintained"
|
"deprecated": "No longer maintained"
|
||||||
},
|
},
|
||||||
"node_modules/cordova-plugin-fingerprint-aio": {
|
|
||||||
"version": "4.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-fingerprint-aio/-/cordova-plugin-fingerprint-aio-4.0.2.tgz",
|
|
||||||
"integrity": "sha512-Mmm/Ee85s4JH7qL3yikQ2J2I2vY2XbNi1fttoEK2kI++YHr/WeqPHWGREFL7bmFYjZTph/JovhfWHPGV924WjQ==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"cordovaDependencies": {
|
|
||||||
">=3.0.0": {
|
|
||||||
"cordova-android": ">=8.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/NiklasMerz"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cordova-plugin-globalization": {
|
"node_modules/cordova-plugin-globalization": {
|
||||||
"version": "1.11.0",
|
"version": "1.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-globalization/-/cordova-plugin-globalization-1.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-globalization/-/cordova-plugin-globalization-1.11.0.tgz",
|
||||||
@@ -45037,6 +45039,14 @@
|
|||||||
"@types/cordova": "latest"
|
"@types/cordova": "latest"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@awesome-cordova-plugins/ffmpeg": {
|
||||||
|
"version": "6.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/ffmpeg/-/ffmpeg-6.6.0.tgz",
|
||||||
|
"integrity": "sha512-Js27Q1+ehahZddmsrpewq6Luo7yunNQwSWDlKZEb/HXxzBe/mXXJQI0W1BgL2IZkG/PGsoR1Vqk65WhV/+1ZSA==",
|
||||||
|
"requires": {
|
||||||
|
"@types/cordova": "latest"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@awesome-cordova-plugins/file": {
|
"@awesome-cordova-plugins/file": {
|
||||||
"version": "5.41.0",
|
"version": "5.41.0",
|
||||||
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/file/-/file-5.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/file/-/file-5.41.0.tgz",
|
||||||
@@ -53472,6 +53482,10 @@
|
|||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-document-viewer/-/cordova-plugin-document-viewer-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-document-viewer/-/cordova-plugin-document-viewer-1.0.0.tgz",
|
||||||
"integrity": "sha512-LQZiWVU543rLJ0wYoawSdMrAfoxBLWCx8a2CuQjFeav4U9CN16QAh1VHetHaHicp5ZEwTC7Zq/0TNbak6A7bVw=="
|
"integrity": "sha512-LQZiWVU543rLJ0wYoawSdMrAfoxBLWCx8a2CuQjFeav4U9CN16QAh1VHetHaHicp5ZEwTC7Zq/0TNbak6A7bVw=="
|
||||||
},
|
},
|
||||||
|
"cordova-plugin-ffmpeg": {
|
||||||
|
"version": "git+ssh://git@github.com/MaximBelov/cordova-plugin-ffmpeg.git#535a64e437f81b34bacf090da7fc97e6754189c7",
|
||||||
|
"from": "cordova-plugin-ffmpeg@github:MaximBelov/cordova-plugin-ffmpeg"
|
||||||
|
},
|
||||||
"cordova-plugin-file": {
|
"cordova-plugin-file": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-6.0.2.tgz",
|
||||||
@@ -53492,12 +53506,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-filepath/-/cordova-plugin-filepath-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-filepath/-/cordova-plugin-filepath-1.6.0.tgz",
|
||||||
"integrity": "sha512-DwKuH5tXhZJImU/rHDzQhG3bY2ihAUw5QqdNllso96MZ9TQTAbFvKPLppuJwx21XxYS2g3uB9R17AXEEme+sKA=="
|
"integrity": "sha512-DwKuH5tXhZJImU/rHDzQhG3bY2ihAUw5QqdNllso96MZ9TQTAbFvKPLppuJwx21XxYS2g3uB9R17AXEEme+sKA=="
|
||||||
},
|
},
|
||||||
"cordova-plugin-fingerprint-aio": {
|
|
||||||
"version": "4.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-fingerprint-aio/-/cordova-plugin-fingerprint-aio-4.0.2.tgz",
|
|
||||||
"integrity": "sha512-Mmm/Ee85s4JH7qL3yikQ2J2I2vY2XbNi1fttoEK2kI++YHr/WeqPHWGREFL7bmFYjZTph/JovhfWHPGV924WjQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"cordova-plugin-globalization": {
|
"cordova-plugin-globalization": {
|
||||||
"version": "1.11.0",
|
"version": "1.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-globalization/-/cordova-plugin-globalization-1.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-globalization/-/cordova-plugin-globalization-1.11.0.tgz",
|
||||||
|
|||||||
+2
-1
@@ -43,6 +43,7 @@
|
|||||||
"@angular/router": "~12.1.2",
|
"@angular/router": "~12.1.2",
|
||||||
"@awesome-cordova-plugins/core": "^5.40.0",
|
"@awesome-cordova-plugins/core": "^5.40.0",
|
||||||
"@awesome-cordova-plugins/document-viewer": "^5.41.0",
|
"@awesome-cordova-plugins/document-viewer": "^5.41.0",
|
||||||
|
"@awesome-cordova-plugins/ffmpeg": "^6.6.0",
|
||||||
"@awesome-cordova-plugins/file": "^5.41.0",
|
"@awesome-cordova-plugins/file": "^5.41.0",
|
||||||
"@awesome-cordova-plugins/file-opener": "^5.41.0",
|
"@awesome-cordova-plugins/file-opener": "^5.41.0",
|
||||||
"@awesome-cordova-plugins/media-capture": "^6.4.0",
|
"@awesome-cordova-plugins/media-capture": "^6.4.0",
|
||||||
@@ -130,6 +131,7 @@
|
|||||||
"cordova": "^11.0.0",
|
"cordova": "^11.0.0",
|
||||||
"cordova-plugin-crop": "^0.4.0",
|
"cordova-plugin-crop": "^0.4.0",
|
||||||
"cordova-plugin-document-viewer": "^1.0.0",
|
"cordova-plugin-document-viewer": "^1.0.0",
|
||||||
|
"cordova-plugin-ffmpeg": "github:MaximBelov/cordova-plugin-ffmpeg",
|
||||||
"cordova-plugin-file": "^6.0.2",
|
"cordova-plugin-file": "^6.0.2",
|
||||||
"cordova-plugin-file-opener2": "^3.0.5",
|
"cordova-plugin-file-opener2": "^3.0.5",
|
||||||
"cordova-plugin-file-transfer": "github:apache/cordova-plugin-file-transfer",
|
"cordova-plugin-file-transfer": "github:apache/cordova-plugin-file-transfer",
|
||||||
@@ -220,7 +222,6 @@
|
|||||||
"cordova-plugin-androidx-adapter": "^1.1.3",
|
"cordova-plugin-androidx-adapter": "^1.1.3",
|
||||||
"cordova-plugin-device": "^2.0.2",
|
"cordova-plugin-device": "^2.0.2",
|
||||||
"cordova-plugin-dialogs": "^2.0.2",
|
"cordova-plugin-dialogs": "^2.0.2",
|
||||||
"cordova-plugin-fingerprint-aio": "^4.0.2",
|
|
||||||
"cordova-plugin-globalization": "^1.11.0",
|
"cordova-plugin-globalization": "^1.11.0",
|
||||||
"cordova-plugin-inappbrowser": "^4.0.0",
|
"cordova-plugin-inappbrowser": "^4.0.0",
|
||||||
"cordova-plugin-media": "^5.0.4",
|
"cordova-plugin-media": "^5.0.4",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import {MAT_DATE_LOCALE} from '@angular/material/core';
|
|||||||
import { Network } from '@ionic-native/network/ngx';
|
import { Network } from '@ionic-native/network/ngx';
|
||||||
import { MultipleDocumentsPicker } from '@awesome-cordova-plugins/multiple-document-picker/ngx';
|
import { MultipleDocumentsPicker } from '@awesome-cordova-plugins/multiple-document-picker/ngx';
|
||||||
import { DocumentViewer } from '@awesome-cordova-plugins/document-viewer/ngx';
|
import { DocumentViewer } from '@awesome-cordova-plugins/document-viewer/ngx';
|
||||||
|
import { FFMpeg } from '@awesome-cordova-plugins/ffmpeg/ngx';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -213,6 +214,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
|||||||
NgxExtendedPdfViewerModule,
|
NgxExtendedPdfViewerModule,
|
||||||
FileOpener,
|
FileOpener,
|
||||||
DocumentViewer,
|
DocumentViewer,
|
||||||
|
FFMpeg,
|
||||||
{ provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptorService, multi: true },
|
{ provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptorService, multi: true },
|
||||||
tokenInterceptor
|
tokenInterceptor
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ export class HomePage implements OnInit {
|
|||||||
public ActiveTabService: ActiveTabService,
|
public ActiveTabService: ActiveTabService,
|
||||||
private RoleIdService: RoleIdService,
|
private RoleIdService: RoleIdService,
|
||||||
private modalController: ModalController,
|
private modalController: ModalController,
|
||||||
private zone: NgZone
|
private zone: NgZone,
|
||||||
|
public alertController: AlertController,
|
||||||
|
|
||||||
// private ChunkService: ChunkService,
|
// private ChunkService: ChunkService,
|
||||||
// private StreamService: StreamService
|
// private StreamService: StreamService
|
||||||
@@ -165,7 +166,11 @@ export class HomePage implements OnInit {
|
|||||||
}
|
}
|
||||||
if (result.url) {
|
if (result.url) {
|
||||||
window["sharedContent"] = result;
|
window["sharedContent"] = result;
|
||||||
this.zone.run(() => this.router.navigateByUrl("/home/publications"));
|
this.zone.run(() => this.router.navigateByUrl("/home/publications")).then(() => {
|
||||||
|
this.alertMessageSharerContent();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}).catch(err => console.error(err));
|
}).catch(err => console.error(err));
|
||||||
|
|
||||||
@@ -410,4 +415,20 @@ export class HomePage implements OnInit {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alertMessageSharerContent() {
|
||||||
|
this.alertController .create({
|
||||||
|
header: 'Selecione uma acção para criar a publicação',
|
||||||
|
message: '',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'Ok',
|
||||||
|
handler: () => {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).then(res => {
|
||||||
|
res.present();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
|||||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||||
import { App } from '@capacitor/app';
|
import { App } from '@capacitor/app';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { VideoconvertService } from 'src/app/services/videoconvert.service'
|
||||||
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
@@ -139,6 +140,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
public checkFileType: checkFileTypeService,
|
public checkFileType: checkFileTypeService,
|
||||||
private FileValidatorService: FileValidatorService,
|
private FileValidatorService: FileValidatorService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
private videoconvertService: VideoconvertService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.publicationType = this.navParams.get('publicationType');
|
this.publicationType = this.navParams.get('publicationType');
|
||||||
@@ -255,46 +257,9 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.platform.is('ios')) {
|
if (this.platform.is('ios')) {
|
||||||
const result = await Filesystem.writeFile({
|
this.recordevideoIos(element.fullPath)
|
||||||
path: 'video.mov',
|
|
||||||
data: element.fullPath,
|
|
||||||
directory: FilesystemDirectory.Data,
|
|
||||||
encoding: FilesystemEncoding.UTF8
|
|
||||||
})
|
|
||||||
console.log('Wrote file', result);
|
|
||||||
|
|
||||||
Filesystem.readFile({ path: result.uri })
|
|
||||||
|
|
||||||
.then(async (content) => {
|
|
||||||
console.log(content.data)
|
|
||||||
this.filecontent = true;
|
|
||||||
let fileObject = {
|
|
||||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
|
||||||
FileExtension: 'mp4',
|
|
||||||
OriginalFileName: 'video'
|
|
||||||
}
|
|
||||||
this.seletedContent.push(fileObject)
|
|
||||||
})
|
|
||||||
.catch((err) => console.error(err));
|
|
||||||
} else {
|
} else {
|
||||||
const savedFile = await Filesystem.copy({
|
|
||||||
from: Capacitor.convertFileSrc(element.fullPath), // directory prop removed, Capacitor parses filename for us
|
|
||||||
to: "video.mp4",
|
|
||||||
toDirectory: FilesystemDirectory.Data
|
|
||||||
});
|
|
||||||
console.log(savedFile.uri)
|
|
||||||
Filesystem.readFile({ path: savedFile.uri })
|
|
||||||
|
|
||||||
.then(async (content) => {
|
|
||||||
this.filecontent = true;
|
|
||||||
let fileObject = {
|
|
||||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
|
||||||
FileExtension: 'mp4',
|
|
||||||
OriginalFileName: 'video'
|
|
||||||
}
|
|
||||||
this.seletedContent.push(fileObject)
|
|
||||||
})
|
|
||||||
.catch((err) => console.error(err));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -842,5 +807,58 @@ export class NewPublicationPage implements OnInit {
|
|||||||
App.exitApp()
|
App.exitApp()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async recordevideoIos(fullPath) {
|
||||||
|
try {
|
||||||
|
const directory = await Filesystem.getUri({
|
||||||
|
directory: Directory.Cache,
|
||||||
|
path: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
this.videoconvertService.convertVideo(fullPath,directory.uri,'mp4');
|
||||||
|
|
||||||
|
Filesystem.readFile({ path: `${directory.uri}output.mp4`})
|
||||||
|
|
||||||
|
.then(async (content) => {
|
||||||
|
console.log(content.data)
|
||||||
|
this.filecontent = true;
|
||||||
|
let fileObject = {
|
||||||
|
FileBase64: 'data:video/mp4;base64,' + content.data,
|
||||||
|
FileExtension: 'mp4',
|
||||||
|
OriginalFileName: 'video'
|
||||||
|
}
|
||||||
|
this.seletedContent.push(fileObject)
|
||||||
|
})
|
||||||
|
.catch((erro) => console.error('read converted video erro ', erro));
|
||||||
|
} catch (error) {
|
||||||
|
console.log('record video ios erro, ', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async recordVideoAndroid(fullPath) {
|
||||||
|
try {
|
||||||
|
const savedFile = await Filesystem.copy({
|
||||||
|
from: Capacitor.convertFileSrc(fullPath),
|
||||||
|
to: "video.mp4",
|
||||||
|
toDirectory: FilesystemDirectory.Data
|
||||||
|
});
|
||||||
|
console.log(savedFile.uri)
|
||||||
|
Filesystem.readFile({ path: savedFile.uri })
|
||||||
|
|
||||||
|
.then(async (content) => {
|
||||||
|
this.filecontent = true;
|
||||||
|
let fileObject = {
|
||||||
|
FileBase64: 'data:video/mp4;base64,' + content.data,
|
||||||
|
FileExtension: 'mp4',
|
||||||
|
OriginalFileName: 'video'
|
||||||
|
}
|
||||||
|
this.seletedContent.push(fileObject)
|
||||||
|
})
|
||||||
|
.catch((error) => console.error('reade converted video erro ',error));
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.log('record video android erro ', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router, NavigationEnd } from '@angular/router';
|
import { Router, NavigationEnd } from '@angular/router';
|
||||||
import { ModalController, NavParams } from '@ionic/angular';
|
import { AlertController, ModalController, NavParams } from '@ionic/angular';
|
||||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||||
import { PublicationsService } from 'src/app/services/publications.service';
|
import { PublicationsService } from 'src/app/services/publications.service';
|
||||||
import { NewActionPage } from './new-action/new-action.page';
|
import { NewActionPage } from './new-action/new-action.page';
|
||||||
@@ -78,6 +78,7 @@ export class PublicationsPage implements OnInit {
|
|||||||
private StreamService:StreamService,
|
private StreamService:StreamService,
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
|
|
||||||
|
|
||||||
) {
|
) {
|
||||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class checkFileTypeService {
|
|||||||
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp','tiff','tif',
|
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp','tiff','tif',
|
||||||
'image/jpg', 'image/jpeg', 'image/png', 'image/gif', 'image/bmp','image/tiff','image/tif', 'image/*']; // Add more if needed
|
'image/jpg', 'image/jpeg', 'image/png', 'image/gif', 'image/bmp','image/tiff','image/tif', 'image/*']; // Add more if needed
|
||||||
const videoExtensions = ['mp4', 'webm', 'mpg', 'mpeg', 'ogg',
|
const videoExtensions = ['mp4', 'webm', 'mpg', 'mpeg', 'ogg',
|
||||||
'video/mp4', 'video/webm', 'video/mpg', 'video/mpeg', 'video/ogg','video/quicktime','video/mov', 'video/*']; // Add more if needed
|
'video/mp4', 'video/webm', 'video/mpg', 'video/mpeg', 'video/ogg','video/quicktime', 'video/*']; // Add more if needed
|
||||||
|
|
||||||
// Check if it's an image
|
// Check if it's an image
|
||||||
if (imageExtensions.includes(lowerCaseType)) {
|
if (imageExtensions.includes(lowerCaseType)) {
|
||||||
|
|||||||
@@ -2,14 +2,17 @@ import { Filesystem } from '@capacitor/filesystem';
|
|||||||
import { SendIntent } from "send-intent";
|
import { SendIntent } from "send-intent";
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { CallbackScheduler } from './callbackScheduler';
|
import { CallbackScheduler } from './callbackScheduler';
|
||||||
|
import { AlertController, Platform } from '@ionic/angular';
|
||||||
|
|
||||||
export class SendIntentService {
|
export class SendIntentService {
|
||||||
|
|
||||||
Router!: Router
|
Router!: Router
|
||||||
|
|
||||||
callbackScheduler = new CallbackScheduler()
|
callbackScheduler = new CallbackScheduler()
|
||||||
|
alertController = new AlertController()
|
||||||
|
|
||||||
constructor() {
|
constructor(
|
||||||
|
) {
|
||||||
|
|
||||||
SendIntent.checkSendIntentReceived().then((result: any) => {
|
SendIntent.checkSendIntentReceived().then((result: any) => {
|
||||||
// logger
|
// logger
|
||||||
@@ -36,11 +39,32 @@ export class SendIntentService {
|
|||||||
|
|
||||||
|
|
||||||
private onReceive = this.callbackScheduler.function<any>((result)=> {
|
private onReceive = this.callbackScheduler.function<any>((result)=> {
|
||||||
this.Router.navigateByUrl("/home/publications");
|
this.Router.navigateByUrl("/home/publications").then(() => {
|
||||||
|
if(Platform.prototype.is('ios')) {
|
||||||
|
this.alertIos();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
window["sharedContent"] = result;
|
window["sharedContent"] = result;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
private alertIos() {
|
||||||
|
this.alertController .create({
|
||||||
|
header: 'Selecione uma acção para criar a publicação',
|
||||||
|
message: '',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'Ok',
|
||||||
|
handler: () => {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).then(res => {
|
||||||
|
res.present();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sendIntent = new SendIntentService()
|
export const sendIntent = new SendIntentService()
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { VideoconvertService } from './videoconvert.service';
|
||||||
|
|
||||||
|
describe('VideoconvertService', () => {
|
||||||
|
let service: VideoconvertService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(VideoconvertService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { FFMpeg } from '@awesome-cordova-plugins/ffmpeg/ngx';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class VideoconvertService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private ffmpeg: FFMpeg
|
||||||
|
) { }
|
||||||
|
|
||||||
|
async convertVideo(inputPath, outputPath, formart) {
|
||||||
|
const ffmpegCommand = `-i "${inputPath}" -c:v copy -c:a aac -strict experimental "${outputPath}output.${formart}"`;
|
||||||
|
|
||||||
|
const result = await this.ffmpeg.exec(ffmpegCommand)
|
||||||
|
|
||||||
|
console.log('Convert returns ', `${outputPath}output.${formart}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,10 +18,11 @@ import { SocketConnectionMCRService } from "src/app/services/socket-connection-m
|
|||||||
import { CMAPIService } from '../../repository/CMAPI/cmapi.service';
|
import { CMAPIService } from '../../repository/CMAPI/cmapi.service';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { CaptureImageOptions, MediaCapture } from '@awesome-cordova-plugins/media-capture/ngx';
|
import { CaptureImageOptions, MediaCapture } from '@awesome-cordova-plugins/media-capture/ngx';
|
||||||
import { Filesystem, FilesystemDirectory } from '@capacitor/filesystem';
|
import { Directory, Filesystem, FilesystemDirectory } from '@capacitor/filesystem';
|
||||||
import { Platform } from '@ionic/angular';
|
import { Platform } from '@ionic/angular';
|
||||||
import { PublicationAttachmentEntity, PublicationFormMV } from '../upload/upload-streaming.service';
|
import { PublicationAttachmentEntity, PublicationFormMV } from '../upload/upload-streaming.service';
|
||||||
import { PublicationFormMVService } from "src/app/shared/publication/upload/publication-form-mv.service"
|
import { PublicationFormMVService } from "src/app/shared/publication/upload/publication-form-mv.service"
|
||||||
|
import { VideoconvertService } from 'src/app/services/videoconvert.service';
|
||||||
|
|
||||||
enum ActionType {
|
enum ActionType {
|
||||||
newRapid = "1",
|
newRapid = "1",
|
||||||
@@ -86,6 +87,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
private MiddlewareServiceService: MiddlewareServiceService,
|
private MiddlewareServiceService: MiddlewareServiceService,
|
||||||
private LakefsRepositoryService: LakefsRepositoryService,
|
private LakefsRepositoryService: LakefsRepositoryService,
|
||||||
private SocketConnectionMCRService: SocketConnectionMCRService,
|
private SocketConnectionMCRService: SocketConnectionMCRService,
|
||||||
|
private videoconvertService: VideoconvertService
|
||||||
) {
|
) {
|
||||||
this.publicationTitle = 'Nova Publicação';
|
this.publicationTitle = 'Nova Publicação';
|
||||||
}
|
}
|
||||||
@@ -727,29 +729,11 @@ export class NewPublicationPage implements OnInit {
|
|||||||
data.forEach(async element => {
|
data.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) {
|
||||||
const savedFile = await Filesystem.copy({
|
if(this.platform.is('ios'))
|
||||||
from: element.fullPath, // directory prop removed, Capacitor parses filename for us
|
this.recordevideoIos(element.fullPath)
|
||||||
to: "video.mp4",
|
|
||||||
toDirectory: FilesystemDirectory.Data
|
|
||||||
});
|
|
||||||
console.log(savedFile.uri)
|
|
||||||
Filesystem.readFile({ path: savedFile.uri })
|
|
||||||
|
|
||||||
.then(async (content) => {
|
|
||||||
this.filecontent = true;
|
|
||||||
console.log('', content)
|
|
||||||
let fileObject = new PublicationAttachmentEntity({
|
|
||||||
base64: content.data,
|
|
||||||
extension: 'mp4',
|
|
||||||
OriginalFileName: 'record',
|
|
||||||
FileType: 'video'
|
|
||||||
|
|
||||||
}
|
|
||||||
)
|
|
||||||
this.publicationFormMV.form.Files.push(fileObject)
|
|
||||||
})
|
|
||||||
.catch((err) => console.error(err));
|
|
||||||
} else {
|
} else {
|
||||||
|
this.recordVideoPc(element.fullPath)
|
||||||
|
|
||||||
if (this.publicationFormMV.form.Files.length === 0)
|
if (this.publicationFormMV.form.Files.length === 0)
|
||||||
this.filesSizeSum = 0
|
this.filesSizeSum = 0
|
||||||
|
|
||||||
@@ -771,6 +755,65 @@ export class NewPublicationPage implements OnInit {
|
|||||||
if (this.platform.is('desktop'))
|
if (this.platform.is('desktop'))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async recordevideoIos(fullPath) {
|
||||||
|
try {
|
||||||
|
const directory = await Filesystem.getUri({
|
||||||
|
directory: Directory.Cache,
|
||||||
|
path: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
this.videoconvertService.convertVideo(fullPath,directory.uri,'mp4');
|
||||||
|
|
||||||
|
Filesystem.readFile({ path: `${directory.uri}output.mp4`})
|
||||||
|
|
||||||
|
.then(async (content) => {
|
||||||
|
this.filecontent = true;
|
||||||
|
console.log('', content)
|
||||||
|
let fileObject = new PublicationAttachmentEntity({
|
||||||
|
base64: content.data,
|
||||||
|
extension: 'mp4',
|
||||||
|
OriginalFileName: 'record',
|
||||||
|
FileType: 'video'
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
this.publicationFormMV.form.Files.push(fileObject)
|
||||||
|
})
|
||||||
|
.catch((erro) => console.error('read converted video erro ', erro));
|
||||||
|
} catch (error) {
|
||||||
|
console.log('record video ios erro, ', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async recordVideoPc(fullPath) {
|
||||||
|
try {
|
||||||
|
const savedFile = await Filesystem.copy({
|
||||||
|
from: fullPath, // directory prop removed, Capacitor parses filename for us
|
||||||
|
to: "video.mp4",
|
||||||
|
toDirectory: FilesystemDirectory.Data
|
||||||
|
});
|
||||||
|
console.log(savedFile.uri)
|
||||||
|
Filesystem.readFile({ path: savedFile.uri })
|
||||||
|
|
||||||
|
.then(async (content) => {
|
||||||
|
this.filecontent = true;
|
||||||
|
console.log('', content)
|
||||||
|
let fileObject = new PublicationAttachmentEntity({
|
||||||
|
base64: content.data,
|
||||||
|
extension: 'mp4',
|
||||||
|
OriginalFileName: 'record',
|
||||||
|
FileType: 'video'
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
this.publicationFormMV.form.Files.push(fileObject)
|
||||||
|
})
|
||||||
|
.catch((err) => console.error(err));
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Environment } from './../app/models/envarioment'
|
import { Environment } from './../app/models/envarioment'
|
||||||
import { oaprProd } from './suport/oapr'
|
import { oaprProd } from './suport/oapr'
|
||||||
import { doneITProd } from './suport/doneIt'
|
import { doneITProd } from './suport/doneIt'
|
||||||
// import { DevDev } from './suport/dev'
|
import { DevDev } from './suport/dev'
|
||||||
|
|
||||||
|
|
||||||
export const environment: Environment = doneITProd;
|
export const environment: Environment = oaprProd;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Environment } from './../app/models/envarioment'
|
import { Environment } from './../app/models/envarioment'
|
||||||
import { oaprDev } from './suport/oapr'
|
import { oaprDev } from './suport/oapr'
|
||||||
import { doneITDev } from './suport/doneIt'
|
import { doneITDev } from './suport/doneIt'
|
||||||
//import { DevDev } from './suport/dev'
|
import { DevDev } from './suport/dev'
|
||||||
|
|
||||||
|
|
||||||
export const environment: Environment = doneITDev
|
export const environment: Environment = DevDev
|
||||||
|
|||||||
Reference in New Issue
Block a user