Skip to content

chore: migrate from expo-av to expo-audio and expo-video - #6719

Open
Rohit3523 wants to merge 293 commits into
developfrom
expo-audio
Open

chore: migrate from expo-av to expo-audio and expo-video#6719
Rohit3523 wants to merge 293 commits into
developfrom
expo-audio

Conversation

@Rohit3523

@Rohit3523 Rohit3523 commented Oct 12, 2025

Copy link
Copy Markdown
Member

Proposed changes

Issue(s)

https://rocketchat.atlassian.net/browse/CORE-2035

How to test or reproduce

Screenshots

Senerio Android iOS
Opening a channel displays a play button in the audio message & playing it
Screen.Recording.2026-09-02.at.9.12.58.PM.mov
Screen.Recording.2026-09-02.at.9.14.02.PM.mov
seek bar, playback speed, and pause
Screen.Recording.2026-09-02.at.9.15.10.PM.mov
Screen.Recording.2026-09-02.at.9.14.32.PM.mov
Video message
Screen.Recording.2026-09-02.at.9.07.25.PM.mov
Screen.Recording.2026-09-02.at.9.08.28.PM.mov
Video view: everything is displayed within the safe area Screenshot 2026-09-02 at 9 10 34 PM Screenshot 2026-09-02 at 9 10 22 PM
Video ShareView
Screen.Recording.2026-09-02.at.9.20.39.PM.mov
Screen.Recording.2026-09-02.at.9.22.15.PM.mov

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • Refactor
    • Migrated audio playback, recording, ringer sounds, and VOIP call-ended playback to a new audio stack.
    • Updated attachment and share preview video rendering to a new video player.
  • Bug Fixes
    • Improved audio seek gesture rollback using snapshot-based state restoration and synchronous time updates.
    • Improved end-of-playback handling and ensured playback listeners are properly released/cleaned up.
    • Enhanced video loading/error handling and pause behavior during navigation transitions.
  • Chores
    • Updated Jest mocks and adjusted media-related tests to match the new playback/recording APIs.

@coderabbitai

coderabbitai Bot commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Migrates audio and video usage from expo-av to expo-audio and expo-video across recording, playback, VoIP, ringer, previews, tests, and package dependencies, while updating seek and playback-status handling.

Changes

Expo media migration

Layer / File(s) Summary
Seek and playback status
app/containers/AudioPlayer/Seek.tsx, app/containers/AudioPlayer/index.tsx, app/containers/AudioPlayer/index.test.tsx
Seek callbacks become synchronous, failed gestures restore saved values, and playback status handling uses expo-audio fields for UI state, progress, and completion.
Recorder permissions and lifecycle
app/containers/MessageComposer/components/Buttons/MicOrSendButton.tsx, app/containers/MessageComposer/components/RecordAudio/*
Recording permissions and recorder state move to expo-audio, with hook-based recording, stop-based cleanup, and recorder URI/state used for upload and review.
VoIP end-of-call sound and tests
app/lib/services/voip/playCallEndedSound.ts, app/lib/services/voip/playCallEndedSound.test.ts, app/containers/NewMediaCall/VoipCallLifecycle.integration.test.tsx
VoIP playback uses a synchronous expo-audio player with watchdog cleanup, and tests cover completion, coalescing, timeout cleanup, and errors.
AudioManager factory and caches
app/lib/methods/AudioManager.ts
AudioManager uses expo-audio players with per-key caches, listener management, seek/rate restoration, sequence handling, and release-based cleanup.
Video rendering and preview
app/views/AttachmentView.tsx, app/views/ShareView/Preview.tsx, app/views/AttachmentView.test.tsx
Attachment and share preview playback use expo-video players and views, with loading, error, blur, and sizing behavior updated.
Ringer playback
app/containers/Ringer/index.tsx
Ringer playback uses expo-audio player hooks, static sound mappings, looping, and release-based cleanup.
Package dependencies
package.json
expo-audio replaces expo-av, and expo-video is added.

Estimated code review effort: 4 (Complex) | ~60 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the primary change: migrating audio functionality from expo-av to expo-audio and expo-video.
  • Fix all pre-merge checks with AI

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2035: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Rohit3523

Copy link
Copy Markdown
Member Author

Recording is not working... idk why...

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.75.0.109485

Comment thread app/containers/MessageComposer/components/RecordAudio/RecordAudio.tsx Outdated
Comment thread app/containers/VideoPlayer/index.tsx
Comment thread app/containers/VideoPlayer/index.tsx
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.76.0.109505

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.76.0.109511

@github-actions

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.76.0.1

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.76.0.109534

@Rohit3523 Rohit3523 Sep 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Android, we were previously using MediaPlayer through expo-av

const { sound } = await Audio.Sound.createAsync({ uri }, { androidImplementation: 'MediaPlayer' });

Note: Above code is from develop branch

With the migration to expo-audio, the Android implementation switched to ExoPlayer and seeking stopped working for some audio files.

This patch enables constant-bitrate seeking in ExoPlayer, which fixes the seeking behavior for those files.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

iOS Build Available

Rocket.Chat 4.77.0.109571

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants