react-device-detect#isWindows TypeScript Examples
The following examples show how to use
react-device-detect#isWindows.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WhiteboardPage.tsx From whiteboard-demo with MIT License | 4 votes |
private startJoinRoom = async (): Promise<void> => {
const {uuid, userId, identity,region} = this.props.match.params;
this.setRoomList(uuid, userId);
const query = new URLSearchParams(window.location.search);
const h5Url = decodeURIComponent(query.get("h5Url") || "");
const h5Dir = query.get("h5Dir");
try {
const roomToken = await this.getRoomToken(uuid);
if (uuid && roomToken) {
const plugins = createPlugins({
"video": videoPlugin, "audio": audioPlugin,
"video2": videoPlugin2, "audio2": audioPlugin2,
"video.js": videoJsPlugin(),
});
plugins.setPluginContext("video", {identity: identity === Identity.creator ? "host" : ""});
plugins.setPluginContext("audio", {identity: identity === Identity.creator ? "host" : ""});
plugins.setPluginContext("video2", {identity: identity === Identity.creator ? "host" : ""});
plugins.setPluginContext("audio2", {identity: identity === Identity.creator ? "host" : ""});
plugins.setPluginContext("video.js", { enable: identity === Identity.creator, verbose: true });
let deviceType: DeviceType;
if (isWindows) {
deviceType = DeviceType.Surface;
} else {
if (isMobile) {
deviceType = DeviceType.Touch;
} else {
deviceType = DeviceType.Desktop;
}
}
let whiteWebSdkParams: WhiteWebSdkConfiguration = {
appIdentifier: netlessToken.appIdentifier,
plugins: plugins,
region,
preloadDynamicPPT: true,
deviceType: deviceType,
pptParams: {
useServerWrap: true,
},
}
const pluginParam = {
wrappedComponents: [/*Player*/] as any[],
invisiblePlugins: [/*WhitePPTPlugin*/] as any[],
}
if (h5Url) {
pluginParam.wrappedComponents.push(IframeWrapper);
pluginParam.invisiblePlugins.push(IframeBridge);
}
whiteWebSdkParams = Object.assign(whiteWebSdkParams, pluginParam);
const whiteWebSdk = new WhiteWebSdk(whiteWebSdkParams);
const cursorName = localStorage.getItem("userName");
const cursorAdapter = new CursorTool();
const room = await whiteWebSdk.joinRoom({
uid: uuid,
uuid: uuid,
roomToken: roomToken,
cursorAdapter: cursorAdapter,
userPayload: {
userId: userId,
cursorName: cursorName,
// theme: "mellow",
// cursorBackgroundColor: "#FDBA74",
// cursorTextColor: "#323233",
// cursorTagName: "讲师",
// cursorTagBackgroundColor: "#E5A869",
},
disableNewPencil: false,
floatBar: true,
hotKeys: {
...DefaultHotKeys,
changeToSelector: "s",
changeToLaserPointer: "z",
changeToPencil: "p",
changeToRectangle: "r",
changeToEllipse: "c",
changeToEraser: "e",
changeToText: "t",
changeToStraight: "l",
changeToArrow: "a",
changeToHand: "h",
},
},
{
onPhaseChanged: phase => {
this.setState({phase: phase});
},
onRoomStateChanged: (modifyState: Partial<RoomState>): void => {
if (modifyState.broadcastState) {
this.setState({mode: modifyState.broadcastState.mode});
}
},
onDisconnectWithError: error => {
console.error(error);
},
onKickedWithReason: reason => {
console.error("kicked with reason: " + reason);
},
});
cursorAdapter.setRoom(room);
this.setDefaultPptData(pptData, room);
if (room.state.broadcastState) {
this.setState({mode: room.state.broadcastState.mode})
}
this.setState({room: room});
(window as any).room = room;
if (h5Url && h5Dir) {
await this.handleEnableH5(room, h5Url, h5Dir);
} else if (h5Url) {
await this.handleEnableH5(room, h5Url);
}
this.slidePrefetch.listen(room);
// await this.handlePPTPlugin(room);
}
} catch (error) {
message.error(String(error));
console.trace(error);
}
}