npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hrs-cordova-plugin-native-ringtones

v0.2.6

Published

Get and play the native ringtone list on Android/IOS devices.

Downloads

6

Readme

cordova-plugin-native-ringtones npm version

Plugin for the Cordova framework to get the native ringtone list.

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).

Supported Platforms

  • iOS
  • Android

Installation

The plugin can be installed via Cordova-CLI and is publicly available on NPM.

Execute from the projects root folder:

$ cordova plugin add cordova-plugin-native-ringtones

Or install a specific version:

$ cordova plugin add cordova-plugin-native-ringtones@VERSION

Or install the latest head version:

$ cordova plugin add https://github.com/TongZhangzt/cordova-plugin-native-ringtones

Usage

The plugin creates the object cordova.plugins.NativeRingtones and is accessible after the deviceready event has been fired.

You can call the function getRingtone to get the ringtone list. There are two/three parameters for this function:

  1. successCallback function: The cordova plugin will pass the ringtone list by the success object and the ringtone list is put in an array, each object in this array represent a ringtone (with name, url and category).
  2. errorCallback function: The function that will be called if the getRingtone failed.
  3. (just for Android) An string value to indicate the ringtone type. There are three kinds of ringtones for Android: 'notification', 'alarm', 'ringtone'. The default value is 'notification'.
document.addEventListener('deviceready', function () {
        var ringtones;
        cordova.plugins.NativeRingtones.getRingtone(function(success) {
                ringtones = success;
            },
            function(err) {
                alert(err);
            });
            //An object array contains all the ringtones
            setTimeout(function() { console.log(ringtones); }, 1000); 
}, false);

You can call the function playRingtone or stopRingtone to play or stop a ringtone by passing the URI of this ringtone. This plugin allow you to play both native ringtones and custom ringtones.

document.addEventListener('deviceready', function () {
        var ringtones;
        cordova.plugins.NativeRingtones.playRingtone("/System/Library/Audio/UISounds/Modern/calendar_alert_chord.caf");
}, false);

License

This software is released under the Apache 2.0 License.