Merge pull request #1790 from thecodingmachine/fix_screensharing_spinner

Fix screensharing spinner
This commit is contained in:
grégoire parant 2022-01-28 19:50:31 +01:00 committed by GitHub
commit 561fbd7bec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View file

@ -30,10 +30,11 @@
{#if $statusStore === "error"} {#if $statusStore === "error"}
<div class="rtc-error" /> <div class="rtc-error" />
{/if} {/if}
{#if $streamStore === null} {#if $streamStore !== null}
<i style="background-color: {getColorByString(name)};">{name}</i>
{:else}
<!-- svelte-ignore a11y-media-has-caption --> <!-- svelte-ignore a11y-media-has-caption -->
<i class="container">
<span style="background-color: {getColorByString(name)};">{name}</span>
</i>
<video <video
use:srcObject={$streamStore} use:srcObject={$streamStore}
autoplay autoplay
@ -48,5 +49,10 @@
video { video {
width: 100%; width: 100%;
} }
i {
span {
padding: 2px 32px;
}
}
} }
</style> </style>

View file

@ -59,7 +59,7 @@
{/if} {/if}
<!-- {#if !$constraintStore || $constraintStore.video === false} --> <!-- {#if !$constraintStore || $constraintStore.video === false} -->
<i class="container"> <i class="container">
<span style="background-color: {getColorByString(name)};">{peer.userName}</span> <span style="background-color: {getColorByString(name)};">{name}</span>
</i> </i>
<div class="woka-icon {($constraintStore && $constraintStore.video !== false) || minimized ? '' : 'no-video'}"> <div class="woka-icon {($constraintStore && $constraintStore.video !== false) || minimized ? '' : 'no-video'}">
<Woka userId={peer.userId} placeholderSrc={""} /> <Woka userId={peer.userId} placeholderSrc={""} />

View file

@ -1605,6 +1605,7 @@ ${escapedMessage}
//When we leave game, the camera is stop to be reopen after. //When we leave game, the camera is stop to be reopen after.
// I think that we could keep camera status and the scene can manage camera setup // I think that we could keep camera status and the scene can manage camera setup
//TODO find wy chrome don't manage correctly a multiple ask mediaDevices
//mediaManager.hideMyCamera(); //mediaManager.hideMyCamera();
for (const iframeEvents of this.iframeSubscriptionList) { for (const iframeEvents of this.iframeSubscriptionList) {

View file

@ -2,7 +2,7 @@ import type * as SimplePeerNamespace from "simple-peer";
import type { RoomConnection } from "../Connexion/RoomConnection"; import type { RoomConnection } from "../Connexion/RoomConnection";
import { MESSAGE_TYPE_CONSTRAINT, PeerStatus } from "./VideoPeer"; import { MESSAGE_TYPE_CONSTRAINT, PeerStatus } from "./VideoPeer";
import type { UserSimplePeerInterface } from "./SimplePeer"; import type { UserSimplePeerInterface } from "./SimplePeer";
import { Readable, readable } from "svelte/store"; import { Readable, readable, writable, Writable } from "svelte/store";
import { getIceServersConfig } from "../Components/Video/utils"; import { getIceServersConfig } from "../Components/Video/utils";
import { highlightedEmbedScreen } from "../Stores/EmbedScreensStore"; import { highlightedEmbedScreen } from "../Stores/EmbedScreensStore";
import { isMediaBreakpointUp } from "../Utils/BreakpointsUtils"; import { isMediaBreakpointUp } from "../Utils/BreakpointsUtils";
@ -22,7 +22,7 @@ export class ScreenSharingPeer extends Peer {
public readonly userId: number; public readonly userId: number;
public readonly uniqueId: string; public readonly uniqueId: string;
public readonly streamStore: Readable<MediaStream | null>; public readonly streamStore: Readable<MediaStream | null>;
public readonly statusStore: Readable<PeerStatus>; public readonly statusStore: Writable<PeerStatus>;
constructor( constructor(
user: UserSimplePeerInterface, user: UserSimplePeerInterface,
@ -70,7 +70,7 @@ export class ScreenSharingPeer extends Peer {
}; };
}); });
this.statusStore = readable<PeerStatus>("connecting", (set) => { this.statusStore = writable<PeerStatus>("connecting", (set) => {
const onConnect = () => { const onConnect = () => {
set("connected"); set("connected");
}; };
@ -141,6 +141,12 @@ export class ScreenSharingPeer extends Peer {
if (!stream) { if (!stream) {
this.isReceivingStream = false; this.isReceivingStream = false;
} else { } else {
//Check if the peer connection is already connected status. In this case, the status store must be set to 'connected'.
//In the case or player A send stream and player B send a stream, it's same peer connection, also the status must be changed to connect.
//TODO add event listening when the stream is ready for displaying and change the status
if (this._connected) {
this.statusStore.set("connected");
}
this.isReceivingStream = true; this.isReceivingStream = true;
} }
} }

View file

@ -259,7 +259,7 @@ export class SimplePeer {
console.warn( console.warn(
"closeScreenSharingConnection => Tried to close connection for user " + "closeScreenSharingConnection => Tried to close connection for user " +
userId + userId +
" but could not find user" " but could not find user or no peer connection started"
); );
return; return;
} }