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

AudioCache stops playing after some recurrences #865

Open
rickgbw opened this issue May 3, 2021 · 3 comments
Open

AudioCache stops playing after some recurrences #865

rickgbw opened this issue May 3, 2021 · 3 comments
Labels
AudioCache Concerning the AudioCache bug stale Automatically close this issue, if no activity is recognized

Comments

@rickgbw
Copy link

rickgbw commented May 3, 2021

Related to #856

To reproduce, I've created a simple app using audioplayers: ^0.18.3.
This app has only one button that plays a sound.mp3 (6Kb / lass than a second) and a counter for each play:
Testing on Galaxy S9 it stops playing on the # 112 attempt. On Motorola G8 Play, it stops on # 32.

main.dart (Home Widget):

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  AudioCache player = AudioCache(prefix: 'assets/sounds/');
  int count = 0;

  @override
  void initState() {
    super.initState();
    player.load('sound.mp3');
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text(count.toString()),
        ElevatedButton(
          child: Text('PLAY'),
          onPressed: () { 
            setState(() {
              count++;
            });

            print('---- ATTEMPT $count ----');
            player.play('sound.mp3'); 
          },
        )
      ],
    );
  }
}

Debug console (Motorola G8 Play):

I/flutter (22088): ---- ATTEMPT 1 ----
I/flutter (22088): ---- ATTEMPT 2 ----
...
I/flutter (22088): ---- ATTEMPT 30 ----
I/flutter (22088): ---- ATTEMPT 31 ----
I/flutter (22088): ---- ATTEMPT 32 ----
2
E/MediaPlayerNative(22088): error (1, -19)
E/MediaPlayer(22088): Error (1,-19)
E/MediaPlayerNative(22088): pause called in state 0, mPlayer(0x8086c4c0)
E/MediaPlayerNative(22088): error (-38, 0)
E/MediaPlayerNative(22088): Attempt to perform seekTo in wrong state: mPlayer=0x8086c4c0, mCurrentState=0
E/MediaPlayerNative(22088): error (-38, 0)
E/MediaPlayer(22088): Error (1,-19)
2
E/MediaPlayer(22088): Error (-38,0)
@rickgbw rickgbw added the bug label May 3, 2021
@wenxiangjiang
Copy link
Contributor

Is it the same as #843 ?

@rickgbw
Copy link
Author

rickgbw commented May 5, 2021

Is it the same as #843 ?

Yes! It seems to be the same problem

@Gustl22 Gustl22 added the AudioCache Concerning the AudioCache label Jan 21, 2023
@Gustl22
Copy link
Collaborator

Gustl22 commented Apr 24, 2023

Can you retest with version > 1.0.0 ? Maybe not a problem any more...

@Gustl22 Gustl22 added the stale Automatically close this issue, if no activity is recognized label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AudioCache Concerning the AudioCache bug stale Automatically close this issue, if no activity is recognized
Projects
None yet
Development

No branches or pull requests

3 participants