Skip to content

Commit 643d6f8

Browse files
authored
Merge pull request #300 from Beldaa/fix/webcams-null-currenttime
fix/replay-crash-mobile-shortcuts-webcams
2 parents a0d4883 + 4ab1696 commit 643d6f8

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/components/webcams/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ const Webcams = () => {
110110
player.webcams.on('play', () => {
111111
const frequency = getFrequency();
112112
interval.current = setInterval(() => {
113-
const currentTime = player.webcams.currentTime();
114-
dispatchTimeUpdate(currentTime);
113+
if (player.webcams) {
114+
const currentTime = player.webcams.currentTime();
115+
dispatchTimeUpdate(currentTime);
116+
}
115117
}, 1000 / (frequency ? frequency : config.rps));
116118
});
117119

src/utils/shortcuts.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,19 @@ export default class Shortcuts {
4343
return null;
4444
}
4545

46-
const listener = document.addEventListener('keydown', (e) => {
47-
if (e.altKey && e.shiftKey) {
48-
if (e.key === key) action();
46+
const handler = (e) => {
47+
if (e.altKey && e.shiftKey && e.key === key) {
48+
action();
4949
}
50-
});
50+
};
5151

52-
this.listeners.push(listener);
52+
document.addEventListener('keydown', handler);
53+
this.listeners.push(handler);
5354
}
5455

5556
destroy() {
5657
this.listeners.forEach(listener => {
57-
document.removeEventListener(listener);
58+
document.removeEventListener('keydown', listener);
5859
});
5960
}
6061
}

0 commit comments

Comments
 (0)