From af7daee3e7b2939c523db2a9b7fbc6d612669bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 19 Aug 2022 17:16:57 +0200 Subject: [PATCH 1/4] Handle screen-sharing feed ending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/video-grid/useCallFeed.ts | 3 +++ src/video-grid/useFullscreen.tsx | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/video-grid/useCallFeed.ts b/src/video-grid/useCallFeed.ts index 1781dbf..9dadff4 100644 --- a/src/video-grid/useCallFeed.ts +++ b/src/video-grid/useCallFeed.ts @@ -26,6 +26,7 @@ interface CallFeedState { videoMuted: boolean; audioMuted: boolean; localVolume: number; + disposed: boolean; stream: MediaStream; purpose: SDPStreamMetadataPurpose; } @@ -37,6 +38,7 @@ function getCallFeedState(callFeed: CallFeed): CallFeedState { videoMuted: callFeed ? callFeed.isVideoMuted() : true, audioMuted: callFeed ? callFeed.isAudioMuted() : true, localVolume: callFeed ? callFeed.getLocalVolume() : 0, + disposed: callFeed ? callFeed.idDisposed() : undefined, stream: callFeed ? callFeed.stream : undefined, purpose: callFeed ? callFeed.purpose : undefined, }; @@ -69,6 +71,7 @@ export function useCallFeed(callFeed: CallFeed): CallFeedState { callFeed.on(CallFeedEvent.MuteStateChanged, onMuteStateChanged); callFeed.on(CallFeedEvent.LocalVolumeChanged, onLocalVolumeChanged); callFeed.on(CallFeedEvent.NewStream, onUpdateCallFeed); + callFeed.on(CallFeedEvent.Disposed, onUpdateCallFeed); } onUpdateCallFeed(); diff --git a/src/video-grid/useFullscreen.tsx b/src/video-grid/useFullscreen.tsx index 2d354a4..232814c 100644 --- a/src/video-grid/useFullscreen.tsx +++ b/src/video-grid/useFullscreen.tsx @@ -15,10 +15,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { useCallback, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { Participant } from "../room/InCallView"; import { useEventTarget } from "../useEvents"; +import { useCallFeed } from "./useCallFeed"; export function useFullscreen(ref: React.RefObject): { toggleFullscreen: (participant: Participant) => void; @@ -26,6 +27,7 @@ export function useFullscreen(ref: React.RefObject): { } { const [fullscreenParticipant, setFullscreenParticipant] = useState(null); + const { disposed } = useCallFeed(fullscreenParticipant?.callFeed); const toggleFullscreen = useCallback( (participant: Participant) => { @@ -52,5 +54,12 @@ export function useFullscreen(ref: React.RefObject): { useEventTarget(ref.current, "fullscreenchange", onFullscreenChanged); + useEffect(() => { + if (disposed) { + document.exitFullscreen(); + setFullscreenParticipant(null); + } + }, [disposed]); + return { toggleFullscreen, fullscreenParticipant }; } From d08573b6b8ed65e036b7a150ea6459b6200cb1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 19 Aug 2022 17:18:06 +0200 Subject: [PATCH 2/4] Update js-sdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 02a0590..8123ff6 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "classnames": "^2.3.1", "color-hash": "^2.0.1", "events": "^3.3.0", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#3334c01191bcd82b5243916284c9a08d08fd9795", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#4107b0ef6775f9f44ad1ab89a36c9549bcf921ad", "matrix-widget-api": "^1.0.0", "mermaid": "^8.13.8", "normalize.css": "^8.0.1", From a2a6eaf695de269f44e197c741ce05eec38a1153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 19 Aug 2022 17:26:02 +0200 Subject: [PATCH 3/4] Update-jssdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- package.json | 2 +- src/video-grid/useCallFeed.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8123ff6..35d9aeb 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "classnames": "^2.3.1", "color-hash": "^2.0.1", "events": "^3.3.0", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#4107b0ef6775f9f44ad1ab89a36c9549bcf921ad", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#3344f25c253cab03286409574dec640479c327e8", "matrix-widget-api": "^1.0.0", "mermaid": "^8.13.8", "normalize.css": "^8.0.1", diff --git a/src/video-grid/useCallFeed.ts b/src/video-grid/useCallFeed.ts index 9dadff4..41b6c5c 100644 --- a/src/video-grid/useCallFeed.ts +++ b/src/video-grid/useCallFeed.ts @@ -38,7 +38,7 @@ function getCallFeedState(callFeed: CallFeed): CallFeedState { videoMuted: callFeed ? callFeed.isVideoMuted() : true, audioMuted: callFeed ? callFeed.isAudioMuted() : true, localVolume: callFeed ? callFeed.getLocalVolume() : 0, - disposed: callFeed ? callFeed.idDisposed() : undefined, + disposed: callFeed ? callFeed.disposed : undefined, stream: callFeed ? callFeed.stream : undefined, purpose: callFeed ? callFeed.purpose : undefined, }; From 5be0fdea0bf46269d872fabd865f4932316467f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 19 Aug 2022 17:34:21 +0200 Subject: [PATCH 4/4] Update js-sdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 35d9aeb..2764431 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "classnames": "^2.3.1", "color-hash": "^2.0.1", "events": "^3.3.0", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#3344f25c253cab03286409574dec640479c327e8", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#45e56f8cc36c459ed43e405be4206e5e66b3ad98", "matrix-widget-api": "^1.0.0", "mermaid": "^8.13.8", "normalize.css": "^8.0.1",