![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
cordova-plugin-yanap
Advanced tools
This Cordova's plugin is an alternative to the cordova-plugin-media
and cordova-plugin-nativeaudio
/cordova-plugin-lowlatencyaudio
plugins to play audio from native on Android. It may support iOS in the future.
Main features we have in mind while developing it are:
var Yanap = cordova.plugins.Yanap;
var myBackgroundLoop = new Yanap.AudioInstance(Yanap.AUDIO_TYPE.LOOP);
myBackgroundLoop.load('audio/bg.mp3');
myBackgroundLoop.play();
// and when it is not needed anymore...
// myBackgroundLoop.stop();
// myBackgroundLoop.release();
Enum of available audio instance types:
Yanap.AUDIO_TYPE.LOOP // for -relatively- long audio tracks that need to loop
Yanap.AUDIO_TYPE.MUSIC // for -relatively- long audio tracks
Yanap.AUDIO_TYPE.SOUND // for short audio files (fx, ui...)
Enum of possible audio instance status:
Yanap.AUDIO_INSTANCE_STATUS.ERROR // something bad happened, instance cannot be used anymore
Yanap.AUDIO_INSTANCE_STATUS.EMPTY // instance has been initialised
Yanap.AUDIO_INSTANCE_STATUS.LOADING // currently loading
Yanap.AUDIO_INSTANCE_STATUS.LOADED // loaded successfully
Yanap.AUDIO_INSTANCE_STATUS.PLAYING // currently playing
Yanap.AUDIO_INSTANCE_STATUS.LOOPING // set when looping the first time and re-triggered at each consecutive loop
Yanap.AUDIO_INSTANCE_STATUS.STOPPED // playback reached the end or has been manually stopped
Yanap.AUDIO_INSTANCE_STATUS.RELEASED // all resources for this instance have been released
NB:
LOOPING
is available only for audio types LOOP
PLAYING
and STOPPED
are not available for audio types SOUND
Audio instance constructor.
audioType
can be any value present in Yanap.AUDIO_TYPE
.onStatusUpdate
is an optional method that will receive a Yanap.AUDIO_INSTANCE_STATUS
as first parameter and a string containing additional information as second parameter (mostly used when an error happened).var mySong = new Yanap.AudioInstance(
Yanap.AUDIO_TYPE.MUSIC,
function onStatusUpdate(status, additionalInfo) {
if (status === Yanap.AUDIO_INSTANCE_STATUS.ERROR) {
return console.error('error: ' + additionalInfo);
}
console.log('new status: ' + status);
}
);
This creation is successful even if audio type is invalid (it would fail during the loading).
Used to load a file.
filePath
is a string:
file:///android_asset/
file://
cache
directory// example 1: if you want to be sure that audio is ready before trying to play it
var myLaserFx = new Yanap.AudioInstance(Yanap.AUDIO_TYPE.SOUND, function (status) {
if (status === Yanap.AUDIO_INSTANCE_STATUS.ERROR) {
return console.error('error: ' + additionalInfo);
}
if (status === Yanap.AUDIO_INSTANCE_STATUS.LOADED) {
myLaserFx.play();
}
});
myLaserFx.load('audio/laser.mp3');
// example 2: if you want to play automatically when loaded and don't care about errors
var myLaserFx = new Yanap.AudioInstance(Yanap.AUDIO_TYPE.SOUND);
myLaserFx.load('audio/laser.mp3');
myLaserFx.play();
Used to start or resume an audio instance playback.
Used to interrupt an audio instance playback.
Set audio volume.
channel1
and channel2
represents the left and right speakers.0.0
~ 1.0
.Has to be called when you don't need an audio instance anymore. It's automatically stopping playback before releasing all resources.
Size of the audio file in bytes. Default is -1
.
Static method used to stop and release all audio instances.
FAQs
Yet Another Native Audio Plugin for Cordova
The npm package cordova-plugin-yanap receives a total of 3 weekly downloads. As such, cordova-plugin-yanap popularity was classified as not popular.
We found that cordova-plugin-yanap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.