Merge branch 'develop' into vite
This commit is contained in:
@@ -159,9 +159,17 @@ class CoWebsiteManager {
|
||||
});
|
||||
|
||||
buttonSwipe.addEventListener("click", () => {
|
||||
const mainCoWebsite = this.getMainCoWebsite();
|
||||
const highlightedEmbed = get(highlightedEmbedScreen);
|
||||
if (highlightedEmbed?.type === "cowebsite") {
|
||||
this.goToMain(highlightedEmbed.embed);
|
||||
|
||||
if (mainCoWebsite) {
|
||||
highlightedEmbedScreen.toggleHighlight({
|
||||
type: "cowebsite",
|
||||
embed: mainCoWebsite,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -553,6 +561,13 @@ class CoWebsiteManager {
|
||||
coWebsites.remove(coWebsite);
|
||||
coWebsites.add(coWebsite, 0);
|
||||
|
||||
if (mainCoWebsite) {
|
||||
const iframe = mainCoWebsite.getIframe();
|
||||
if (iframe) {
|
||||
iframe.style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
isMediaBreakpointDown("lg") &&
|
||||
get(embedScreenLayout) === LayoutMode.Presentation &&
|
||||
@@ -596,12 +611,20 @@ class CoWebsiteManager {
|
||||
.load()
|
||||
.then(() => {
|
||||
const mainCoWebsite = this.getMainCoWebsite();
|
||||
if (mainCoWebsite && mainCoWebsite.getId() === coWebsite.getId()) {
|
||||
this.openMain();
|
||||
const highlightedEmbed = get(highlightedEmbedScreen);
|
||||
if (mainCoWebsite) {
|
||||
if (mainCoWebsite.getId() === coWebsite.getId()) {
|
||||
this.openMain();
|
||||
|
||||
setTimeout(() => {
|
||||
this.fire();
|
||||
}, animationTime);
|
||||
setTimeout(() => {
|
||||
this.fire();
|
||||
}, animationTime);
|
||||
} else if (!highlightedEmbed) {
|
||||
highlightedEmbedScreen.toggleHighlight({
|
||||
type: "cowebsite",
|
||||
embed: coWebsite,
|
||||
});
|
||||
}
|
||||
}
|
||||
this.resizeAllIframes();
|
||||
})
|
||||
|
||||
@@ -9,6 +9,9 @@ import { playersStore } from "../Stores/PlayersStore";
|
||||
import { chatMessagesStore, newChatMessageSubject } from "../Stores/ChatStore";
|
||||
import { getIceServersConfig } from "../Components/Video/utils";
|
||||
import { isMediaBreakpointUp } from "../Utils/BreakpointsUtils";
|
||||
import { SoundMeter } from "../Phaser/Components/SoundMeter";
|
||||
import { AudioContext } from "standardized-audio-context";
|
||||
import { Console } from "console";
|
||||
import Peer from "simple-peer/simplepeer.min.js";
|
||||
import { Buffer } from "buffer";
|
||||
|
||||
@@ -32,6 +35,7 @@ export class VideoPeer extends Peer {
|
||||
private onBlockSubscribe: Subscription;
|
||||
private onUnBlockSubscribe: Subscription;
|
||||
public readonly streamStore: Readable<MediaStream | null>;
|
||||
public readonly volumeStore: Readable<number | undefined>;
|
||||
public readonly statusStore: Readable<PeerStatus>;
|
||||
public readonly constraintsStore: Readable<ObtainedMediaStreamConstraints | null>;
|
||||
private newMessageSubscribtion: Subscription | undefined;
|
||||
@@ -68,6 +72,34 @@ export class VideoPeer extends Peer {
|
||||
};
|
||||
});
|
||||
|
||||
this.volumeStore = readable<number | undefined>(undefined, (set) => {
|
||||
let timeout: ReturnType<typeof setTimeout>;
|
||||
const unsubscribe = this.streamStore.subscribe((mediaStream) => {
|
||||
if (mediaStream === null || mediaStream.getAudioTracks().length <= 0) {
|
||||
set(undefined);
|
||||
return;
|
||||
}
|
||||
const soundMeter = new SoundMeter(mediaStream);
|
||||
let error = false;
|
||||
|
||||
timeout = setInterval(() => {
|
||||
try {
|
||||
set(soundMeter.getVolume());
|
||||
} catch (err) {
|
||||
if (!error) {
|
||||
console.error(err);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
clearInterval(timeout);
|
||||
};
|
||||
});
|
||||
|
||||
this.constraintsStore = readable<ObtainedMediaStreamConstraints | null>(null, (set) => {
|
||||
const onData = (chunk: Buffer) => {
|
||||
const message = JSON.parse(chunk.toString("utf8"));
|
||||
|
||||
Reference in New Issue
Block a user