From 1f0c47352d38424c18f85cbd95ef2380a5580d74 Mon Sep 17 00:00:00 2001 From: william Date: Thu, 10 Aug 2023 17:38:20 +0800 Subject: [PATCH 01/19] feat: add transcode plugin --- README.md | 1 + apps/demo-angular/package.json | 3 +- apps/demo-angular/src/app-routing.module.ts | 1 + apps/demo-angular/src/home.component.ts | 3 + .../nativescript-transcoder.component.html | 8 + .../nativescript-transcoder.component.ts | 17 + .../nativescript-transcoder.module.ts | 10 + apps/demo/package.json | 3 +- apps/demo/src/main-page.xml | 5 +- apps/demo/src/main-view-model.ts | 6 + .../plugin-demos/nativescript-transcoder.ts | 96 ++++ .../plugin-demos/nativescript-transcoder.xml | 16 + .../nativescript-transcoder/.eslintrc.json | 18 + packages/nativescript-transcoder/README.md | 13 + packages/nativescript-transcoder/common.ts | 23 + .../nativescript-transcoder/index.android.ts | 3 + packages/nativescript-transcoder/index.d.ts | 8 + packages/nativescript-transcoder/index.ios.ts | 438 +++++++++++++++++ packages/nativescript-transcoder/package.json | 35 ++ .../ios/src/SDAVAssetExportSession.h | 194 ++++++++ .../ios/src/SDAVAssetExportSession.m | 445 ++++++++++++++++++ .../platforms/ios/src/module.modulemap | 4 + packages/nativescript-transcoder/project.json | 73 +++ .../nativescript-transcoder/references.d.ts | 2 + .../nativescript-transcoder/tsconfig.json | 9 + .../typings/objc!SDAVAssetExportSession.d.ts | 52 ++ tools/assets/App_Resources/iOS/Podfile | 4 +- tools/demo/index.ts | 1 + tools/demo/nativescript-transcoder/index.ts | 8 + tools/workspace-scripts.js | 11 + tsconfig.base.json | 3 + 31 files changed, 1509 insertions(+), 4 deletions(-) create mode 100644 apps/demo-angular/src/plugin-demos/nativescript-transcoder.component.html create mode 100644 apps/demo-angular/src/plugin-demos/nativescript-transcoder.component.ts create mode 100644 apps/demo-angular/src/plugin-demos/nativescript-transcoder.module.ts create mode 100644 apps/demo/src/plugin-demos/nativescript-transcoder.ts create mode 100644 apps/demo/src/plugin-demos/nativescript-transcoder.xml create mode 100644 packages/nativescript-transcoder/.eslintrc.json create mode 100644 packages/nativescript-transcoder/README.md create mode 100644 packages/nativescript-transcoder/common.ts create mode 100644 packages/nativescript-transcoder/index.android.ts create mode 100644 packages/nativescript-transcoder/index.d.ts create mode 100644 packages/nativescript-transcoder/index.ios.ts create mode 100644 packages/nativescript-transcoder/package.json create mode 100644 packages/nativescript-transcoder/platforms/ios/src/SDAVAssetExportSession.h create mode 100644 packages/nativescript-transcoder/platforms/ios/src/SDAVAssetExportSession.m create mode 100644 packages/nativescript-transcoder/platforms/ios/src/module.modulemap create mode 100644 packages/nativescript-transcoder/project.json create mode 100644 packages/nativescript-transcoder/references.d.ts create mode 100644 packages/nativescript-transcoder/tsconfig.json create mode 100644 packages/nativescript-transcoder/typings/objc!SDAVAssetExportSession.d.ts create mode 100644 tools/demo/nativescript-transcoder/index.ts diff --git a/README.md b/README.md index 4fdae62..35884c3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ - [@voicethread/nativescript-custom-rotors](packages/nativescript-custom-rotors/README.md) - [@voicethread/nativescript-downloader](packages/nativescript-downloader/README.md) - [@voicethread/nativescript-filepicker](packages/nativescript-filepicker/README.md) +- [@voicethread/nativescript-transcoder](packages/nativescript-transcoder/README.md) # How to use? diff --git a/apps/demo-angular/package.json b/apps/demo-angular/package.json index b14c3ce..5e25a4a 100644 --- a/apps/demo-angular/package.json +++ b/apps/demo-angular/package.json @@ -6,7 +6,8 @@ "@voicethread/nativescript-filepicker": "file:../../dist/packages/nativescript-filepicker", "@voicethread/nativescript-downloader": "file:../../dist/packages/nativescript-downloader", "@voicethread/nativescript-audio-player": "file:../../dist/packages/nativescript-audio-player", - "@voicethread/nativescript-audio-recorder": "file:../../dist/packages/nativescript-audio-recorder" + "@voicethread/nativescript-audio-recorder": "file:../../dist/packages/nativescript-audio-recorder", + "@voicethread/nativescript-transcoder": "file:../../dist/packages/nativescript-transcoder" }, "devDependencies": { "@nativescript/android": "~8.4.0", diff --git a/apps/demo-angular/src/app-routing.module.ts b/apps/demo-angular/src/app-routing.module.ts index f564993..2260e7d 100644 --- a/apps/demo-angular/src/app-routing.module.ts +++ b/apps/demo-angular/src/app-routing.module.ts @@ -12,6 +12,7 @@ const routes: Routes = [ { path: 'nativescript-custom-rotors', loadChildren: () => import('./plugin-demos/nativescript-custom-rotors.module').then(m => m.NativescriptCustomRotorsModule) }, { path: 'nativescript-downloader', loadChildren: () => import('./plugin-demos/nativescript-downloader.module').then(m => m.NativescriptDownloaderModule) }, { path: 'nativescript-filepicker', loadChildren: () => import('./plugin-demos/nativescript-filepicker.module').then(m => m.NativescriptFilepickerModule) }, + { path: 'nativescript-transcoder', loadChildren: () => import('./plugin-demos/nativescript-transcoder.module').then(m => m.NativescriptTranscoderModule) }, ]; @NgModule({ diff --git a/apps/demo-angular/src/home.component.ts b/apps/demo-angular/src/home.component.ts index 225a6ab..8f0b931 100644 --- a/apps/demo-angular/src/home.component.ts +++ b/apps/demo-angular/src/home.component.ts @@ -21,5 +21,8 @@ export class HomeComponent { { name: 'nativescript-filepicker', }, + { + name: 'nativescript-transcoder', + }, ]; } diff --git a/apps/demo-angular/src/plugin-demos/nativescript-transcoder.component.html b/apps/demo-angular/src/plugin-demos/nativescript-transcoder.component.html new file mode 100644 index 0000000..f0ab170 --- /dev/null +++ b/apps/demo-angular/src/plugin-demos/nativescript-transcoder.component.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/apps/demo-angular/src/plugin-demos/nativescript-transcoder.component.ts b/apps/demo-angular/src/plugin-demos/nativescript-transcoder.component.ts new file mode 100644 index 0000000..d6f7dbc --- /dev/null +++ b/apps/demo-angular/src/plugin-demos/nativescript-transcoder.component.ts @@ -0,0 +1,17 @@ +import { Component, NgZone } from '@angular/core'; +import { DemoSharedNativescriptTranscoder } from '@demo/shared'; +import {} from '@voicethread/nativescript-transcoder'; + +@Component({ + selector: 'demo-nativescript-transcoder', + templateUrl: 'nativescript-transcoder.component.html', +}) +export class NativescriptTranscoderComponent { + demoShared: DemoSharedNativescriptTranscoder; + + constructor(private _ngZone: NgZone) {} + + ngOnInit() { + this.demoShared = new DemoSharedNativescriptTranscoder(); + } +} diff --git a/apps/demo-angular/src/plugin-demos/nativescript-transcoder.module.ts b/apps/demo-angular/src/plugin-demos/nativescript-transcoder.module.ts new file mode 100644 index 0000000..7e3fb7a --- /dev/null +++ b/apps/demo-angular/src/plugin-demos/nativescript-transcoder.module.ts @@ -0,0 +1,10 @@ +import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; +import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; +import { NativescriptTranscoderComponent } from './nativescript-transcoder.component'; + +@NgModule({ + imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: NativescriptTranscoderComponent }])], + declarations: [NativescriptTranscoderComponent], + schemas: [NO_ERRORS_SCHEMA], +}) +export class NativescriptTranscoderModule {} diff --git a/apps/demo/package.json b/apps/demo/package.json index 17a4e7c..b347e49 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -13,7 +13,8 @@ "@voicethread/nativescript-downloader": "file:../../packages/nativescript-downloader", "@voicethread/nativescript-filepicker": "file:../../packages/nativescript-filepicker", "@voicethread/nativescript-audio-player": "file:../../packages/nativescript-audio-player", - "@voicethread/nativescript-audio-recorder": "file:../../packages/nativescript-audio-recorder" + "@voicethread/nativescript-audio-recorder": "file:../../packages/nativescript-audio-recorder", + "@voicethread/nativescript-transcoder": "file:../../packages/nativescript-transcoder" }, "devDependencies": { "@nativescript/android": "~8.4.0", diff --git a/apps/demo/src/main-page.xml b/apps/demo/src/main-page.xml index b2be8ec..a82c534 100644 --- a/apps/demo/src/main-page.xml +++ b/apps/demo/src/main-page.xml @@ -1,4 +1,5 @@ -