fix: microphone and camera select issue in legacy call (#12105)

Signed-off-by: Murat Ersin <muratersin@yahoo.com>
This commit is contained in:
Murat Ersin 2024-01-04 17:44:37 +03:00 committed by GitHub
parent 9350583ecf
commit baaf8ad68b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import React, { ComponentProps, createRef, useState } from "react"; import React, { ComponentProps, createRef, useState, forwardRef } from "react";
import classNames from "classnames"; import classNames from "classnames";
import { MatrixCall } from "matrix-js-sdk/src/webrtc/call"; import { MatrixCall } from "matrix-js-sdk/src/webrtc/call";
@ -48,30 +48,26 @@ type ButtonProps = Omit<ComponentProps<typeof AccessibleTooltipButton>, "title"
offLabel?: string; offLabel?: string;
}; };
const LegacyCallViewToggleButton: React.FC<ButtonProps> = ({ const LegacyCallViewToggleButton = forwardRef<HTMLElement, ButtonProps>(
children, ({ children, state: isOn, className, onLabel, offLabel, ...props }, ref) => {
state: isOn, const classes = classNames("mx_LegacyCallViewButtons_button", className, {
className, mx_LegacyCallViewButtons_button_on: isOn,
onLabel, mx_LegacyCallViewButtons_button_off: !isOn,
offLabel, });
...props
}) => {
const classes = classNames("mx_LegacyCallViewButtons_button", className, {
mx_LegacyCallViewButtons_button_on: isOn,
mx_LegacyCallViewButtons_button_off: !isOn,
});
return ( return (
<AccessibleTooltipButton <AccessibleTooltipButton
className={classes} ref={ref}
title={isOn ? onLabel : offLabel} className={classes}
alignment={Alignment.Top} title={isOn ? onLabel : offLabel}
{...props} alignment={Alignment.Top}
> {...props}
{children} >
</AccessibleTooltipButton> {children}
); </AccessibleTooltipButton>
}; );
},
);
interface IDropdownButtonProps extends ButtonProps { interface IDropdownButtonProps extends ButtonProps {
deviceKinds: MediaDeviceKindEnum[]; deviceKinds: MediaDeviceKindEnum[];