Skip to content

Commit

Permalink
feat(player): Enable background playback (#396)
Browse files Browse the repository at this point in the history
* feat: Enable background playback

* fix(codacy): minor code style fix
  • Loading branch information
adrienjoly committed Nov 16, 2020
1 parent a5e7929 commit dbaa420
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/api/contentExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ function getMp3s() {
}
mp3s[i] = mp3;
}
for (i = 0; (mp3 = mp3s[i]); i++)
for (const mp3 of mp3s) {
if (mp3sUniq.indexOf(mp3) === -1) mp3sUniq.push(mp3);
}
return mp3sUniq;
}

Expand Down
6 changes: 6 additions & 0 deletions public/js/whydPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,4 +758,10 @@ function WhydPlayer() {
window.whydPlayer.playAll();

console.log('Playem is ready!');

try {
document.hasFocus = () => true; // cf https://github.com/openwhyd/openwhyd/issues/132#issuecomment-414131182
} catch (err) {
console.warn('failed to enable background playback:', err);
}
})();

0 comments on commit dbaa420

Please sign in to comment.