Skip to content

Conversation

@khushal87
Copy link
Member

@khushal87 khushal87 commented Nov 13, 2025

This pull request refactors and modernizes the audio attachment components, improving state management, playback control, and code clarity. The most significant changes are the migration to a centralized audio player state store, deprecation of legacy callback props, and improved handling for both audio and voice recording attachments. These updates enhance maintainability and user experience across both Expo and native platforms.

Starting this PR, integrators can choose to have only a single player instance at a time which can be controlled using the allowConcurrentAudioPlayback prop of the Channel component where false is the new default. This behaviour is done in parity with React SDK and as per decision.

Audio Attachment Component Refactor and State Management Improvements

  • Migrated audio playback state (play/pause, progress, duration, playback rate) from local props and callbacks to a centralized state store via useAudioPlayerControl and useStateStore, removing the need for deprecated callback props like onLoad, onPlayPause, and onProgress. [1] [2]
  • Updated UI and logic to use new state values (isPlaying, progress, duration, currentPlaybackRate) for rendering controls, progress bars, and playback speed, replacing legacy props and local state. [1] [2] [3] [4] [5]

Voice Recording and Audio Attachment Handling

  • Improved detection and handling of voice recordings using the new isVoiceRecordingAttachment helper, ensuring correct duration and title display, and simplifying logic for both audio and voice recording types. [1] [2]

File Attachment Group Updates

  • Deprecated legacy callback props (onLoad, onProgress) in FileAttachmentGroup, updating documentation and usage to encourage migration to the new state management approach. Also added message prop for better context handling. [1] [2] [3]

Native and Expo Audio Player Integration

  • Improved Expo audio player integration by subscribing to status events earlier and fixing seek logic to use seconds instead of milliseconds, ensuring more accurate playback control. [1] [2] [3]

Progress and Wavefrom progress control performance

Improved the progress and waveform progress bar performance by 10x as previously the animations were slow and not adhereing to the pattern that could make it fast.

These changes collectively modernize the audio attachment experience, making it more robust and easier to maintain.

@Stream-SDK-Bot
Copy link
Contributor

Stream-SDK-Bot commented Nov 13, 2025

SDK Size

title develop branch diff status
js_bundle_size 292 KB 301 KB +9504 B 🔴

@khushal87 khushal87 marked this pull request as ready for review November 13, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants