Code Monkey home page Code Monkey logo

Comments (26)

ryanheise avatar ryanheise commented on July 21, 2024 5

Can you try the latest commit? In your pubspec.yaml use the following dependency override:

dependency_overrides:
  audio_session:
    git:
      url: https://github.com/ryanheise/audio_session.git

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024 3

Great! Thanks for helping to test this. I'll put out a new release now.

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024 3

The fix has now been published as release 0.1.1.

Note, the next release will probably be 0.2.0 which will move to the new rxdart.

from audio_session.

BringTheChill avatar BringTheChill commented on July 21, 2024 1

I fixed this issue replacing this package with assets_audio_player. Thank you for your support! I will let this issue open in case @paurakhsharma wants to continue with this package.

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024 1

Yes, please do leave it open until the issue is resolved.

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024

The problem could be in one of 3 places.

Was there a change in your audio_session version, or a change in audioplayers, or a change in your code?

from audio_session.

BringTheChill avatar BringTheChill commented on July 21, 2024

@ryanheise I updated audio_session and audioplayers to the latest version. Code not changed.

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024

Are you able to downgrade audio_session and test?

from audio_session.

BringTheChill avatar BringTheChill commented on July 21, 2024

I tried to change 0.1.0 with 0.1.0-nullsafety.0 but is the same thing. If I downgrade to 0.0.11 and I run pub get I get this:

Because flutter_cache_manager >=3.0.2 depends on rxdart >=0.26.0 <0.28.0 and flutter_cache_manager >=3.0.0-nullsafety.1 <3.0.2 depends on rxdart ^0.26.0, flutter_cache_manager >=3.0.0-nullsafety.1 requires rxdart >=0.26.0 <0.28.0.

And because cached_network_image >=3.0.0 depends on flutter_cache_manager ^3.0.0 and audio_session >=0.0.10 <0.1.0-nullsafety.0 depends on rxdart >=0.24.1 <0.26.0, cached_network_image >=3.0.0 is incompatible with audio_session >=0.0.10 <0.1.0-nullsafety.0.

So, because bestill depends on both audio_session ^0.0.11 and cached_network_image ^3.0.0, version solving failed.
pub get failed (1; So, because bestill depends on both audio_session ^0.0.11 and cached_network_image ^3.0.0, version solving failed.)

Also, I tried to downgrade audioplayers to 0.18.0 (first release with stable null safety) and nothing.
I do not know if it helps but when audio is interrupted with an audio from system I get this in my console (also, after the audio from system is done):

routeChange detected
audioInterrupt

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024

There were not any major differences between 0.1.0 and the 0.1.0-nullsafety.0 prerelease, so I assume 0.0.11 or earlier was the last version you tried that worked.

Can you test audio_session 0.0.11 and keep everything else unchanged (use your current app code and your current version of audioplayers) and force the above error to disappear using dependency_overrides?

So in particular, can you use a dependency override on rxdart to depend on the newer version of rxdart?

from audio_session.

BringTheChill avatar BringTheChill commented on July 21, 2024

@ryanheise I did it and it's working (with unsound null safety). So what should I do? I need a null safety version tho so I can release my app to beta testers and after this for production.

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024

I'd like to fix it (with your cooperation if you can), are you able to provide a minimal reproduction project that I can clone and run? E.g. By modifying the example to reproduce the bug?

from audio_session.

BringTheChill avatar BringTheChill commented on July 21, 2024

@ryanheise I tried with exemple from this package. You can look at this https://github.com/BringTheChill/example. It's working just on Android not on iOS. (in my project is not working on android either)

from audio_session.

paurakhsharma avatar paurakhsharma commented on July 21, 2024

Can confirm, We upgraded from version audio_session: ^0.0.11 to audio_session: ^0.1.0 and facing same issue on iOS.

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024

Thank you for the reproduction project. Just to confirm if I understand correctly, your example works if I downgrade the dependencies? What specifically were you testing as the source of the audio interruptions?

from audio_session.

BringTheChill avatar BringTheChill commented on July 21, 2024

your example works if I downgrade the dependencies?

yes

What specifically were you testing as the source of the audio interruptions?

Siri voice (I hope I understood your question)

from audio_session.

paurakhsharma avatar paurakhsharma commented on July 21, 2024

What specifically were you testing as the source of the audio interruptions?

Spotify, just as #27

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024

This is quite puzzling. I have compared the diffs between 0.0.11 and 0.1.0 and the logic is pretty much the same.

May I ask if you are seeing this log message appear from the objective C code?

    NSLog(@"audioInterrupt");

Objective C logs might not appear in the usual Flutter console, so you may need to run this through Xcode to see it.

If that log is happening, then at least we know the even is being received on the platform side and is just getting lost in communication to the Flutter side.

from audio_session.

paurakhsharma avatar paurakhsharma commented on July 21, 2024

I use the session config for speech
with

session.configure(AudioSessionConfiguration.speech())

These are the logs I see:

  1. In vscode
    i) When Spotify takes the focus of the audio audioInterrupt log is displayed in vscode console. My audio player is still playing but is ducked and cannot be heard.
    ii) When I pause Spotify I get the log routeChange detected and then audioInterrupt. Myaudio player doesn't get the volume back (i.e it is playing but cannot be heard)

  2. In Xcode
    Same output. Same result.

Hope it helps.

from audio_session.

BringTheChill avatar BringTheChill commented on July 21, 2024

This is quite puzzling. I have compared the diffs between 0.0.11 and 0.1.0 and the logic is pretty much the same.

May I ask if you are seeing this log message appear from the objective C code?

    NSLog(@"audioInterrupt");

Objective C logs might not appear in the usual Flutter console, so you may need to run this through Xcode to see it.

If that log is happening, then at least we know the even is being received on the platform side and is just getting lost in communication to the Flutter side.

@ryanheise yes I got "audioInterrupt" on my console. I said this in a comment above too.

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024

Ah, yes I missed that you mentioned that. This is I suppose good news because it means the event is being detected at the low levels and it's just failing to make its way up to the higher levels.

There is an intermediate level in the AVAudioSession class. If you listen to the interruption stream directly from this class, do you receive the notifications? i.e.

    AVAudioSession().interruptionNotificationStream.listen((note) {
      print('received interrupt');
      print('type: ${note.type}');
      print('wasSuspended: ${note.wasSuspended}');
    });

from audio_session.

paurakhsharma avatar paurakhsharma commented on July 21, 2024

@ryanheise
We inserted the hooks after audio_session initialization.

 final session = await AudioSession.instance;
 await session.configure(AudioSessionConfiguration.speech());

 AVAudioSession().interruptionNotificationStream.listen((note) {
   print('received interrupt');
   print('type: ${note.type}');
   print('wasSuspended: ${note.wasSuspended}');
 });

We even closed the app and re-run it after making this change.

But we couldn't see this log output.

Here is the log we got instead:

When the audio player starts

routeChange detected

When I open and play Spotify

audioInterrupt

When I pause Spotify

routeChange detected
audioInterrupt

When I go back to the app

dnssd_clientstub read_all(11) DEFUNCT
[VERBOSE-2:FlutterObservatoryPublisher.mm(143)] Could not register as server for FlutterObservatoryPublisher. Check your network settings and relaunch the application.
dnssd_clientstub read_all(20) DEFUNCT
[VERBOSE-2:FlutterObservatoryPublisher.mm(143)] Could not register as server for FlutterObservatoryPublisher. Check your network settings and relaunch the application.
dnssd_clientstub read_all(31) DEFUNCT
[VERBOSE-2:FlutterObservatoryPublisher.mm(143)] Could not register as server for FlutterObservatoryPublisher. Check your network settings and relaunch the application.
dnssd_clientstub read_all(33) DEFUNCT
[VERBOSE-2:FlutterObservatoryPublisher.mm(143)] Could not register as server for FlutterObservatoryPublisher. Check your network settings and relaunch the application.
BackgroundSession <13A7D914-C21A-43B1-AB9D-E60C4C437399> connection to background transfer daemon interrupted
BackgroundSession <13A7D914-C21A-43B1-AB9D-E60C4C437399> connection to background transfer daemon invalidated
BackgroundSession <FD822123-5BED-435D-ADE3-DEE72D3E996D> connection to background transfer daemon interrupted
BackgroundSession <FD822123-5BED-435D-ADE3-DEE72D3E996D> connection to background transfer daemon invalidated
BackgroundSession <B6674567-56BF-48E1-89F9-FC4EFFB3CDC1> connection to background transfer daemon interrupted
BackgroundSession <B6674567-56BF-48E1-89F9-FC4EFFB3CDC1> connection to background transfer daemon invalidated

from audio_session.

ryanheise avatar ryanheise commented on July 21, 2024

OK, I think I may see the issue. Let me try a fix.

from audio_session.

paurakhsharma avatar paurakhsharma commented on July 21, 2024

Thanks, @ryanheise will let you know shortly.

from audio_session.

paurakhsharma avatar paurakhsharma commented on July 21, 2024

@ryanheise Can confirm this is fixed for me. Thank you so much 🎉 🚀

from audio_session.

paurakhsharma avatar paurakhsharma commented on July 21, 2024

Thank you for putting your time and effort to make our life easier 🙂

from audio_session.

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.