Code Monkey home page Code Monkey logo

native-audio's Introduction

Capgo - Instant updates for capacitor

Native Audio

@capgo/native-audio

Capacitor plugin for playing sounds.


Capacitor Native Audio Plugin

Capacitor plugin for native audio engine. Capacitor V6 - ✅ Support!

Click on video to see example 💥

YouTube Example

Maintainers

Maintainer GitHub Social
Martin Donadieu riderx Telegram

Mainteinance Status: Actively Maintained

Preparation

All audio files must be with the rest of your source files.

First make your sound file end up in your builded code folder, example in folder BUILDFOLDER/assets/sounds/FILENAME.mp3 Then use it in preload like that assets/sounds/FILENAME.mp3

Installation

To use npm

npm install @capgo/native-audio

To use yarn

yarn add @capgo/native-audio

Sync native files

npx cap sync

On iOS, Android and Web, no further steps are needed.

Configuration

No configuration required for this plugin.

Supported methods

Name Android iOS Web
configure
preload
play
pause
resume
loop
stop
unload
setVolume
getDuration
getCurrentTime
isPlaying

Usage

Example repository

import {NativeAudio} from '@capgo/native-audio'


/**
 * This method will load more optimized audio files for background into memory.
 * @param assetPath - relative path of the file, absolute url (file://) or remote url (https://)
 *        assetId - unique identifier of the file
 *        audioChannelNum - number of audio channels
 *        isUrl - pass true if assetPath is a `file://` url
 * @returns void
 */
NativeAudio.preload({
    assetId: "fire",
    assetPath: "assets/sounds/fire.mp3",
    audioChannelNum: 1,
    isUrl: false
});

/**
 * This method will play the loaded audio file if present in the memory.
 * @param assetId - identifier of the asset
 * @param time - (optional) play with seek. example: 6.0 - start playing track from 6 sec
 * @returns void
 */
NativeAudio.play({
    assetId: 'fire',
    // time: 6.0 - seek time
});

/**
 * This method will loop the audio file for playback.
 * @param assetId - identifier of the asset
 * @returns void
 */
NativeAudio.loop({
  assetId: 'fire',
});


/**
 * This method will stop the audio file if it's currently playing.
 * @param assetId - identifier of the asset
 * @returns void
 */
NativeAudio.stop({
  assetId: 'fire',
});

/**
 * This method will unload the audio file from the memory.
 * @param assetId - identifier of the asset
 * @returns void
 */
NativeAudio.unload({
  assetId: 'fire',
});

/**
 * This method will set the new volume for a audio file.
 * @param assetId - identifier of the asset
 *        volume - numerical value of the volume between 0.1 - 1.0 default 1.0
 * @returns void
 */
NativeAudio.setVolume({
  assetId: 'fire',
  volume: 0.4,
});

/**
 * this method will get the duration of an audio file.
 * only works if channels == 1
 */
NativeAudio.getDuration({
  assetId: 'fire'
})
.then(result => {
  console.log(result.duration);
})

/**
 * this method will get the current time of a playing audio file.
 * only works if channels == 1
 */
NativeAudio.getCurrentTime({
  assetId: 'fire'
});
.then(result => {
  console.log(result.currentTime);
})

/**
 * This method will return false if audio is paused or not loaded.
 * @param assetId - identifier of the asset
 * @returns {isPlaying: boolean}
 */
NativeAudio.isPlaying({
  assetId: 'fire'
})
.then(result => {
  console.log(result.isPlaying);
})

API

configure(...)

configure(options: ConfigureOptions) => Promise<void>

Configure the audio player

Param Type
options ConfigureOptions

Since: 5.0.0


preload(...)

preload(options: PreloadOptions) => Promise<void>

Load an audio file

Param Type
options PreloadOptions

Since: 5.0.0


isPreloaded(...)

isPreloaded(options: PreloadOptions) => Promise<boolean>

Check if an audio file is preloaded

Param Type
options PreloadOptions

Returns: Promise<boolean>

Since: 6.1.0


play(...)

play(options: { assetId: string; time?: number; delay?: number; }) => Promise<void>

Play an audio file

Param Type
options { assetId: string; time?: number; delay?: number; }

Since: 5.0.0


pause(...)

pause(options: Assets) => Promise<void>

Pause an audio file

Param Type
options Assets

Since: 5.0.0


resume(...)

resume(options: Assets) => Promise<void>

Resume an audio file

Param Type
options Assets

Since: 5.0.0


loop(...)

loop(options: Assets) => Promise<void>

Stop an audio file

Param Type
options Assets

Since: 5.0.0


stop(...)

stop(options: Assets) => Promise<void>

Stop an audio file

Param Type
options Assets

Since: 5.0.0


unload(...)

unload(options: Assets) => Promise<void>

Unload an audio file

Param Type
options Assets

Since: 5.0.0


setVolume(...)

setVolume(options: { assetId: string; volume: number; }) => Promise<void>

Set the volume of an audio file

Param Type
options { assetId: string; volume: number; }

Since: 5.0.0


setRate(...)

setRate(options: { assetId: string; rate: number; }) => Promise<void>

Set the rate of an audio file

Param Type
options { assetId: string; rate: number; }

Since: 5.0.0


getCurrentTime(...)

getCurrentTime(options: { assetId: string; }) => Promise<{ currentTime: number; }>

Set the current time of an audio file

Param Type
options { assetId: string; }

Returns: Promise<{ currentTime: number; }>

Since: 5.0.0


getDuration(...)

getDuration(options: Assets) => Promise<{ duration: number; }>

Get the duration of an audio file

Param Type
options Assets

Returns: Promise<{ duration: number; }>

Since: 5.0.0


isPlaying(...)

isPlaying(options: Assets) => Promise<{ isPlaying: boolean; }>

Check if an audio file is playing

Param Type
options Assets

Returns: Promise<{ isPlaying: boolean; }>

Since: 5.0.0


addListener('complete', ...)

addListener(eventName: "complete", listenerFunc: CompletedListener) => Promise<PluginListenerHandle>

Listen for complete event

Param Type
eventName 'complete'
listenerFunc CompletedListener

Returns: Promise<PluginListenerHandle>

Since: 5.0.0 return {@link CompletedEvent}


Interfaces

ConfigureOptions

Prop Type Description
fade boolean Play the audio with Fade effect, only available for IOS
focus boolean focus the audio with Audio Focus
background boolean Play the audio in the background

PreloadOptions

Prop Type Description
assetPath string Path to the audio file, relative path of the file, absolute url (file://) or remote url (https://)
assetId string Asset Id, unique identifier of the file
volume number Volume of the audio, between 0.1 and 1.0
audioChannelNum number Audio channel number, default is 1
isUrl boolean Is the audio file a URL, pass true if assetPath is a file:// url

Assets

Prop Type Description
assetId string Asset Id, unique identifier of the file

PluginListenerHandle

Prop Type
remove () => Promise<void>

CompletedEvent

Prop Type Description Since
assetId string Emit when a play completes 5.0.0

Type Aliases

CompletedListener

(state: CompletedEvent): void

native-audio's People

Contributors

acurrieclark avatar akhromieiev avatar antonymarion avatar bazuka5801 avatar dependabot[bot] avatar github-actions[bot] avatar harelm avatar kheftel avatar kyoz avatar mamane10 avatar priyankpat avatar renovate[bot] avatar reslear avatar riderx avatar sitronik avatar webdog-rich avatar whippym avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

native-audio's Issues

Focus parameter does not work and sound is not focused

Describe the bug
NativeAudio.configure({ focus: true }) does not work anymore. When I play some music in other app (for example Spotify) and I use some sound in my app then it is not focusing my sound and I can hear both sounds (spotify and my app sound) at the same time.

To Reproduce
Steps to reproduce the behavior:
Play any sound using this plugin while other app plays music in background

Expected behavior
App should focus on app sound and after sound finish playing then it should focus again on background sound from other app

Smartphone (please complete the following information):

  • Device: iPhone 15, iPhone 15 Pro, iPhone 12 mini, Pixel 5
  • OS: newest iOS and Android

Additional context
I have newest version of plugin and my cap doctor is below:


  @capacitor/cli: 5.6.0
  @capacitor/core: 5.6.0
  @capacitor/android: 5.6.0
  @capacitor/ios: 5.6.0

Installed Dependencies:

  @capacitor/cli: 5.4.2
  @capacitor/android: 5.4.2
  @capacitor/core: 5.4.2
  @capacitor/ios: 5.4.2

[success] iOS looking great! 👌
[success] Android looking great! 👌```

nativeAudio.addListener not functioning as expected

Describe the bug
I'm experiencing an issue with the nativeAudio.addListener method in my application. It doesn't seem to be working as expected. When attempting to use it in conjunction with my code, which plays a series of audio files sequentially, the event listener doesn't trigger when audio playback is completed.

To Reproduce

import { NativeAudio, PreloadOptions } from "@capgo/native-audio";

class AudioPlayer {
  private nativeAudio = NativeAudio;
  private audioUrls: string[] = [];
  private currentIndex: number = 0;

  async playAudioArray(audioUrls: string[]) {
    this.audioUrls = audioUrls;
    this.currentIndex = 0;

    // Preload the first audio
    await this.preloadNextAudio();

    // Start playing
    await this.playCurrentAudio();
  }

  private async preloadNextAudio() {
    if (this.currentIndex < this.audioUrls.length) {
      const assetPath = this.audioUrls[this.currentIndex];
      const assetId = `audio_${this.currentIndex}`;

      const preloadOptions: PreloadOptions = {
        assetPath,
        assetId,
        // Other preload options, set as needed
      };

      await this.nativeAudio.preload(preloadOptions);
    }
  }

  private async playCurrentAudio() {
    if (this.currentIndex < this.audioUrls.length) {
      const assetId = `audio_${this.currentIndex}`;

      // Play the current audio
      await this.nativeAudio.play({ assetId });

      // Listen for the completion event
      const listener = async (event: { assetId: string }) => {
        if (event.assetId === assetId) {
          // Current audio playback is complete
          this.currentIndex++;

          if (this.currentIndex < this.audioUrls.length) {
            // Preload and play the next audio
            await this.preloadNextAudio();
            await this.playCurrentAudio();
          }
        }
      };

      // Add a completion event listener
      const listenerHandle = await this.nativeAudio.addListener(
        "complete",
        listener
      );
    }
  }
}

export default AudioPlayer;

const audioPlayer= new AudioPlayer();
audioPlayer.playAudioArray([url, url]);

Desktop (please complete the following information):

  • OS: Windows
  • Browser chrome
  • Version 116.0.5845.188

Time param not optional on play method

Describe the bug
This could be an issue with the docs but they mentioned that the time param is optional but the definition typings don't allow it to be optional (see code link below).

play(options: { assetId: string; time: number }): Promise<void>;

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
The time param of the play method is optional defaulting to 0 if not provided.

NativeAudio import error?

Describe the bug
I followed the steps in the document to import NativeAudio, but encountered an error. According to the error prompt, I couldn't find NativeAudio?
And when I delete: import {NativeAudio} from '@ capgo/native audio', it returns to normal

To Reproduce
Steps to reproduce the behavior:

  1. pnpm install @capgo/native-audio
  2. npx cap sync
  3. import {NativeAudio} from '@capgo/native-audio'
  4. Console error

Expected behavior
No errors will be reported during import

Screenshots
截图 2024-06-27 13-08-38

Desktop (please complete the following information):

  • OS: [linux]
  • Browser [chrome]
  • Version []

Smartphone (please complete the following information):

  • Device: [Huawei P30]
  • OS: [Android13]
  • Browser [chrome]
  • Version []

Additional context
capacitor-community/native-audio#92
I also have the same issue in another plugin (@ capacitor community/native audio). Through this issue, I tried to change the imported file, but still encountered an error

TypeError: this.notifyListeners is not a function

I am getting errors like below

TypeError: this.notifyListeners is not a function

triggered from this method:

Audio.onEnded

after upgrading to

  1. capacitor v6
  2. (ionic v8)
  3. (angular v17)
image

plugin version:

"@capgo/native-audio": "^6.4.4",

Here is my native-audio usage:

import { Injectable } from '@angular/core';
import { getIsSoundEffectsOn$ } from './preferences';
import { NativeAudio } from '@capgo/native-audio';
import { Haptics, ImpactStyle } from '@capacitor/haptics';

@Injectable({
  providedIn: 'root'
})
export class AudioService {

  public isSoundEffectsOn = false;

  constructor() {
    this.preloadAudio('click', 'assets/sounds/click.mp3');
    this.preloadAudio('toggle', 'assets/sounds/toggle.mp3');
    this.preloadAudio('success', 'assets/sounds/success.wav');
    this.preloadAudio('failure', 'assets/sounds/failure.wav');

    getIsSoundEffectsOn$().then(isOn => {
      this.isSoundEffectsOn = isOn;
    }).catch(error => {
      console.error('Error fetching sound effects preference:', error);
    });
  }

  private preloadAudio(assetId: string, assetPath: string): void {
    NativeAudio.preload({
      assetId,
      assetPath,
      audioChannelNum: 1,
      isUrl: false
    }).then(() => {
      console.log(`Preloaded ${assetId} successfully.`);
    }).catch(error => {
      console.error(`Error preloading ${assetId}:`, error);
    });
  }

  private async playAudio(assetId: string) {
    if (this.isSoundEffectsOn) {
      try {
        await NativeAudio.play({ assetId });
        console.log(`Playing ${assetId}.`);
      } catch (error) {
        if (assetId !== 'click') {
          console.error(`Error playing ${assetId}:`, error);
        }
      }
    } else {
      console.log(`Sound effects are off. Not playing ${assetId}.`);
    }
  }

  public click(): void {
    Haptics.impact({ style: ImpactStyle.Light });
    this.playAudio('click');
  }

  public toggle(): void {
    Haptics.impact({ style: ImpactStyle.Light });
    this.playAudio('toggle');
  }

  public success(): void {
    Haptics.impact({ style: ImpactStyle.Medium });
    this.playAudio('success');
  }

  public failure(): void {
    this.playAudio('failure');
  }
}

used with a directive:

import {Directive, HostListener} from '@angular/core';
import {AudioService} from '../services/audio-service';

@Directive({
  selector: '[clickSound]',
  standalone: true,
})
export class ClickSoundDirective {
  constructor(private audioService: AudioService) {
  }
  @HostListener('click', ['$event']) onClick(){
    this.audioService.click();
  }
}

Where to place audio files?

Hi there,

It's not at all clear where you should place the audio files, or what path to use to point to them? Putting them "with the rest of [my] source" doesn't really clear it up, as doing that, without then copying those files into the iOS or Android assets in the right places, doesn't work for my setup (Vite and Capacitor).

Any pointers that you could give in the docs?

Web error on audio end - TypeError: this.notifyListeners is not a function

Describe the bug
When an audio file finishes playing on web, the following error is logged to the console:

Uncaught TypeError: this.notifyListeners is not a function
    at Audio.onEnded (web-Y6QFRADA.js?v=8a6a27d7:76:10)

To Reproduce
Steps to reproduce the behavior:

  1. Load a sound file on web and play it
  2. Wait for the sound to finish playing

Expected behavior
No error to be logged

Screenshots
N/A

Desktop (please complete the following information):
Windows 11
Chrome 126

Smartphone (please complete the following information):
N/A

Additional context
Issue seems to have been introduced by this commit:
4d1e720

[Android] `await NativeAudio.configure(...)` doesn't return

Describe the bug
When calling await NativeAudio.configure(...) the promise never returns

To Reproduce
Steps to reproduce the behavior:

  1. call configure with await

Expected behavior
The configure method should be either not return a promise in typescript or returned when awaited

Screenshots
N/A

Smartphone (please complete the following information):

  • Device: Samsung S20
  • OS: Android 13

Additional context
I have tried to add call.resolve() in configure in NativeAudio.java at the end of the configure method and it seems to solve this issue, but I'm not sure what was intended here.
Let me know if you want me to open a PR.

image

Setting "focus" to false breaks audio

The problem
The plugin works as a charm until you try to use the interesting part : mix audios

To Reproduce
Preload sounds, keep focus set to its default value (true), it is working correctly.
Set focus to false using configure, sounds are no longer triggered.

Expected behavior
Passing "focus: false" in configure should enable sound mixing

Smartphone:

  • Device: iPhone 15 | mi9T Pro
  • OS: iOS | Android
  • Version 17.0 | 11.0

iOS - sounds do not respect the hardware mute switch

In the current version, the mute switch on an iPhone has no effect and the sound plays regardless.

Describe the solution you'd like
It should be possible to mute sounds when the hardware switch is set to "mute"

capacitor 5 Error: "NativeAudio" plugin is not implemented on android

Describe the bug
Hello after update my project to cap 5 and update "Cap-go/native-audio" to 6.0.8 I get this error on when call NativeAudio any method

I'm sure about cap sync and cap update

This problem only happen when we publish the app on play store with aab build ( akp not tested in play store because tehere is no way anymore for upload apk in play store )

here is part of my package.json

"@capacitor/android": "^5.0.4",
"@capacitor/app": "^5.0.2",
"@capacitor/core": "^5.0.4",
"@capacitor/ios": "^5.0.4",
"@capgo/native-audio": "^6.0.7",
"@ionic/core": "^7.0.9",
"@ionic/vue": "^7.0.9",

Asset is not loaded

Describe the bug
When running the application on iOS my application loads, shows the main menu screen and then freezes due to an error being thrown. When removing all calls to this package the application works as expected (albeit no sound, obviously).

The asset path seems to be set up correctly and the files exist there. I'm not attempting to play them directly after load either so I'm not sure as to why this error is being thrown.

All of this works on Android for the record.

2023-07-30 03:46:09.402014+0100 App[30814:297264] KeyboardPlugin: resize mode - native
2023-07-30 03:46:09.456596+0100 App[30814:297264] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000004e8fe0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
⚡️  Loading app at capacitor://localhost...
⚡️  WebView loaded
⚡️  To Native ->  NativeAudio preload 12064351
⚡️  To Native ->  NativeAudio preload 12064352
⚡️  To Native ->  NativeAudio preload 12064353
⚡️  To Native ->  NativeAudio preload 12064354
⚡️  To Native ->  NativeAudio preload 12064355
⚡️  To Native ->  NativeAudio preload 12064356
⚡️  To Native ->  NativeAudio preload 12064357
⚡️  To Native ->  NativeAudio loop 12064358
⚡️  To Native ->  NativeAudio stop 12064359
⚡️  To Native ->  NativeAudio loop 12064360
⚡️  To Native ->  NativeAudio preload 12064361
⚡️  To Native ->  NativeAudio preload 12064362
ERROR MESSAGE:  {"message":"Asset is not loaded - public\/sounds\/music\/in-menu-loop.wav","errorMessage":"Asset is not loaded - public\/sounds\/music\/in-menu-loop.wav"}
ERROR MESSAGE:  {"errorMessage":"Asset is not loaded - public\/sounds\/music\/in-menu-loop.wav","message":"Asset is not loaded - public\/sounds\/music\/in-menu-loop.wav"}
⚡️  [error] - {"message":"Asset is not loaded - public/sounds/music/in-menu-loop.wav","errorMessage":"Asset is not loaded - public/sounds/music/in-menu-loop.wav"}
⚡️  [error] - {"errorMessage":"Asset is not loaded - public/sounds/music/in-menu-loop.wav","message":"Asset is not loaded - public/sounds/music/in-menu-loop.wav"}
⚡️  To Native ->  App addListener 12064363
⚡️  To Native ->  Keyboard getResizeMode 12064364
⚡️  TO JS {"mode":"native"}
⚡️  TO JS undefined
⚡️  TO JS undefined
⚡️  TO JS undefined
⚡️  TO JS undefined
⚡️  TO JS undefined
⚡️  TO JS undefined
⚡️  TO JS undefined
⚡️  TO JS undefined
(lldb) 

The debugger lands here and shows this error:
image

To Reproduce
Steps to reproduce the behavior:

  1. Load an asset using the preload method.
  2. I'm seeing the error here despite not playing it.

Expected behavior
The sound plays and the app loads as normal.

Desktop (please complete the following information):

  • OS: macOS Ventura 13.5

Smartphone (please complete the following information):

  • Device: iPhone 14 Pro (Simulator)
  • OS: iOS 16.4

Additional context
Here's the source code that actually loads/interacts with the assets.

class Sound {
    asset: Sounds;

    /**
     * Create a new sound.
     * @param asset Path to the sound file
     * @returns
     */
    constructor(asset: Sounds, config: SoundConfig = defaultConfig) {
        const { volume, voices, delay, autoplay } = _.defaults(config, defaultConfig);

        this.asset = asset;

        NativeAudio.preload({
            assetId: this.asset,
            assetPath: this.asset
        });

        return this;
    }

    /**
     * Play sound.
     */
    play() {
        NativeAudio.play({ assetId: this.asset });
    }

    /**
     * Loop sound.
     */
    loop() {
        NativeAudio.loop({ assetId: this.asset });
    }

    /**
     * Stop sound.
     * This will also restart the sound next time it is played.
     */
    stop() {
        NativeAudio.stop({ assetId: this.asset });
    }

    /**
     * Destroy the sound instance.
     */
    destroy() {
        NativeAudio.unload({ assetId: this.asset });
    }
}

Crash issues in preload audio on iOS with version 6.1.16 and audio issues with vidyo.io video call on version 6.2.7

Description:

Hello,

I am experiencing issues with the @capgo/native-audio library on iOS with Ionic 7 and angular 17

Problem 1: Crash Issues

Version: 6.1.16
Description: The app crashes when preloading audio.
Steps to Reproduce:
Call the preload method.
Observe the crash.

Problem 2: Audio Issues with vidyo.io Video Call

Version: 6.2.7
Description: After updating to 6.2.7, the crash issue is resolved. However, the audio for vidyo.io video calls stops working.
Steps to Reproduce:
Update to version 6.2.7.
Initiate a vidyo.io video call.
Observe that the audio is not working.

iOS Version: Issue obtained in 16 and 17
XCode version 15.3
Please let me know if you need any further information or assistance in reproducing these issues.

Thank you!

capacitorExports is not defined

Describe the bug
I just install your package, and try to play an audio file.
I got this error : capacitorExports is not defined
And also Uncaught (in promise) AssetId already exists. Unload first if like to change!

I'm working with NextJs and capacitorJs
"@capacitor/core": "^4.6.3",
"next": "13.1.6",

In my file :
import { NativeAudio } from "@capgo/native-audio";
NativeAudio.preload({ assetId: "medusa", assetPath: '../../sounds/medusa.mp3', audioChannelNum: 1, isUrl: false, });
NativeAudio.play({ assetId: "medusa", // time: 6.0 - seek time });

I can't build to try on android or ios, so actually I run my code with npm run dev

If anyone have an idea.
Thanksss

Audio Asset already exists error message

Describe the bug
I'm getting a weird error message when using the plugin:
Audio Asset already exists

To Reproduce
My code is as follows, very simple basically - configure then preload as can be seen here:
https://github.com/IsraelHikingMap/Site/blob/83f9795ecc065dc3437b529243307e29361bdea5/IsraelHiking.Web/src/application/services/audio-player.factory.ts#L23

Expected behavior
No error should be raised.

Smartphone (please complete the following information):

  • Device: Samsung SM-G998B
  • OS: Android 13

Additional context
I've looked in the past at the code and couldn't find a place where this error is returned which would make sense.
Any help would be appreciated.
This doesn't always happen according to the logs I've got from some clients, I'm running this code when the app starts once, so I don't expect the audio file to already exist...
IDK...

Play in Background

Describe the bug
In background mode, play does not work e.g. an audible alarm can not be played.

To Reproduce
Steps to reproduce the behavior:

  1. Switch an App off (Background) the sound stops playing.

iOS - Fatal error: Unexpectedly found nil while unwrapping an Optional value

Describe the bug
I am getting the above error when I try to preload mp3 files.

To Reproduce

  1. Add the plugin.
  2. Preload an mp3 from eg assets/sounds/music.mp3
  3. Build and launch app on iOS
  4. Observe fatal error

Expected behavior
The file preloads properly and the application doesn't crash. NB. The issue does not occur in v5.1.3

Smartphone (please complete the following information):
iPhone running latest iOS 16

Additional context
This is the line which throws the error

let pathUrl: URL = URL(string: path)!

Audio is not played

In my project with capacitor 3 (due to serial bluetooth) there is a problem, where no error is shown but the sound does not play, I analyzed everything but nothing happens, and before it worked normally.

Thanks in advance.

Ps: I need to solve it urgently.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency prettier-plugin-java to v2.6.4
  • chore(deps): update dependency rimraf to v5.0.10
  • chore(deps): update dependency husky to v9.1.4
  • chore(deps): update dependency typescript to v5.5.4
  • chore(deps): update dependency rimraf to v6
  • chore(deps): update typescript-eslint monorepo to v8 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

cocoapods
ios/Podfile
github-actions
.github/workflows/build.yml
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
  • actions/setup-java v3
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
  • rxfork/npm-publish v1
  • rxfork/npm-publish v1
.github/workflows/bump_version.yml
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
.github/workflows/test.yml
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
  • actions/setup-java v3
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
gradle
android/gradle.properties
android/settings.gradle
android/build.gradle
  • com.android.tools.build:gradle 8.2.2
gradle-wrapper
android/gradle/wrapper/gradle-wrapper.properties
  • gradle 8.2.1
npm
package.json
  • @capacitor/android ^6.0.0
  • @capacitor/cli ^6.0.0
  • @capacitor/core ^6.0.0
  • @capacitor/docgen ^0.2.2
  • @capacitor/ios ^6.0.0
  • @ionic/eslint-config ^0.3.0
  • @ionic/prettier-config ^4.0.0
  • @ionic/swiftlint-config ^1.1.2
  • @types/node ^20.12.7
  • @typescript-eslint/eslint-plugin ^7.8.0
  • @typescript-eslint/parser ^7.8.0
  • eslint ^9.1.1
  • eslint-plugin-import ^2.29.1
  • husky ^9.0.11
  • prettier ^3.2.5
  • prettier-plugin-java ^2.6.0
  • rimraf ^5.0.5
  • rollup ^4.17.1
  • swiftlint ^1.0.2
  • typescript ^5.4.5
  • @capacitor/core ^6.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

"Eating up" the first fractions of a second of audio on iOS

Describe the bug
After updating from 6.0.19 to 6.1.8 the audio started to "eat up" the first fractions of a second.

To Reproduce
Steps to reproduce the behavior:

  1. Try to play short mp3 audio file without any silence in the beginning on iOS. File showed on the video can be downloaded from here.
  2. You will not be able to hear the first fractions of a second of the audio. The problem is clearly audible in this video.

Expected behavior
Audio is played completely from start to finish, without cutting anything off. You can hear expected behaviour on the same device, same iOS, same project, but with with version 6.019 on this video.

Desktop (please complete the following information):
Desktop is ok - tested on Chrome / Mac.

Smartphone (please complete the following information):

  • Device: iPhone 13 Mini
  • OS: iOS 17.0.3
  • Capacitor 5.5.1
  • Version 6.1.8

Additional context
Didn't test on Android.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.