Skip to content

Commit 7d0360b

Browse files
hyriousBlackHole1
authored andcommitted
feat(web): support window manager in replay mode (#1140)
1 parent 66811e7 commit 7d0360b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

web/flat-web/src/api-middleware/SmartPlayer.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import "video.js/dist/video-js.css";
2-
2+
import "@netless/window-manager/dist/style.css";
33
import CombinePlayerFactory, { CombinePlayer, PublicCombinedStatus } from "@netless/combine-player";
4-
import { CursorTool } from "@netless/cursor-tool";
54
import {
65
PluginId as VideoJsPluginId,
76
videoJsPlugin,
@@ -19,6 +18,7 @@ import {
1918
} from "white-web-sdk";
2019
import { Region } from "flat-components";
2120
import { NETLESS, NODE_ENV } from "../constants/process";
21+
import { WindowManager } from "@netless/window-manager";
2222

2323
export enum SmartPlayerEventType {
2424
Ready = "Ready",
@@ -99,6 +99,7 @@ export class SmartPlayer extends EventEmitter<SmartPlayerEventType> {
9999
appIdentifier: NETLESS.APP_IDENTIFIER,
100100
plugins: plugins,
101101
region,
102+
useMobXState: true,
102103
});
103104

104105
this.whiteWebSdk = whiteWebSdk;
@@ -123,13 +124,12 @@ export class SmartPlayer extends EventEmitter<SmartPlayerEventType> {
123124
}
124125
});
125126

126-
const cursorAdapter = new CursorTool();
127-
128127
const replayRoomParams: ReplayRoomParams = {
129128
room: whiteboardUUID,
130129
roomToken: whiteboardRoomToken,
131-
cursorAdapter: cursorAdapter,
132130
region,
131+
invisiblePlugins: [WindowManager],
132+
useMultiViews: true,
133133
};
134134

135135
if (recording) {
@@ -138,9 +138,6 @@ export class SmartPlayer extends EventEmitter<SmartPlayerEventType> {
138138
}
139139

140140
const player = await whiteWebSdk.replayRoom(replayRoomParams, {
141-
onLoadFirstFrame: () => {
142-
cursorAdapter.setPlayer(player);
143-
},
144141
onPhaseChanged: phase => {
145142
if (this.combinePlayer) {
146143
return;
@@ -183,9 +180,12 @@ export class SmartPlayer extends EventEmitter<SmartPlayerEventType> {
183180
},
184181
});
185182

186-
cursorAdapter.setPlayer(player);
187-
188-
player.bindHtmlElement(whiteboardEl);
183+
void WindowManager.mount({
184+
room: player as any,
185+
container: whiteboardEl,
186+
cursor: true,
187+
chessboard: false,
188+
});
189189

190190
this.whiteboardPlayer = player;
191191

web/flat-web/src/stores/class-room-replay-store.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class ClassRoomReplayStore {
148148
});
149149
} catch (error) {
150150
console.error(error);
151-
this.updateError(error);
151+
this.updateError(error as Error);
152152
}
153153

154154
runInAction(() => {

0 commit comments

Comments
 (0)