Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix media replay bug when target is not an AUDIO or VIDEO element #1462

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/poor-numbers-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rrweb': patch
---

Fix media replay `pause is not a function` bug when target is not an AUDIO or VIDEO element
2 changes: 2 additions & 0 deletions packages/rrweb/src/replay/media/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ export class MediaManager {
timeOffset: number;
mutation: mediaInteractionData;
}) {
if (!['AUDIO', 'VIDEO'].includes(target.nodeName)) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

addMediaElements already does this check so it's not hurting.
addMediaElements is only called if isSupportedMediaElement returns true, which does the very same check.
Most likely the addMediaElements could remove this line
mediaMutation is the only method besides addMediaElements that mutates mediaMap without this check so the change makes sense to me, we can reuse the isSupportedMediaElement method though.


this.mediaMap.set(
target,
this.getMediaStateFromMutation({
Expand Down