Skip to content

iOS caps voice messages at 3 minutes while Android and Desktop use 5 #781

Description

@mpretty-cyro

Summary

iOS caps voice message recording at 180 seconds. Android and Desktop both cap at 300 seconds. iOS is the sole outlier, and the cap is not exposed as a setting on any platform, so users hitting it have no workaround.

The iOS timer does not discard the recording when it fires — it calls endVoiceMessageRecording(), which sends what was captured. The result is a delivered, mid-sentence voice message rather than an error, so the behaviour reads as a bug to the user. The recording UI's duration label ticks every 0.5s, so the last value shown before it cuts is 2:59.

Current values

Client Cap Source
iOS 180s Session/Conversations/ConversationVC+Interaction.swift:2955
Android 300s app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt:2719
Desktop 300s ts/session/constants.ts:84 (MAX_VOICE_MESSAGE_DURATION)
// Limit voice messages to a minute
audioTimer = Timer.scheduledTimer(withTimeInterval: 180, repeats: false, block: { [weak self] _ in
    DispatchQueue.main.async { [weak self] in
        self?.snInputView.hideVoiceMessageUI()
        self?.endVoiceMessageRecording()
    }
})

(The comment is stale — 593ab49 bumped the value 60 → 180 on 2021-08-03 and left it untouched.)

Why 180 is safe to raise

The cap exists to keep a voice message inside the 10MB attachment limit (SessionNetworkingKit/Types/Network.swift:138, maxFileSize = 10_000_000, enforced against the encrypted size, with Crypto+Attachments.swift:115 padding plaintext to the next power of 1.05).

iOS records AAC 44.1kHz stereo at 128 kbps (ConversationVC+Interaction.swift:2940-2949) = 16,384 B/s:

Duration File size % of 10MB cap
180s (current) 2.95 MB 29.5%
300s (proposed) 4.92 MB 49.2%
581s ~9.5 MB ~100%

So 300s leaves roughly half the budget spare. For comparison, Desktop's own comment documents its 300s cap as "which equates to 1.97 MB" — iOS's current 180s recording is already 50% larger than Desktop's full 5-minute one.

Proposed change

Change withTimeInterval: 180 to 300 in startVoiceMessageRecording(), and fix the stale comment above it.

Follow-ups worth considering separately

  1. iOS records voice notes in stereo at 128 kbps. Android uses mono at 32 kbps and Desktop is around 52 kbps. Mono is indistinguishable for speech and would cut file size ~4×, making the duration cap a non-issue at any plausible length. This is arguably the more valuable change.
  2. The cap is a hard-coded duration in a view controller. Deriving it from Network.maxFileSize and the encoder settings would stop it drifting out of step with the limit it is supposed to come from — which is what happened here.
  3. No client warns that a cap exists or that it is approaching. Hitting it silently truncates and sends.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions