florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
752 stars 357 forks source link

Icons in the buttons are not displayed in the notification widget on ios #764

Closed Ellweb3 closed 1 year ago

Ellweb3 commented 1 year ago

Flutter Version

My version : 3.3.10 Lib Version

My version :

Platform (Android / iOS / web) + version

Platform : IOS 16.2 Describe the bug

Icons in the buttons (play, previousTrack, nextTrack) are not displayed in the notification widget on ios in example and in my app. They can be pressed, but only to the touch.

Here the screenshot 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: () {
            try {
                          await _assetsAudioPlayer.open(
                            myAudio,
                            autoStart: true,
                            showNotification: true,
                            playInBackground: PlayInBackground.enabled,
                            audioFocusStrategy: AudioFocusStrategy.request(
                                resumeAfterInterruption: true,
                                resumeOthersPlayersAfterDone: true),
                            headPhoneStrategy: HeadPhoneStrategy.pauseOnUnplug
                          );
                        } catch (e) {
                          print(e);
                        }
            }
          ),
        ),
      ),
    );
  }
}
benjitusk commented 1 year ago

@florent37 This is a huge problem that is a deal breaker for this library. If you can point me in the right direction, I'll be more than happy to fix it.

Adrian5er commented 1 year ago

use:

notificationSettings: NotificationSettings(playPauseEnabled: true, prevEnabled: false, nextEnabled: false, stopEnabled: false, seekBarEnabled: false,),

Ellweb3 commented 1 year ago

use: > > notificationSettings: NotificationSettings(playPauseEnabled: true, prevEnabled: false, nextEnabled: false, stopEnabled: false, seekBarEnabled: false,),

@Adrian5er thanks for your response, but the thing is that the buttons themselves are in the widget and can be clicked, but the icons of these buttons are not displayed (Maybe they need to be somewhere to determine - I have not found unfortunately where to do it

Ellweb3 commented 1 year ago

I apologize - the problem was only in the simulator Xcode, on testfligth no such problem