catch unexpected errors during replay media interactions

This commit is contained in:
Yanzhen Yu
2020-09-06 16:44:33 +08:00
parent df6d08db97
commit fa6fd6e2b9

View File

@@ -646,6 +646,7 @@ export class Replayer {
return this.debugNodeNotFound(d, d.id); return this.debugNodeNotFound(d, d.id);
} }
const mediaEl = (target as Node) as HTMLMediaElement; const mediaEl = (target as Node) as HTMLMediaElement;
try {
if (d.type === MediaInteractions.Pause) { if (d.type === MediaInteractions.Pause) {
mediaEl.pause(); mediaEl.pause();
} }
@@ -658,6 +659,13 @@ export class Replayer {
}); });
} }
} }
} catch (error) {
if (this.config.showWarning) {
console.warn(
`Failed to replay media interactions: ${error.message || error}`,
);
}
}
break; break;
} }
case IncrementalSource.StyleSheetRule: { case IncrementalSource.StyleSheetRule: {