diff --git a/front/package.json b/front/package.json index 954112c9..c2e7a7b9 100644 --- a/front/package.json +++ b/front/package.json @@ -18,7 +18,7 @@ "eslint": "^8.4.1", "eslint-plugin-svelte3": "^3.2.1", "jasmine": "^3.5.0", - "lint-staged": "^11.0.0", + "lint-staged": "^12.3.7", "npm-run-all": "^4.1.5", "prettier": "^2.3.1", "prettier-plugin-svelte": "^2.5.0", diff --git a/front/public/resources/logos/cowebsite-swipe.svg b/front/public/resources/logos/cowebsite-swipe.svg new file mode 100644 index 00000000..1d4f9ebc --- /dev/null +++ b/front/public/resources/logos/cowebsite-swipe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/front/public/resources/logos/fullscreen-exit.svg b/front/public/resources/logos/fullscreen-exit.svg new file mode 100644 index 00000000..1d15cd8b --- /dev/null +++ b/front/public/resources/logos/fullscreen-exit.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/front/public/resources/logos/fullscreen.svg b/front/public/resources/logos/fullscreen.svg new file mode 100644 index 00000000..2c518466 --- /dev/null +++ b/front/public/resources/logos/fullscreen.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/front/src/Api/desktop/index.ts b/front/src/Api/desktop/index.ts index be5c7901..0b1ea9f9 100644 --- a/front/src/Api/desktop/index.ts +++ b/front/src/Api/desktop/index.ts @@ -1,5 +1,12 @@ import { isSilentStore, requestedCameraState, requestedMicrophoneState } from "../../Stores/MediaStore"; import { get } from "svelte/store"; +import { WorkAdventureDesktopApi } from "@wa-preload-app"; + +declare global { + interface Window { + WAD: WorkAdventureDesktopApi; + } +} class DesktopApi { isSilent: boolean = false; diff --git a/front/src/Components/AudioManager/AudioManager.svelte b/front/src/Components/AudioManager/AudioManager.svelte index eec51572..786c5693 100644 --- a/front/src/Components/AudioManager/AudioManager.svelte +++ b/front/src/Components/AudioManager/AudioManager.svelte @@ -13,20 +13,20 @@ let unsubscriberFileStore: Unsubscriber | null = null; let unsubscriberVolumeStore: Unsubscriber | null = null; - let decreaseWhileTalking: boolean = true; + let isAudioAllowed: boolean = true; onMount(() => { let volume = Math.min(localUserStore.getAudioPlayerVolume(), get(audioManagerVolumeStore).volume); audioManagerVolumeStore.setVolume(volume); audioManagerVolumeStore.setMuted(localUserStore.getAudioPlayerMuted()); - unsubscriberFileStore = audioManagerFileStore.subscribe((src) => { + unsubscriberFileStore = audioManagerFileStore.subscribe((src: string) => { HTMLAudioPlayer.pause(); HTMLAudioPlayer.src = src; HTMLAudioPlayer.loop = get(audioManagerVolumeStore).loop; HTMLAudioPlayer.volume = get(audioManagerVolumeStore).volume; HTMLAudioPlayer.muted = get(audioManagerVolumeStore).muted; - void HTMLAudioPlayer.play(); + tryPlay(); }); unsubscriberVolumeStore = audioManagerVolumeStore.subscribe((audioManager: audioManagerVolume) => { const reduceVolume = audioManager.talking && audioManager.decreaseWhileTalking; @@ -52,6 +52,16 @@ } }); + function tryPlay() { + void HTMLAudioPlayer.play() + .then(() => { + isAudioAllowed = true; + }) + .catch(() => { + isAudioAllowed = false; + }); + } + function updateVolumeUI() { if (get(audioManagerVolumeStore).muted) { audioPlayerVolumeIcon.classList.add("muted"); @@ -90,73 +100,67 @@ audioPlayerVol.blur(); return false; } - - function setDecrease() { - audioManagerVolumeStore.setDecreaseWhileTalking(decreaseWhileTalking); - }