MCPcopy Index your code
hub / github.com/MALSync/MALSync / startTracking

Method startTracking

src/utils/player.ts:35–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33 }
34
35 public startTracking() {
36 setInterval(() => {
37 const players = document.getElementsByTagName('video');
38 for (let i = 0; i < players.length; i++) {
39 const player: HTMLVideoElement = players[i];
40 const { duration } = player;
41 const current = player.currentTime;
42 const { paused } = player;
43
44 if (duration && duration > 60) {
45 const item = {
46 current,
47 duration,
48 paused,
49 };
50 logger.debug(window.location.href, item);
51 this.currentPlayer = player;
52 this.notifyListeners(item, player);
53 playerExtras(item, player);
54 return;
55 }
56 }
57 this.currentPlayer = null;
58 }, 1000);
59
60 return this;
61 }
62
63 protected proxySetTime: ((time: number) => void) | null = null;
64

Callers 4

iframe.tsFile · 0.80
iframeFunction · 0.80
handlePageMethod · 0.80
startMethod · 0.80

Calls 2

notifyListenersMethod · 0.95
playerExtrasFunction · 0.85

Tested by

no test coverage detected