Hide local volume controls for tiles with no audio
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
aa57cf039a
commit
881054e265
3 changed files with 16 additions and 8 deletions
|
@ -36,6 +36,7 @@ interface Props {
|
||||||
mediaRef?: React.RefObject<MediaElement>;
|
mediaRef?: React.RefObject<MediaElement>;
|
||||||
onOptionsPress?: () => void;
|
onOptionsPress?: () => void;
|
||||||
localVolume?: number;
|
localVolume?: number;
|
||||||
|
hasAudio?: boolean;
|
||||||
maximised?: boolean;
|
maximised?: boolean;
|
||||||
fullscreen?: boolean;
|
fullscreen?: boolean;
|
||||||
onFullscreen?: () => void;
|
onFullscreen?: () => void;
|
||||||
|
@ -58,6 +59,7 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
|
||||||
mediaRef,
|
mediaRef,
|
||||||
onOptionsPress,
|
onOptionsPress,
|
||||||
localVolume,
|
localVolume,
|
||||||
|
hasAudio,
|
||||||
maximised,
|
maximised,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
onFullscreen,
|
onFullscreen,
|
||||||
|
@ -74,6 +76,7 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
|
||||||
|
|
||||||
const toolbarButtons: JSX.Element[] = [];
|
const toolbarButtons: JSX.Element[] = [];
|
||||||
if (connectionState == ConnectionState.Connected && !isLocal) {
|
if (connectionState == ConnectionState.Connected && !isLocal) {
|
||||||
|
if (hasAudio) {
|
||||||
toolbarButtons.push(
|
toolbarButtons.push(
|
||||||
<AudioButton
|
<AudioButton
|
||||||
key="localVolume"
|
key="localVolume"
|
||||||
|
@ -82,6 +85,7 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
|
||||||
onPress={onOptionsPress}
|
onPress={onOptionsPress}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (screenshare) {
|
if (screenshare) {
|
||||||
toolbarButtons.push(
|
toolbarButtons.push(
|
||||||
|
|
|
@ -62,6 +62,7 @@ export function VideoTileContainer({
|
||||||
audioMuted,
|
audioMuted,
|
||||||
videoMuted,
|
videoMuted,
|
||||||
localVolume,
|
localVolume,
|
||||||
|
hasAudio,
|
||||||
speaking,
|
speaking,
|
||||||
stream,
|
stream,
|
||||||
purpose,
|
purpose,
|
||||||
|
@ -109,6 +110,7 @@ export function VideoTileContainer({
|
||||||
avatar={getAvatar && getAvatar(item.member, width, height)}
|
avatar={getAvatar && getAvatar(item.member, width, height)}
|
||||||
onOptionsPress={onOptionsPress}
|
onOptionsPress={onOptionsPress}
|
||||||
localVolume={localVolume}
|
localVolume={localVolume}
|
||||||
|
hasAudio={hasAudio}
|
||||||
maximised={maximised}
|
maximised={maximised}
|
||||||
fullscreen={fullscreen}
|
fullscreen={fullscreen}
|
||||||
onFullscreen={onFullscreenCallback}
|
onFullscreen={onFullscreenCallback}
|
||||||
|
|
|
@ -25,6 +25,7 @@ interface CallFeedState {
|
||||||
videoMuted: boolean;
|
videoMuted: boolean;
|
||||||
audioMuted: boolean;
|
audioMuted: boolean;
|
||||||
localVolume: number;
|
localVolume: number;
|
||||||
|
hasAudio: boolean;
|
||||||
disposed: boolean | undefined;
|
disposed: boolean | undefined;
|
||||||
stream: MediaStream | undefined;
|
stream: MediaStream | undefined;
|
||||||
purpose: SDPStreamMetadataPurpose | undefined;
|
purpose: SDPStreamMetadataPurpose | undefined;
|
||||||
|
@ -38,6 +39,7 @@ function getCallFeedState(callFeed: CallFeed | undefined): CallFeedState {
|
||||||
videoMuted: callFeed ? callFeed.isVideoMuted() : true,
|
videoMuted: callFeed ? callFeed.isVideoMuted() : true,
|
||||||
audioMuted: callFeed ? callFeed.isAudioMuted() : true,
|
audioMuted: callFeed ? callFeed.isAudioMuted() : true,
|
||||||
localVolume: callFeed ? callFeed.getLocalVolume() : 0,
|
localVolume: callFeed ? callFeed.getLocalVolume() : 0,
|
||||||
|
hasAudio: callFeed ? callFeed.stream.getAudioTracks().length >= 1 : false,
|
||||||
disposed: callFeed ? callFeed.disposed : undefined,
|
disposed: callFeed ? callFeed.disposed : undefined,
|
||||||
stream: callFeed ? callFeed.stream : undefined,
|
stream: callFeed ? callFeed.stream : undefined,
|
||||||
purpose: callFeed ? callFeed.purpose : undefined,
|
purpose: callFeed ? callFeed.purpose : undefined,
|
||||||
|
|
Loading…
Add table
Reference in a new issue