Skip to content

Voice messages: register as Now Playing so a playlist continues while locked - #2408

Open
dallo28 wants to merge 1 commit into
TelegramMessenger:masterfrom
dallo28:fix/voice-now-playing
Open

dallo28 wants to merge 1 commit into
TelegramMessenger:masterfrom
dallo28:fix/voice-now-playing

Conversation

@dallo28

@dallo28 dallo28 commented Oct 27, 2026

Copy link
Copy Markdown

Fixes https://bugs.telegram.org/c/66358: on CarPlay with the iPhone locked, playback stops after the first voice message. The next message is selected but no sound follows. It works with the phone unlocked, and music files in a row keep playing.

Cause

When a voice message ends, the playlist creates the next item's player. Its audio session holder is pushed and the session activates without an error, then nothing plays. The log has no deactivation, interruption or route change after that point. Reproduced with Apple's CarPlay Simulator and an iPhone 17 Pro Max on iOS 27, using the App Store build:

  • voice messages, phone locked: stops after the first message;
  • the same at 1x speed and with Raise to Listen off: same result;
  • the phone unlocked: plays through;
  • music files in a row, phone locked: plays through.

Music and voice share the player and the audio session setup. The one remaining difference relevant here is that only music registered Now Playing info and remote commands (MediaManager limited both to type == .music). The playback code itself hasn't changed in this area since 12.4.

Change

MediaManager treats the voice playlist like music for Now Playing:

  • Now Playing info and remote commands (play/pause, next/previous, seek) are registered for .voice as well. The voice playlist also carries round video messages, so they are included.
  • Title is the sender's name. Subtitle is "Voice Message" (Message.Audio) or "Video Message" (Message.VideoMessage), or the group's name, following the in-app player bar. The voice and video cases already existed but were unreachable, and used debugDisplayTitle.
  • Names follow the notification privacy rule: when "Names on lock-screen" is off (InAppNotificationSettings.displayNameOnLockscreen) or the app is passcode-locked, the entry shows only "Voice Message" or "Video Message", with no sender or group. MediaManagerImpl now takes isPasscodeLocked from the app lock context for this.
  • The reported playback rate is the player's base rate instead of a fixed 1.0, so the elapsed time stays right at 1.5x and 2x.
  • Remote commands that start playback (play, toggle, next, previous) are refused while a voice message is being recorded. A paused voice playlist stays alive during recording, and starting it would push a playback session over the recorder's and stop the recording. This is the same case the proximity handler in SharedMediaPlayer already guards.

Users now see voice and video messages in Control Center, on the lock screen and in CarPlay's Now Playing while they play.

Testing

  • iOS 27 simulator, debug build: playing voice messages in a row with the device locked. A temporary log confirmed the Now Playing info is set for the voice playlist (removed before commit), and playback continued through the queue. The simulator's lock screen doesn't render Now Playing, so the widget itself wasn't checked there.
  • Not yet tested on a device with CarPlay.
… locked

On CarPlay with the device locked, a voice message playlist stopped after its
first item: the next item got the audio session, but no sound followed. Music
was registered as Now Playing and kept playing; voice messages were not.

Register the voice playlist (voice and round video messages) for Now Playing
and remote commands, like music:
- title is the sender, subtitle "Voice Message" / "Video Message" or the group;
- no names when "Names on lock-screen" is off or the app is passcode-locked;
- the reported playback rate is the player's base rate;
- remote commands that start playback are refused while recording, so they
  can't take the audio session from the recorder.

Fixes https://bugs.telegram.org/c/66358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant