Skip to content

Commit 4b899ae

Browse files
committed
prettierrc - format files - update README
1 parent 415bf4d commit 4b899ae

16 files changed

+291
-384
lines changed

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"semi": true,
4+
"printWidth": 120
5+
}

LICENSE renamed to LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22

33
nativescript-audio
4-
Copyright (c) 2017, Brad Martin & Nathan Walker
4+
Copyright (c) 2018, nStudio, LLC.
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -18,4 +18,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1818
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1919
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2020
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 56 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
1-
[![npm](https://img.shields.io/npm/v/nativescript-audio.svg)](https://www.npmjs.com/package/nativescript-audio)
2-
[![npm](https://img.shields.io/npm/dt/nativescript-audio.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-audio)
3-
[![Build Status](https://travis-ci.org/bradmartin/nativescript-audio.svg?branch=master)](https://travis-ci.org/bradmartin/nativescript-audio)
4-
[![GitHub forks](https://img.shields.io/github/forks/bradmartin/nativescript-audio.svg)](https://github.com/bradmartin/nativescript-audio/network)
5-
[![GitHub stars](https://img.shields.io/github/stars/bradmartin/nativescript-audio.svg)](https://github.com/bradmartin/nativescript-audio/stargazers)
6-
[![nStudio Plugin](https://img.shields.io/badge/nStudio-Plugin-blue.svg)](http://nstudio.io)
1+
<a align="center" href="https://www.npmjs.com/package/nativescript-audio">
2+
<h3 align="center">NativeScript Audio</h3>
3+
</a>
4+
<h4 align="center">NativeScript plugin to play and record audio files for Android and iOS.</h4>
5+
6+
<p align="center">
7+
<a href="https://www.npmjs.com/package/nativescript-audio">
8+
<img src="https://img.shields.io/npm/v/nativescript-audio.svg" alt="npm">
9+
</a>
10+
<a href="https://www.npmjs.com/package/nativescript-audio">
11+
<img src="https://img.shields.io/npm/dt/nativescript-audio.svg?label=npm%20downloads" alt="npm">
12+
</a>
13+
<a href="https://github.com/nstudio/nativescript-audio/stargazers">
14+
<img src="https://img.shields.io/github/stars/nstudio/nativescript-audio.svg" alt="stars">
15+
</a>
16+
<a href="https://github.com/nstudio/nativescript-audio/network">
17+
<img src="https://img.shields.io/github/forks/nstudio/nativescript-audio.svg" alt="forks">
18+
</a>
19+
<a href="https://github.com/nstudio/nativescript-audio/blob/master/src/LICENSE.md">
20+
<img src="https://img.shields.io/github/license/nstudio/nativescript-audio.svg" alt="license">
21+
</a>
22+
<a href="https://paypal.me/bradwayne88">
23+
<img src="https://img.shields.io/badge/Donate-PayPal-green.svg" alt="donate">
24+
</a>
25+
<a href="http://nstudio.io">
26+
<img src="./screens/nstudio-banner.png" alt="nStudio banner">
27+
</a>
28+
<h5 align="center">Do you need assistance on your project or plugin? Contact the nStudio team anytime at <a href="mailto:[email protected]">[email protected]</a> to get up to speed with the best practices in mobile and web app development.
29+
</h5>
30+
</p>
731

8-
9-
10-
# NativeScript-Audio
11-
12-
NativeScript plugin to play and record audio files for Android and iOS.
32+
---
1333

1434
## Installation
1535

16-
The plugin is compatible with both Nativescript 3.x and 2.x versions. Install with:
17-
1836
`tns plugin add nativescript-audio`
1937

2038
---
@@ -24,7 +42,7 @@ The plugin is compatible with both Nativescript 3.x and 2.x versions. Install wi
2442
* [Player - android.media.MediaPlayer](http://developer.android.com/reference/android/media/MediaPlayer.html)
2543
* [Recorder - android.media.MediaRecorder](http://developer.android.com/reference/android/media/MediaRecorder.html)
2644

27-
#### iOS Native Classes
45+
### iOS Native Classes
2846

2947
* [Player - AVAudioPlayer](https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/)
3048
* [Recorder - AVAudioRecorder](https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioRecorder_ClassReference/)
@@ -41,7 +59,7 @@ Note: You will need to grant permissions on iOS to allow the device to access th
4159
### TypeScript Example
4260

4361
```typescript
44-
import { TNSPlayer } from "nativescript-audio";
62+
import { TNSPlayer } from 'nativescript-audio';
4563

4664
export class YourClass {
4765
private _player: TNSPlayer;
@@ -51,7 +69,7 @@ export class YourClass {
5169
this._player.debug = true; // set true to enable TNSPlayer console logs for debugging.
5270
this._player
5371
.initFromFile({
54-
audioFile: "~/audio/song.mp3", // ~ = app directory
72+
audioFile: '~/audio/song.mp3', // ~ = app directory
5573
loop: false,
5674
completeCallback: this._trackComplete.bind(this),
5775
errorCallback: this._trackError.bind(this)
@@ -74,31 +92,31 @@ export class YourClass {
7492
}
7593

7694
private _trackComplete(args: any) {
77-
console.log("reference back to player:", args.player);
95+
console.log('reference back to player:', args.player);
7896
// iOS only: flag indicating if completed succesfully
79-
console.log("whether song play completed successfully:", args.flag);
97+
console.log('whether song play completed successfully:', args.flag);
8098
}
8199

82100
private _trackError(args: any) {
83-
console.log("reference back to player:", args.player);
84-
console.log("the error:", args.error);
101+
console.log('reference back to player:', args.player);
102+
console.log('the error:', args.error);
85103
// Android only: extra detail on error
86-
console.log("extra info on the error:", args.extra);
104+
console.log('extra info on the error:', args.extra);
87105
}
88106
}
89107
```
90108

91109
### Javascript Example:
92110

93111
```javascript
94-
const audio = require("nativescript-audio");
112+
const audio = require('nativescript-audio');
95113

96114
const player = new audio.TNSPlayer();
97115
const playerOptions = {
98-
audioFile: "http://some/audio/file.mp3",
116+
audioFile: 'http://some/audio/file.mp3',
99117
loop: false,
100118
completeCallback: function() {
101-
console.log("finished playing");
119+
console.log('finished playing');
102120
},
103121
errorCallback: function(errorObject) {
104122
console.log(JSON.stringify(errorObject));
@@ -114,7 +132,7 @@ player
114132
console.log(res);
115133
})
116134
.catch(function(err) {
117-
console.log("something went wrong...", err);
135+
console.log('something went wrong...', err);
118136
});
119137
```
120138

@@ -124,18 +142,18 @@ player
124142

125143
#### TNSRecorder Methods
126144

127-
| Method | Description |
128-
| ----------------------------------------------------------- | --------------------------------------------------------- |
129-
| _TNSRecorder.CAN_RECORD()_: `boolean` - **_static method_** | Determine if ready to record. |
130-
| _start(options: AudioRecorderOptions)_: `Promise<void>` | Start recording to file. |
131-
| _stop()_: `Promise<void>` | Stop recording. |
132-
| _pause()_: `Promise<void>` | Pause recording. |
133-
| _resume()_: `Promise<void>` | Resume recording. |
134-
| _dispose()_: `Promise<void>` | Free up system resources when done with recorder. |
135-
| _getMeters(channel?: number)_: `number` | Returns the amplitude of the input. |
136-
| _isRecording()_: `boolean` - **_iOS Only_** | Returns true if recorder is actively recording. |
137-
| _requestRecordPermission()_: `Promise<void>` | *Android Only* Resolves the promise is user grants the permission. |
138-
| _hasRecordPermission()_: `boolean` | *Android Only* Returns true if RECORD_AUDIO permission has been granted. |
145+
| Method | Description |
146+
| ----------------------------------------------------------- | ------------------------------------------------------------------------ |
147+
| _TNSRecorder.CAN_RECORD()_: `boolean` - **_static method_** | Determine if ready to record. |
148+
| _start(options: AudioRecorderOptions)_: `Promise<void>` | Start recording to file. |
149+
| _stop()_: `Promise<void>` | Stop recording. |
150+
| _pause()_: `Promise<void>` | Pause recording. |
151+
| _resume()_: `Promise<void>` | Resume recording. |
152+
| _dispose()_: `Promise<void>` | Free up system resources when done with recorder. |
153+
| _getMeters(channel?: number)_: `number` | Returns the amplitude of the input. |
154+
| _isRecording()_: `boolean` - **_iOS Only_** | Returns true if recorder is actively recording. |
155+
| _requestRecordPermission()_: `Promise<void>` | _Android Only_ Resolves the promise is user grants the permission. |
156+
| _hasRecordPermission()_: `boolean` | _Android Only_ Returns true if RECORD_AUDIO permission has been granted. |
139157

140158
#### TNSRecorder Instance Properties
141159

@@ -174,6 +192,6 @@ player
174192
| _currentTime_: `number` | Get the current time in the media file's duration. |
175193
| _volume_: `number` | Get/Set the player volume. Value range from 0 to 1. |
176194

177-
## License
195+
### License
178196

179197
[MIT](/LICENSE)

screens/nstudio-banner.png

24.1 KB
Loading

0 commit comments

Comments
 (0)