Giter Club home page Giter Club logo

Comments (7)

tomtastico avatar tomtastico commented on June 2, 2024 1

Getting this too, so far no luck finding out why... it seems in debug mode the app doesn't crash even on device, only in release.

from nativescript-audio.

aaayushsingh avatar aaayushsingh commented on June 2, 2024 1

@tomtastico I made a super hacky(and bad) fix that in no way should be taken to production unless extremely urgent. However, in my case it was urgent so I was left with no choice.

You can check out my fork and to add it to project use tns plugin add https://github.com/aaayushsingh/nativescript-audio

But avoid this unless necessary

from nativescript-audio.

tomtastico avatar tomtastico commented on June 2, 2024 1

In the end we switched to this fork of nativescript-sound https://github.com/forgm/nativescript-sound and it works fine with no crashes in iOS. We don't need audio recording so this is enough for us.

from nativescript-audio.

govi2010 avatar govi2010 commented on June 2, 2024 1

@farfromrefug Thank you for guidance. I am trying this right now. If it works then I will send PR.

from nativescript-audio.

aaayushsingh avatar aaayushsingh commented on June 2, 2024

The issue can be replicated multiple times. When running with Xcode, it gives EXC_BAD_ACCESS

I tried tinkering with the code and the issue occurs with the AVAudioSessionDelegate. You can also see this in the screenshots of the crash log below that the error occurs at finishedPlaying.

My initial thought was this was because the WeakRef was somehow getting garbage collected(this was a past known issue with NativeScript) and attempts to access were thus resulting in EXC_BAD_ACCESS but I tried to change that and the crashes were still happening. If we however comment out the line that adds delegate to AVAudioPlayer, The app doesn't crash after the audio finishes playing.

Still not 100% sure about the cause of the error

Screen Shot 2020-12-22 at 2 20 26 PM
Screen Shot 2020-12-22 at 2 19 54 PM
Screen Shot 2020-12-22 at 2 17 20 PM
Screen Shot 2020-12-22 at 2 05 30 PM

from nativescript-audio.

govi2010 avatar govi2010 commented on June 2, 2024

@aaayushsingh did you find good solution ?

from nativescript-audio.

farfromrefug avatar farfromrefug commented on June 2, 2024

@aaayushsingh @govi2010 reading your comment on the cause of the issue i think it is because the delegate is not retained on the JS side.
Changing

this._player.delegate = TNSPlayerDelegate.initWithOwner(this);

to

this.delegate = TNSPlayerDelegate.initWithOwner(this);
this._player.delegate = this.delegate;

could make it not crash however you must add the clearing of the delegate once the object is released

from nativescript-audio.

Related Issues (20)

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.