Skip to content

[Due for payment 2026-04-02] [$250] console error while playing video attachment #84294

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.31-5
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @rojiphil
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Open a workspace chat.
  2. Add video attachment (app. 10MB size)
  3. In the report action for attachment, start playing the video attachment.
  4. While the video is playing, change the seek position repeatedly

Expected Result:

No console error should get displayed.

Actual Result:

Following console error is displayed
AbortError
The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

84197-web-chrome-002.mp4
Image

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @abzokhattab
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022029614022620435044
  • Upwork Job ID: 2029614022620435044
  • Last Price Increase: 2026-03-05

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 5, 2026
  2. melvin-bot commented on Mar 5, 2026

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. MelvinBot commented on Mar 5, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When playing a video attachment in a workspace chat and repeatedly changing the seek position via the progress bar, the browser console displays: AbortError: The play() request was interrupted by a call to pause(). This happens on Chrome and Safari (web platforms).

    What is the root cause of that problem?

    The HTML5 video.play() method returns a Promise. If pause() is called (or the browser internally pauses due to seeking) before that Promise resolves, the browser rejects it with an AbortError. The expo-video library's web implementation (VideoPlayer.web.tsx) calls HTMLVideoElement.play() in its play() method but discards the returned Promise entirely — the method signature is typed as void, and the Promise is never .catch()-ed.

    The specific trigger is in the ProgressBar component (src/components/VideoPlayer/VideoPlayerControls/ProgressBar/index.tsx). The Pan gesture handler:

    1. onBegin: Calls pauseVideo() then seeks to the touched position
    2. onChange: Updates currentTime on every drag event (no debouncing)
    3. onFinalize: Calls playVideo() if the video was previously playing

    When the user rapidly re-grabs the seek bar after releasing it, the sequence becomes: play() → immediate pause() → play() → immediate pause(), causing the pending play() Promise to be interrupted each time. The unhandled rejection surfaces as the console error.

    There are actually 5 separate locations in expo-video's VideoPlayerWeb that call HTMLVideoElement.play() without catching the Promise: play(), onplay listener, _synchronizeWithFirstVideo(), replace(), and replay().

    What changes do you think we should make in order to solve the problem?

    Patch expo-video's VideoPlayerWeb (via patch-package) to wrap every HTMLVideoElement.play() call with a .catch() that silently swallows AbortError while re-throwing any other errors. This is the standard fix recommended by Chrome's documentation for this exact error.

    For each of the 5 call sites in VideoPlayer.web.ts, change:

    video.play();
    

    to:

    video.play()?.catch((e) => { if (e.name !== 'AbortError') throw e; });
    

    This handles the root cause at the library level, covering all code paths — not just the seek bar scenario.

    What alternative solutions did you explore? (Optional)

    1. Fix only in the ProgressBar: Add a flag or debounce to prevent playVideo() from being called when another gesture begins immediately. This would fix the specific seek-bar scenario but leave the other 4 unhandled play() call sites in expo-video vulnerable to the same error in other contexts (e.g., replace(), replay(), video synchronization via onplay).

    2. Debounce/throttle seek operations: Reduce the frequency of currentTime assignments during drag. This would reduce the likelihood of the error but not eliminate it, since the core issue is the unhandled Promise from play().


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 5, 2026
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 5, 2026
  6. melvin-bot commented on Mar 5, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @abzokhattab (External)

  7. changed the title [-]console error while playing video attachment[/-] [+][$250] console error while playing video attachment[/+] on Mar 5, 2026
  8. melvin-bot commented on Mar 5, 2026

    @melvin-bot
  9. self-assigned this
    on Mar 5, 2026
  10. abbasifaizan70 commented on Mar 5, 2026

    @abbasifaizan70
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    1. Open a workspace chat.
    2. Add a video attachment.
    3. Start playback in the report action attachment.
    4. While the video is playing, repeatedly change the seek position.

    Console shows:
    Uncaught (in promise) AbortError: The play() request was interrupted by a call to pause().

    What is the root cause of that problem?

    The seek gesture intentionally pauses on drag start and resumes on drag finalize. During rapid scrubbing, this creates overlapping pause() and play() operations in a short window.

    .onBegin((event) => {
    setIsSliderPressed(true);
    checkIfVideoIsPlaying(onCheckIfVideoIsPlaying);
    pauseVideo();
    progressBarInteraction(event);
    })
    .onChange((event) => {
    progressBarInteraction(event);
    })
    .onFinalize(() => {
    setIsSliderPressed(false);
    if (!wasVideoPlayingOnCheck.get()) {
    return;
    }
    playVideo();
    });

    The playback context playVideo calls player.play() without handling promise rejection. On web, interrupted autoplay/playback transitions reject this promise with AbortError, which becomes an uncaught promise rejection in console.

    const playVideo: PlaybackContextVideoRefs['play'] = useCallback(() => {
    currentVideoPlayerRef.current?.play();
    }, []);

    Shared playback entry points (for example, shared element autoplay) call into the same video.play() action, so this missing rejection handling affects multiple seek/play paths.

    if (!shouldNotAutoPlay) {
    video.play();
    }

    What changes do you think we should make in order to solve the problem?

    In usePlaybackContextVideoRefs, normalize play() handling so promise rejections from interrupted playback are safely consumed at the context boundary.

    const playVideo: PlaybackContextVideoRefs['play'] = useCallback(() => {
    currentVideoPlayerRef.current?.play();
    }, []);

    const playVideo: PlaybackContextVideoRefs['play'] = useCallback(() => {
        const playResult = currentVideoPlayerRef.current?.play() as Promise<void> | undefined;
    
        // During rapid seek interactions, pause() can interrupt play() on web and reject with AbortError.
        // This is expected behavior and should not surface as an uncaught console error.
        playResult?.catch?.(() => {});
    }, []);

    This keeps the existing UX (pause on drag, resume after seek) while preventing noisy unhandled rejections in console when users scrub quickly.

    Demo

    Screen.Recording.2026-03-06.at.1.17.18.AM.mov
  11. rohit9625 commented on Mar 7, 2026

    @rohit9625
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When playing any video attachment in the chats and rapidly seeking the video timeline, we get a console error saying Uncaught (in promise) AbortError: The play() request was interrupted by a call to pause(). which also interrupts the testing in development environment as well console gets filled with this error.

    What is the root cause of that problem?

    First of all, this happens only on web platforms/browsers. We are using expo-video for video playback in our codebase and for the web target, it simply calls video.play() and video.pause() functions on HTMLVideoElement whenever we call play and pause functions exposed by expo-video package.

    However, the issue is not in the library itself, the error is reproducible because of our custom behavior when panning the video seekbar, i.e., pause the video when begin panning and play the video when done panning:

    const pan = Gesture.Pan()
    .runOnJS(true)
    // Reduce gesture threshold so quick taps trigger onFinalize on iOS.
    .minDistance(0)
    .activateAfterLongPress(0)
    .onBegin((event) => {
    setIsSliderPressed(true);
    checkIfVideoIsPlaying(onCheckIfVideoIsPlaying);
    pauseVideo();
    progressBarInteraction(event);
    })
    .onChange((event) => {
    progressBarInteraction(event);
    })
    .onFinalize(() => {
    setIsSliderPressed(false);
    if (!wasVideoPlayingOnCheck.get()) {
    return;
    }
    playVideo();
    });

    So, when the user rapidly seeks through the video timeline, our above custom logic repeatedly triggers pause() and play() calls in quick succession. This results in the following console error:

    AbortError: The play() request was interrupted by a call to pause().
    

    The reason is that the HTMLVideoElement.play() method returns a Promise that resolves only when playback has actually started.

    Note: This is a well known bug and discussed at many repositories and SO. This is a blog from Google itself explaining this issue: https://developer.chrome.com/blog/play-request-was-interrupted

    A simplified sequence that leads to the error:

    1. First seek: video.pause() -> video.play()
    2. Immediate second seek: video.pause() is triggered again before the Promise returned by the previous video.play() has resolved.
    3. Because playback never fully started, the browser rejects the pending play() Promise, resulting in the console error.

    Reproduction Video:

    Screen.Recording.2026-03-07.at.9.59.09.AM.mov

    What changes do you think we should make in order to solve the problem?

    I believe we should handle this error in the upstream expo-video library via patch because we can control the video playback only via play and pause functions exposed by expo-video package.
    And interestingly both of these functions returns void, i.e., we have no control over the browser specific HTMLVideoElement.play() function that actually returns a Promise.

    So, it's better if we update the call to video.play() function at here in upstream code. This is my proposed patch which fixes the problem:

    --- a/node_modules/expo-video/build/VideoPlayer.web.js
    +++ b/node_modules/expo-video/build/VideoPlayer.web.js
    @@ -222,7 +222,7 @@ export default class VideoPlayerWeb extends globalThis.expo.SharedObject {
         }
         play() {
             this._mountedVideos.forEach((video) => {
    -            video.play();
    +            video.play().catch(() => {});
             });
         }
         pause() {
    @@ -302,7 +302,7 @@ export default class VideoPlayerWeb extends globalThis.expo.SharedObject {
                 });
                 this.playing = true;
                 this._mountedVideos.forEach((mountedVideo) => {
    -                mountedVideo.play();
    +                mountedVideo.play().catch(() => {});
                 });
             };
             video.onpause = (e) => {

    If we want, we can only catch specific AbortError instead of all errors in the above patch.

    Note: Even if we want to handle this Promise in our code, we'll have to patch the expo-video to return a Promise instead of void via its exposed play function, which I think will be extra effort and something that expo owners won't accept.

    Result: The logs on the console are just debug logs and not part of the patch

    Screen.Recording.2026-03-07.at.9.56.22.AM.mov

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  12. 47 remaining items

  13. mallenexpensify commented on Apr 3, 2026

    @mallenexpensify
    Contributor

    @abzokhattab plz complete the BZ checklist and tag me in a post once you have. Thx

  14. mallenexpensify commented on Apr 7, 2026

    @mallenexpensify
    Contributor

    @abzokhattab plz complete the BZ checklist and tag me in a post once you have. Thx

  15. melvin-bot commented on Apr 10, 2026

    @melvin-bot

    @abzokhattab Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  16. abzokhattab commented on Apr 13, 2026

    @abzokhattab
    Contributor

    BugZero Checklist

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment : N/A — this is an upstream expo-video library issue, not caused by an App PR. The library's VideoPlayer.web.js does not handle the Promise returned by HTMLVideoElement.play().

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A — cosmetic console error, no user-facing impact.

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    • Have a workspace chat with a video attachment (~10MB)

    Test:

    1. Open the workspace chat on web (Chrome or Safari)
    2. Start playing the video attachment
    3. While the video is playing, rapidly drag the seek bar back and forth multiple times
    4. Open the browser DevTools console
    5. Verify no AbortError or "The play() request was interrupted" errors appear
    6. Verify the video continues to play correctly after seeking

    Do we agree 👍 or 👎

  17. abzokhattab commented on Apr 13, 2026

    @abzokhattab
    Contributor
  18. quinthar commented on May 12, 2026

    @quinthar
    Contributor

    Approved $250 to @abzokhattab

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions