Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes when it regains audio focus while in the background on android 14 #847

Open
hmukwana opened this issue Sep 8, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@hmukwana
Copy link

hmukwana commented Sep 8, 2024

Flutter Version

My version : 3.24

Lib Version

My version : 3.0.0

Platform (Android / iOS / web) + version

Platform : Android 14

Describe the bug

App crashes when it tries to resume playback after regaining audio focus while still in the background.

Small code to reproduce

import 'package:assets_audio_player/assets_audio_player.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State {
  
  final AssetsAudioPlayer _assetsAudioPlayer = AssetsAudioPlayer();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: RaisedButton(
            child: Text("open"),
            onPressed: () {
              Audio audio = Audio.network(
        newSermon.mediaLink ?? '',
        metas: Metas(
          id: id.toString(),
          title: title,
          album: albumName,
          image: artLink,
        ),
      );

    audioPlayer.open(
      audio,
      showNotification: true,
      notificationSettings: NotificationSettings(
    );
            }
          ),
        ),
      ),
    );
  }
}
@hmukwana hmukwana added the bug Something isn't working label Sep 8, 2024
@mdkamal054
Copy link

Did you found any solution brother
im also encounter this problem

@SteevenAlbert
Copy link

SteevenAlbert commented Oct 11, 2024

Facing the same problem here. Has anyone figured it out yet? That's a very critical bug.

Sample scenario:
1- User playing audio in background
2- User receives an incoming call
3- User finishes the call.
4- Background audio notification is no longer visible, due to the app crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants