New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nativescript-audio

Package Overview
Dependencies
Maintainers
4
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-audio - npm Package Compare versions

Comparing version 6.1.0 to 6.2.0

26

android/player.js

@@ -256,6 +256,21 @@ import { Application, Observable, Utils } from '@nativescript/core';

let result = true;
let focusResult = null;
if (!this._mAudioFocusGranted) {
const ctx = this._getAndroidContext();
const am = ctx.getSystemService(android.content.Context.AUDIO_SERVICE);
const focusResult = am.requestAudioFocus(this._mOnAudioFocusChangeListener, android.media.AudioManager.STREAM_MUSIC, this._durationHint);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
const playbackAttributes = new android.media.AudioAttributes.Builder()
.setUsage(android.media.AudioAttributes.USAGE_MEDIA)
.setContentType(android.media.AudioAttributes.CONTENT_TYPE_MUSIC)
.build();
this._audioFocusRequest = new android.media.AudioFocusRequest.Builder(android.media.AudioManager.AUDIOFOCUS_GAIN)
.setAudioAttributes(playbackAttributes)
.setAcceptsDelayedFocusGain(true)
.setOnAudioFocusChangeListener(this._mOnAudioFocusChangeListener)
.build();
focusResult = am.requestAudioFocus(this._audioFocusRequest);
}
else {
focusResult = am.requestAudioFocus(this._mOnAudioFocusChangeListener, android.media.AudioManager.STREAM_MUSIC, this._durationHint);
}
if (focusResult === android.media.AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {

@@ -273,3 +288,10 @@ result = true;

const am = ctx.getSystemService(android.content.Context.AUDIO_SERVICE);
const result = am.abandonAudioFocus(this._mOnAudioFocusChangeListener);
let result = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
result = am.abandonAudioFocusRequest(this._audioFocusRequest);
this._audioFocusRequest = null;
}
else {
result = am.abandonAudioFocus(this._mOnAudioFocusChangeListener);
}
if (this._mediaPlayer && !preserveMP) {

@@ -276,0 +298,0 @@ this._mediaPlayer.release();

@@ -62,2 +62,5 @@ import { Application } from '@nativescript/core';

}
if (options.maxDuration) {
this._recorder.setMaxDuration(options.maxDuration);
}
this._recorder.setOutputFile(options.filename);

@@ -64,0 +67,0 @@ this._recorder.setOnErrorListener(new android.media.MediaRecorder.OnErrorListener({

@@ -57,2 +57,3 @@ import { Observable } from '@nativescript/core';

start(options) {
this._recorderOptions = options;
return new Promise((resolve, reject) => {

@@ -70,3 +71,8 @@ try {

const recordSetting = NSMutableDictionary.alloc().init();
recordSetting.setValueForKey(NSNumber.numberWithInt(kAudioFormatMPEG4AAC), 'AVFormatIDKey');
if (options.format) {
recordSetting.setValueForKey(NSNumber.numberWithInt(options.format), 'AVFormatIDKey');
}
else {
recordSetting.setValueForKey(NSNumber.numberWithInt(kAudioFormatMPEG4AAC), 'AVFormatIDKey');
}
recordSetting.setValueForKey(NSNumber.numberWithInt(64), 'AVEncoderAudioQualityKey');

@@ -86,4 +92,9 @@ recordSetting.setValueForKey(NSNumber.numberWithFloat(16000.0), 'AVSampleRateKey');

}
this._recorder.prepareToRecord();
this._recorder.record();
if (options.maxDuration) {
this._recorder.recordForDuration(options.maxDuration / 1000);
}
else {
this._recorder.prepareToRecord();
this._recorder.record();
}
resolve();

@@ -90,0 +101,0 @@ }

6

package.json
{
"name": "nativescript-audio",
"version": "6.1.0",
"version": "6.2.0",
"description": "NativeScript plugin to record and play audio.",

@@ -133,4 +133,3 @@ "main": "audio",

"dependencies": {
"nativescript-permissions": "~1.3.9",
"ts-node": "^9.0.0"
"nativescript-permissions": "~1.3.9"
},

@@ -145,2 +144,3 @@ "devDependencies": {

"rimraf": "^3.0.2",
"ts-node": "^9.0.0",
"ts-patch": "^1.3.0",

@@ -147,0 +147,0 @@ "tslint": "~6.1.3",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc