Skip to content

Commit 4d87ed5

Browse files
committed
Fix cross domain song player iframes (again).
1 parent 50687cb commit 4d87ed5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

player/main.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ function setLocalStorage(key: string, value: string): void {
216216
try {
217217
localStorage.setItem(key, value);
218218
} catch (error) {
219-
console.error(error);
219+
// Ignore the error since we can't fix it.
220220
}
221221
}
222222
function getLocalStorage(key: string): string | null {
223223
try {
224224
return localStorage.getItem(key);
225225
} catch (error) {
226-
console.error(error);
226+
// Ignore the error since we can't fix it.
227227
return null;
228228
}
229229
}
@@ -284,7 +284,8 @@ function onWindowResize(): void {
284284
function animate(): void {
285285
if (synth.playing) {
286286
animationRequest = requestAnimationFrame(animate);
287-
if (getLocalStorage("playerId") != id) {
287+
const storedPlayerId: string | null = getLocalStorage("playerId");
288+
if (storedPlayerId != null && storedPlayerId != id) {
288289
onTogglePlay();
289290
}
290291
renderPlayhead();

0 commit comments

Comments
 (0)