-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(native-ringtones): add Native Ringtones plugin (#1488)
* typo(barcode-scanner): fixe circle lint error * typo(docs): Unified the documentations In some plugins the typescript markup was missing. I also unified the console.log string from console.log("hello") to console.log('Hello') so any plugin page look the same. * initial commit Added wrapper * Added usage guide * Added parms
- Loading branch information
1 parent
e35501d
commit 21c9cd2
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; | ||
import { Injectable } from '@angular/core'; | ||
|
||
/** | ||
* @beta | ||
* @name Native Ringtones | ||
* @description | ||
* The plugin helps get the native ringtones list on Android or IOS devices. | ||
* And you can also use this plugin to play or stop the native ringtones and custom ringtones(added in the www folder). | ||
* | ||
* @usage | ||
* ``` | ||
* import { NativeRingtones } from '@ionic-native/native-ringtones'; | ||
* | ||
* | ||
* constructor(private ringtones: NativeRingtones) { } | ||
* | ||
* ... | ||
* this.ringtones.getRingtone().then((ringtones) => { console.log(ringtones); }); | ||
* | ||
* this.ringtones.playRingtone('assets/ringtones/sound_1.caf'); | ||
* | ||
* this.ringtones.stopRingtone('assets/ringtones/sound_1.caf'); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
pluginName: 'native-ringtones', | ||
plugin: 'cordova-plugin-native-ringtones', | ||
pluginRef: 'cordova.plugins.NativeRingtones', | ||
repo: 'https://github.com/TongZhangzt/cordova-plugin-native-ringtones', | ||
platforms: ['Android', 'iOS'] | ||
}) | ||
@Injectable() | ||
export class NativeRingtones extends IonicNativePlugin { | ||
|
||
/** | ||
* Get the ringtone list of the device | ||
* @return {Promise<any>} Returns a promise that resolves when ringtones found successfully | ||
*/ | ||
@Cordova() | ||
getRingtone(): Promise<any> { return; } | ||
|
||
/** | ||
* This function starts playing the ringtone | ||
* @param {string} ringtoneUri The path to the ringtone file | ||
* @return {Promise<any>} Returns a promise | ||
*/ | ||
@Cordova() | ||
playRingtone(ringtoneUri: string): Promise<any> { return; } | ||
|
||
/** | ||
* This function stops playing the ringtone | ||
* @param {string} ringtoneUri The path to the ringtone file | ||
* @return {Promise<any>} Returns a promise | ||
*/ | ||
@Cordova() | ||
stopRingtone(ringtoneUri: string): Promise<any> { return; } | ||
} |