Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web,renderer-app): correctly destroy window-manager on exit #1352

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions desktop/renderer-app/src/api-middleware/smart-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class SmartPlayer extends EventEmitter {
public whiteboardPlayer: Player | undefined;
public combinePlayer: CombinePlayer | undefined;
public whiteWebSdk: WhiteWebSdk | undefined;
public windowManagerPromise: Promise<WindowManager> | undefined;

public get isPlaying(): boolean {
return this._isPlaying;
Expand Down Expand Up @@ -89,7 +90,6 @@ export class SmartPlayer extends EventEmitter {
this._isPlaying = false;
this._isReady = false;
this._isEnded = false;
this.destroy();

const plugins = createPlugins({ [VideoJsPluginId]: videoJsPlugin() });
const videoJsPluginContext: Partial<VideoJsPluginContext> = { verbose: true };
Expand Down Expand Up @@ -180,7 +180,7 @@ export class SmartPlayer extends EventEmitter {
},
});

void WindowManager.mount({
this.windowManagerPromise = WindowManager.mount({
room: player as any,
container: whiteboardEl,
cursor: true,
Expand Down Expand Up @@ -290,6 +290,9 @@ export class SmartPlayer extends EventEmitter {
}

public destroy(): void {
this.windowManagerPromise?.then(manager => {
manager.destroy();
});
this.whiteWebSdk = undefined;
if (this._isPlaying) {
this.whiteboardPlayer?.stop();
Expand Down
7 changes: 5 additions & 2 deletions web/flat-web/src/api-middleware/SmartPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class SmartPlayer extends EventEmitter<SmartPlayerEventType> {
public whiteboardPlayer: Player | undefined;
public combinePlayer: CombinePlayer | undefined;
public whiteWebSdk: WhiteWebSdk | undefined;
public windowManagerPromise: Promise<WindowManager> | undefined;

public get isPlaying(): boolean {
return this._isPlaying;
Expand Down Expand Up @@ -89,7 +90,6 @@ export class SmartPlayer extends EventEmitter<SmartPlayerEventType> {
this._isPlaying = false;
this._isReady = false;
this._isEnded = false;
this.destroy();

const plugins = createPlugins({ [VideoJsPluginId]: videoJsPlugin() });
const videoJsPluginContext: Partial<VideoJsPluginContext> = { verbose: true };
Expand Down Expand Up @@ -180,7 +180,7 @@ export class SmartPlayer extends EventEmitter<SmartPlayerEventType> {
},
});

void WindowManager.mount({
this.windowManagerPromise = WindowManager.mount({
room: player as any,
container: whiteboardEl,
cursor: true,
Expand Down Expand Up @@ -290,6 +290,9 @@ export class SmartPlayer extends EventEmitter<SmartPlayerEventType> {
}

public destroy(): void {
this.windowManagerPromise?.then(manager => {
manager.destroy();
});
this.whiteWebSdk = undefined;
if (this._isPlaying) {
this.whiteboardPlayer?.stop();
Expand Down