Skip to content

Commit 2e5fbca

Browse files
author
Dave Coffin
committed
moving audio plugin to official NS plugins
1 parent 097128b commit 2e5fbca

31 files changed

+2390
-13
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
# @nativescript/\* plugins
2-
3-
```
4-
npm run setup
5-
npm start
6-
```
7-
81
- [@nativescript/animated-circle](packages/animated-circle/README.md)
92
- [@nativescript/appavailability](packages/appavailability/README.md)
103
- [@nativescript/apple-sign-in](packages/apple-sign-in/README.md)
4+
- [@nativescript/audio](packages/audio/README.md)
115
- [@nativescript/auto-fit-text](packages/auto-fit-text/README.md)
126
- [@nativescript/background-http](packages/background-http/README.md)
137
- [@nativescript/biometrics](packages/biometrics/README.md)

apps/demo-angular/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"main": "./src/main.ts",
33
"dependencies": {
44
"@nativescript/core": "file:../../node_modules/@nativescript/core",
5-
"@nativescript/pdf": "file:../../dist/packages/pdf",
5+
"@nativescript/audio": "file:../../dist/packages/audio",
66
"@nativescript/animated-circle": "file:../../dist/packages/animated-circle",
77
"@nativescript/appavailability": "file:../../dist/packages/appavailability",
88
"@nativescript/apple-sign-in": "file:../../dist/packages/apple-sign-in",
@@ -30,6 +30,7 @@
3030
"@nativescript/iqkeyboardmanager": "file:../../dist/packages/iqkeyboardmanager",
3131
"@nativescript/local-notifications": "file:../../dist/packages/local-notifications",
3232
"@nativescript/localize": "file:../../dist/packages/localize",
33+
"@nativescript/pdf": "file:../../dist/packages/pdf",
3334
"@nativescript/picker": "file:../../dist/packages/picker",
3435
"@nativescript/shared-notification-delegate": "file:../../dist/packages/shared-notification-delegate",
3536
"@nativescript/social-share": "file:../../dist/packages/social-share",

apps/demo-angular/src/app-routing.module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const routes: Routes = [
1010
{ path: 'animated-circle', loadChildren: () => import('./plugin-demos/animated-circle.module').then((m) => m.AnimatedCircleModule) },
1111
{ path: 'appavailability', loadChildren: () => import('./plugin-demos/appavailability.module').then((m) => m.AppavailabilityModule) },
1212
{ path: 'apple-sign-in', loadChildren: () => import('./plugin-demos/apple-sign-in.module').then((m) => m.AppleSignInModule) },
13+
{ path: 'audio', loadChildren: () => import('./plugin-demos/audio.module').then((m) => m.AudioModule) },
1314
{ path: 'auto-fit-text', loadChildren: () => import('./plugin-demos/auto-fit-text.module').then((m) => m.AutoFitTextModule) },
1415
{ path: 'background-http', loadChildren: () => import('./plugin-demos/background-http.module').then((m) => m.BackgroundHttpModule) },
1516
{ path: 'biometrics', loadChildren: () => import('./plugin-demos/biometrics.module').then((m) => m.BiometricsModule) },

apps/demo-angular/src/home.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export class HomeComponent {
1515
{
1616
name: 'apple-sign-in',
1717
},
18+
{
19+
name: 'audio',
20+
},
1821
{
1922
name: 'auto-fit-text',
2023
},
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<ActionBar title="audio" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Play Audio!" (tap)="demoShared.play()" class="btn btn-primary"></Button>
6+
7+
<Button text="Stop Audio" (tap)="demoShared.stop()" class="btn btn-primary"></Button>
8+
</StackLayout>
9+
</ScrollView>
10+
</StackLayout>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedAudio } from '@demo/shared';
3+
4+
@Component({
5+
selector: 'demo-audio',
6+
templateUrl: 'audio.component.html',
7+
})
8+
export class AudioComponent {
9+
demoShared: DemoSharedAudio;
10+
11+
constructor(private _ngZone: NgZone) {}
12+
13+
ngOnInit() {
14+
this.demoShared = new DemoSharedAudio();
15+
}
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { AudioComponent } from './audio.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: AudioComponent }])],
7+
declarations: [AudioComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class AudioModule {}

apps/demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"repository": "<fill-your-repository-here>",
66
"dependencies": {
77
"@nativescript/core": "file:../../node_modules/@nativescript/core",
8-
"@nativescript/pdf": "file:../../packages/pdf",
8+
"@nativescript/audio": "file:../../packages/audio",
99
"@nativescript/animated-circle": "file:../../packages/animated-circle",
1010
"@nativescript/appavailability": "file:../../packages/appavailability",
1111
"@nativescript/apple-sign-in": "file:../../packages/apple-sign-in",
@@ -33,6 +33,7 @@
3333
"@nativescript/iqkeyboardmanager": "file:../../packages/iqkeyboardmanager",
3434
"@nativescript/local-notifications": "file:../../packages/local-notifications",
3535
"@nativescript/localize": "file:../../packages/localize",
36+
"@nativescript/pdf": "file:../../packages/pdf",
3637
"@nativescript/picker": "file:../../packages/picker",
3738
"@nativescript/shared-notification-delegate": "file:../../packages/shared-notification-delegate",
3839
"@nativescript/social-share": "file:../../packages/social-share",

apps/demo/src/main-page.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<Button text="animated-circle" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
99
<Button text="appavailability" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1010
<Button text="apple-sign-in" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
11+
<Button text="audio" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1112
<Button text="auto-fit-text" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1213
<Button text="background-http" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1314
<Button text="biometrics" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>

apps/demo/src/plugin-demos/audio.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Observable, EventData, Page } from '@nativescript/core';
2+
import { DemoSharedAudio } from '@demo/shared';
3+
import {} from '@nativescript/audio';
4+
5+
export function navigatingTo(args: EventData) {
6+
const page = <Page>args.object;
7+
page.bindingContext = new DemoModel();
8+
}
9+
10+
export class DemoModel extends DemoSharedAudio {}

apps/demo/src/plugin-demos/audio.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
2+
<Page.actionBar>
3+
<ActionBar title="audio" icon="" class="action-bar">
4+
</ActionBar>
5+
</Page.actionBar>
6+
<StackLayout class="p-20">
7+
<ScrollView class="h-full">
8+
<StackLayout>
9+
<Label class="h1" text="Player" />
10+
<Button text="Play Audio" tap="{{ play }}" class="btn btn-primary"/>
11+
<Button text="Pause Audio" tap="{{ pause }}" class="btn btn-primary"/>
12+
<Button text="Play from 1:00" tap="{{ seek }}" class="btn btn-primary"/>
13+
<Button text="Play From Beginning" tap="{{ startOver }}" class="btn btn-primary"/>
14+
<Label class="c-black" text="{{ isPlaying ? 'Audio Playing' : 'Audio Not Playing' }}"></Label>
15+
<Label class="c-black" text="{{ 'Seconds Played: ' + currentTime }}"></Label>
16+
17+
<Label class="h1" text="Recorder" />
18+
<Button text="Record Audio" tap="{{ record }}" class="btn btn-primary"/>
19+
<!-- <Button text="Pause Audio" tap="{{ pause }}" class="btn btn-primary"/> -->
20+
</StackLayout>
21+
</ScrollView>
22+
</StackLayout>
23+
</Page>

packages/audio/.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*", "node_modules/**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}

packages/audio/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @nativescript/audio
2+
3+
```javascript
4+
ns plugin add @nativescript/audio
5+
```
6+
7+
## Usage
8+
9+
// TODO
10+
11+
## License
12+
13+
Apache License Version 2.0

0 commit comments

Comments
 (0)