The SuperViz SDK received the long-awaited version 5! It comes with tons of new collaboration tools as you can see in our release notes. This update brings exciting changes that enable developers to work more flexibly and opens doors for potential product additions in the future.
One notable change is the introduction of the "room" concept, which represents a collaborative space where components come together. In this post, I'll walk you through how to update your SuperViz integration with Matterport, from v4 to v5.
This post will cover the basics, and if you need any other details on what has changed, please take a look at our migration guide.
Update packages
Before you start, you need to update the @superviz/sdk
to version 5.0.1 or higher, and the @superviz/matterport-plugin
to version 0.10.0 or higher.
Code updates
In SuperViz SDK v5, the way you initialize components has been revamped.
You no longer initialize the video meeting along with the SDK in one go. Instead, you now need to initialize the SDK (and we are now calling this as a room) and all other components separately.
Step 1: update the SDK Initialization
The first step is to locate the SuperViz SDK constructor, it is the same place where you pass you DEVELOPER_KEY and the SDK options.
The list of itens on the SDK options is reduced, so you may need to remove some of these properties if you are using them:
-
participant.type
,camsOff
,screenshareOff
,defaultAvatars
,enableFollow
,enableGoTo
,enableGather
,language
,locales
,customColors
,avatars
,devices
object,skipMeetingSettings
,camerasPosition
,layoutPosition
, are now under the Video Conference, as I will explain later in this post. - You can set
isMouseEnabled
andisLaserEnabled
in the Matterport plugin. -
participant.color
anddisableCameraOverlay
should be removed. - We renamed the
participant.avatar.model
toparticipant.avatar.model3DUrl
In the end, you should have a code looking like this:
import SuperVizRoom from '@superviz/sdk';
// Create an instance of a room.
// We updated the name SuperVizSdk to SuperVizRoom, but you can leave as you want.
const room = await SuperVizRoom(DEVELOPER_KEY, {
roomId: "<ROOM-ID>",
group: {
id: "<GROUP-ID>",
name: "<GROUP-NAME>",
},
participant: {
id: "<USER-ID>",
name: "<USER-NAME>",
avatar: {
"model3DUrl": "<PATH>"
}
},
});
The code above shows how to initialize a room when you use SuperViz SDK as a package, that means, if you downloaded it from npm, pnpm or Yarn. If you are importing it from the <script>
tag in HTML, the initialization is a bit different as it needs to be window.SuperVizRoom.init()
.
Once you done it, you have a room!
Step 2: Adding Video Conference component
Creating a room doesnโt mean that the video meeting will start. You must add it to the room. Itโs quite simple, to add a Video Conference to the room, use the code below:
import { VideoConference } from "@superviz/sdk/lib/components";
// Create a Video component instance with the configuration you want
const video = new VideoConference({
// ...
camsOff: false,
// ...
});
room.addComponent(video);
When creating a Video Conference, you can pass the properties that you removed before from the SDK Initialization. To check the full list of changes, heads up to the table of properties on the migration guide.
You can also check the Video Conference documentation for any further details, like events implementation.
Step 3: Changing your Matterport plugin implementation
Previously, you would use loadPlugin()
after a participant joined a room. Now, you must create an instance of Presence3D, and add it to the room. Here's how to load the Matterport viewer:
import { Presence3D } from "@superviz/matterport-plugin";
const matterportPresence = new Presence3D(mpSdk, {
isAvatarsEnabled: true,
isLaserEnabled: true,
isNameEnabled: true,
avatarConfig: {
height: 0,
scale: 1,
laserOrigin: { x: 0, y: 0, z: 0 },
},
});
room.addComponent(matterportPresence);
After these three steps, you are good to go! Keep in mind that this is a high-level overview, and it's essential to dive into the SDK documentation or our migration guide for detailed information and updates.
If you need any help updating, head to our Discord server!
Happy coding and enjoy the enhanced capabilities of SuperViz SDK v5!
Top comments (0)