catch unexpected errors during replay media interactions
This commit is contained in:
@@ -646,16 +646,24 @@ 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;
|
||||||
if (d.type === MediaInteractions.Pause) {
|
try {
|
||||||
mediaEl.pause();
|
if (d.type === MediaInteractions.Pause) {
|
||||||
}
|
mediaEl.pause();
|
||||||
if (d.type === MediaInteractions.Play) {
|
}
|
||||||
if (mediaEl.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
|
if (d.type === MediaInteractions.Play) {
|
||||||
mediaEl.play();
|
if (mediaEl.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
|
||||||
} else {
|
|
||||||
mediaEl.addEventListener('canplay', () => {
|
|
||||||
mediaEl.play();
|
mediaEl.play();
|
||||||
});
|
} else {
|
||||||
|
mediaEl.addEventListener('canplay', () => {
|
||||||
|
mediaEl.play();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (this.config.showWarning) {
|
||||||
|
console.warn(
|
||||||
|
`Failed to replay media interactions: ${error.message || error}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user