MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / cleanupPlayer

Method cleanupPlayer

src/monogatari.ts:1452–1466  ·  view source on GitHub ↗
(player: HTMLAudioElement | HTMLVideoElement | AudioPlayer)

Source from the content-addressed store, hash-verified

1450 const players = this.mediaPlayers (type, true) as Record<string, HTMLAudioElement | HTMLVideoElement | AudioPlayer> | undefined;
1451
1452 const cleanupPlayer = (player: HTMLAudioElement | HTMLVideoElement | AudioPlayer): void => {
1453 if (player instanceof AudioPlayer) {
1454 // Use AudioPlayer's destroy method which handles cleanup properly
1455 player.destroy();
1456 } else {
1457 // Handle HTMLAudioElement/HTMLVideoElement
1458 if (typeof player.pause === 'function') {
1459 player.pause();
1460 }
1461 if (typeof player.setAttribute === 'function') {
1462 player.setAttribute('src', '');
1463 player.currentTime = 0;
1464 }
1465 }
1466 };
1467
1468 if (typeof key === 'undefined') {
1469 if (players) {

Callers

nothing calls this directly

Calls 2

pauseMethod · 0.80
destroyMethod · 0.45

Tested by

no test coverage detected