Skip to content

Commit

Permalink
fix(service-providers): correctly dispose loopback recording (#1909)
Browse files Browse the repository at this point in the history
* fix(service-providers): correctly dispose loopback recording

* fix(flat-components): fix top bar double click handling
  • Loading branch information
hyrious authored May 4, 2023
1 parent c5141d7 commit 63d5470
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./style.less";

import React, { FC, ReactNode } from "react";
import React, { FC, ReactNode, useCallback, useRef } from "react";
import classNames from "classnames";
import {
WindowsSystemBtn,
Expand Down Expand Up @@ -33,23 +33,37 @@ export const TopBar: FC<TopBarProps> = ({
hiddenMaximizeBtn,
onClickWindowsSystemBtn,
onDoubleClick,
}) => (
<div
className={classNames("topbar-box", { showWindowsSystemBtn })}
onDoubleClick={onDoubleClick}
>
<div className="topbar-content-left">{left}</div>
<div className="topbar-content-center">{center}</div>
<div className="topbar-content-right">
{right}
{showWindowsSystemBtn && onClickWindowsSystemBtn && (
<>
<WindowsSystemBtn
hiddenMaximizeBtn={hiddenMaximizeBtn}
onClickWindowsSystemBtn={onClickWindowsSystemBtn}
/>
</>
)}
}) => {
const ref = useRef<HTMLDivElement>(null);

const onDoubleClickSelf = useCallback(
(ev: React.MouseEvent): void => {
if (onDoubleClick && ref.current && ref.current.contains(ev.target as Node)) {
onDoubleClick && onDoubleClick();
}
},
[onDoubleClick],
);

return (
<div
ref={ref}
className={classNames("topbar-box", { showWindowsSystemBtn })}
onDoubleClick={onDoubleClickSelf}
>
<div className="topbar-content-left">{left}</div>
<div className="topbar-content-center">{center}</div>
<div className="topbar-content-right">
{right}
{showWindowsSystemBtn && onClickWindowsSystemBtn && (
<>
<WindowsSystemBtn
hiddenMaximizeBtn={hiddenMaximizeBtn}
onClickWindowsSystemBtn={onClickWindowsSystemBtn}
/>
</>
)}
</div>
</div>
</div>
);
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ export class AgoraRTCElectronShareScreen extends IServiceShareScreen {
this._lastEnabled = false;

this._pTogglingShareScreen = new Promise<void>(resolve => {
this.client.enableLoopbackRecording(false);
this._delegateLocalAudio(false);
this.client.adjustRecordingSignalVolume(100);
this.client.adjustLoopbackRecordingSignalVolume(0);
this.client.enableLoopbackRecording(false);
this.client.stopScreenCapture2();
this.client.once("videoSourceLeaveChannel", () => {
this.client.videoSourceRelease();
Expand Down

0 comments on commit 63d5470

Please sign in to comment.