Merge pull request #19 from JFox-sk/master
Refactoring mediaSessionInit variable to event option once
This commit is contained in:
commit
c787d2d094
2 changed files with 2 additions and 8 deletions
|
@ -643,12 +643,9 @@ class App extends HTMLElement {
|
|||
node("source", {src: 'https://raw.githubusercontent.com/anars/blank-audio/master/10-seconds-of-silence.mp3'}, '', audio);
|
||||
|
||||
// Init event session (play audio) on click (because restrictions by web browsers)
|
||||
let mediaSessionInit = false;
|
||||
window.addEventListener('click', () => {
|
||||
if (mediaSessionInit) return;
|
||||
mediaSessionInit = true;
|
||||
audio.play();
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
// mediaSession define metadata
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
|
|
|
@ -82,12 +82,9 @@ class App extends HTMLElement {
|
|||
html.node("source", {src: 'https://raw.githubusercontent.com/anars/blank-audio/master/10-seconds-of-silence.mp3'}, '', audio);
|
||||
|
||||
// Init event session (play audio) on click (because restrictions by web browsers)
|
||||
let mediaSessionInit = false;
|
||||
window.addEventListener('click', () => {
|
||||
if (mediaSessionInit) return;
|
||||
mediaSessionInit = true;
|
||||
audio.play();
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
// mediaSession define metadata
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
|
|
Loading…
Reference in a new issue