Skip to content

Commit

Permalink
fix(replay): when seeking while mobile replay is playing, pause old v…
Browse files Browse the repository at this point in the history
…ideo (#67841)

- for mobile replays, after pressing play, and then seeking to a new
later part of the video, the replay was still playing an "old" segment
and not the one we wanted, because we weren't pausing the old video.
this PR fixes this bug by pausing the old video before playing the next
(correct) video.
- fixes #67725
- there's still a bug where the later video is still buffering but the
timer/player keeps going, so we need to fix that:
  - #67712
  - #67727)


https://github.com/getsentry/sentry/assets/56095982/b3d4575c-739d-4249-8e6b-4d4c26847f2e
  • Loading branch information
michellewzhang authored Mar 28, 2024
1 parent ce5409b commit 66d3c86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions static/app/components/replays/videoReplayer.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {VideoReplayer} from './videoReplayer';
//
// advancing by 2000ms ~== 20000s in Timer, but this may depend on hardware, TBD
jest.useFakeTimers();
jest.spyOn(window.HTMLMediaElement.prototype, 'pause').mockImplementation(() => {});

describe('VideoReplayer - no starting gap', () => {
beforeEach(() => {
Expand Down
5 changes: 5 additions & 0 deletions static/app/components/replays/videoReplayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,11 @@ export class VideoReplayer {
*/
public play(videoOffsetMs: number): Promise<void> {
this._timer.start(videoOffsetMs);

// When we seek to a new spot in the replay, pause the old video
const currentVideo = this.getVideo(this._currentIndex);
currentVideo?.pause();

return this.playSegmentAtTime(videoOffsetMs);
}

Expand Down

0 comments on commit 66d3c86

Please sign in to comment.