audio_service icon indicating copy to clipboard operation
audio_service copied to clipboard

Warning from iOS app: [NowPlaying] [MRNowPlaying] Ignoring setPlaybackState because application does not contain entitlement com.apple.mediaremote.set-playback-state for platform

Open thecodinglinguist opened this issue 2 years ago • 19 comments

Documented behavior

Not part of the documentation

Actual behavior

Warning logs when interacting with player pause/play.

Runtime error

[NowPlaying] [MRNowPlaying] Ignoring setPlaybackState because application does not contain entitlement com.apple.mediaremote.set-playback-state for platform

Minimal reproduction project

Official example: main.dart

Reproduction steps

  1. Click Play
  2. Click Pause

The entitlement warning will appear with each click.

Output of flutter doctor

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.64.2)
[✓] Connected device (3 available)```
### Devices exhibiting the bug
Device: iPad Pro (10.5-inch) OS: 15.3.1
Device: iPhone 6s OS: 15.2.1

thecodinglinguist avatar Mar 04 '22 13:03 thecodinglinguist

Anyone got anything on this issue by now ?

Yousuf-M-Hammad avatar Apr 25 '22 03:04 Yousuf-M-Hammad

I think there is a pull request addressing this, I'll check when I'm back at my computer. But from memory the solution in that pull request didn't produce the desired behaviour even though it got rid of the warning.

ryanheise avatar Apr 25 '22 04:04 ryanheise

I was getting this error, and the control center wasn't appearing on a real iOS device, only simulator. I thought the two were related. However, I simply had to use audio_session to configure the session for music

session.configure(AudioSessionConfiguration.music());

After doing this, the controls appeared within iOS media center and lock screen fine.

Given this, does anybody know what the implications of this error are?

Colton127 avatar Jun 12 '22 16:06 Colton127

Thanks @Colton127 for sharing that audio_session resolves the issue.

Regarding the error/warning, it has been discussed on the following pull request: #900 . Contributions welcome.

ryanheise avatar Jun 12 '22 16:06 ryanheise

@Colton127's solution did not work for me. Facing same issue on iOS when seeking new position in track.

mem3Dealer avatar Jan 14 '23 05:01 mem3Dealer

Having the same issue for play/pause and skipToNext/skipToPrevious

[NowPlaying] [MRNowPlaying] Ignoring setPlaybackState because application does not contain entitlement com.apple.mediaremote.set-playback-state for platform

leonidlist avatar Apr 05 '23 15:04 leonidlist

same here @leonidlist . Did you find a solution?

mhassan772 avatar Apr 10 '23 04:04 mhassan772

@ryanheise any update? https://github.com/ryanheise/just_audio/issues/1001

shahmirzali49 avatar May 28 '23 15:05 shahmirzali49

I'm also experiencing this warning message while using a physical iOS device plugged in to my Macbook

zeddyyz avatar Jun 01 '23 04:06 zeddyyz

Same here, how can we help?

enedrio avatar Jun 08 '23 09:06 enedrio

Same Here. Any Solution So Far...??? I am using this: https://pub.dev/packages/just_audio_background

EXEIdeas avatar Jun 12 '23 10:06 EXEIdeas

Same here using audio_session combined with audioplayers

sudo-ulmas avatar Jun 21 '23 16:06 sudo-ulmas

UPDATE: kinda false alarm here. Issue can be solved one time only, and for the second audio playback and sesion configuration it's still there. Any help appreciated. And even calling await session?.setActive(false); method before configuring audio session does not help.

I was facing the same issue and fixed it by leaving only ONE option to configure audio_session. Didn't figure it out to the end, but looks like it was some options that conflict as described here.

Full error log from Flutter was:

[as_client]     AVAudioSession_iOS.mm:2386  Failed to set category, error: -50
Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
[NowPlaying] [MRNowPlaying] Ignoring setPlaybackState because application does not contain entitlement com.apple.mediaremote.set-playback-state for platform

The final code that works was:

    try {
      await _session?.configure(
        AudioSessionConfiguration(
          avAudioSessionCategory: AVAudioSessionCategory.playback,
          // The following lines was commented as they produced an error
          // avAudioSessionRouteSharingPolicy:
          //     AVAudioSessionRouteSharingPolicy.defaultPolicy,
          // avAudioSessionCategoryOptions:
          //     AVAudioSessionCategoryOptions.duckOthers,
          // avAudioSessionMode: AVAudioSessionMode.defaultMode,
          // avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none,
          androidAudioAttributes: const AndroidAudioAttributes(
            contentType: AndroidAudioContentType.movie,
            flags: AndroidAudioFlags.none,
            usage: AndroidAudioUsage.media,
          ),
          androidAudioFocusGainType:
              AndroidAudioFocusGainType.gainTransientMayDuck,
          androidWillPauseWhenDucked: isAndroidWillPauseWhenDucked,
        ),
      );

      session?.setActive(true);
    } on PlatformException catch (e) {
      debugPrint('AUDIO MANAGER AUDIOSESSION CONFIGURE ERROR: ${e.toString()}');
    }

It STILL generates an error in logs, but at least it works now in the real app and not only in the emulator.

I was using audio_service 0.18.12 and upgrading it to actual from 0.18.9 didn't solve the problem.

anatoliisudor avatar Sep 20 '23 16:09 anatoliisudor

I am facing the same issue, did someone find a workaround?

MaxenceChantome avatar Oct 05 '23 22:10 MaxenceChantome

Hello @ryanheise Sorry, I don't have any understanding of the iOS implementation. But there seems to be a possible solution from JonMercer in this thread. He suggests not to assign the MPNowPlayingInfoCenter.default().playbackState on iOS because this property only applies to macOS. Here's the assignment in audio_service: https://github.com/ryanheise/audio_service/blob/544e2f8d2d28203a74d3cbda709889b3c9cce1a2/audio_service/darwin/Classes/AudioServicePlugin.m#L292C8-L292C8 Can you please consider if it's a viable solution for this issue? Thank you.

serhii-k avatar Nov 06 '23 20:11 serhii-k

@ryanheise hey bro, do you have any time to check this ? greatlu appreaciated

jhonatan-3a avatar Nov 15 '23 15:11 jhonatan-3a

There's a pr in #900 but it needs some changes as described in the discussion on that page, if someone would like to help. It would make a good first issue for a new contributor.

As it is, the warning itself should not actually cause problems but it would be nice to clean it up.

ryanheise avatar Nov 15 '23 15:11 ryanheise

thanks for the response but actually my issue is this one MSVEntitlementUtilities - Process Harmonie PID[28383] - Group: (null) - Entitlement: com.apple.mediaremote.external-artwork-validation - Entitled: NO - Error: (null) i am also using just audio background and just audio, and this seems to be only happening on ipad, do you know anuything about this error ?

jhonatan-3a avatar Nov 15 '23 15:11 jhonatan-3a

I'm sorry, I didn't realise you were posting an off topic comment. I will hide your comment and my comment as off topic. Please keep this in mind for future comments.

ryanheise avatar Nov 15 '23 23:11 ryanheise