Migrating from 1.x to 2.x
This document describes significant changes introduced by SDK 2.x for each platform: Web SDK, iOS SDK, and Android SDK.
Web SDK
General changes
- Introduced services and moved all methods to the proper services. For example, joining a conference requires calling the join method that is available in the Conference service:
// v1.x
voxeet.joinConference();
// v2.x
VoxeetSDK.conference.join();
-
Replaced the
conferenceId
parameter with the conference ID that is available in the Conference object. -
Replaced the
userId
parameter with the participant's ID that is available in the Conference object. -
Modified the code structure. The new structure requires using the Conference service with the Participant object parameter in order to create event listeners:
VoxeetSDK.conference.on("participantAdded", (participant: Participant) => {});
Changes in initialization
- Introduced a new
VoxeetSDK
object that replaces the previousVoxeetSdk()
instance:
// v1.x
const voxeet = new VoxeetSdk();
voxeet.initialize();
...
// v2.x
VoxeetSDK.initialize();
...
- Introduced the open method that logs in a user and opens a session after initializing SDK. Opening a session is no longer embedded in the initialize method:
VoxeetSDK.initialize("customerKey", "customerSecret");
try {
await VoxeetSDK.session.open(participantInfo);
} catch (e) {
alert("Something went wrong : " + e);
}
- Modified the initialize method. The method does not return the session ID anymore. The session ID is available in the Session service:
const id = VoxeetSDK.session.participant.id;
Changes in creating conferences
Modified the create method. The method now returns the Conference object instead of the conference ID:
VoxeetSDK.conference.create({ alias }).then((conference) => {
/* ... */
});
Changes in muting
- Replaced the toggleMute method with the mute method that is available in the Conference service:
// v1.x
voxeet.toggleMute(...);
// v2.x
VoxeetSDK.conference.mute(participant, isMuted);
Changes in isUserSpeaking and getUserLevel
-
Replaced the isUserSpeaking method with isSpeaking. The isSpeaking method uses the Participant object as a parameter.
-
Replaced the getUserLevel method with audioLevel. The audioLevel method uses the Participant object as a parameter.
// v1.x
voxeet.isUserSpeaking(userId, (isSpeaking) => {
...
});
voxeet.getUserLevel(userId, (level) => {
...
});
// v2.x
// Gets a participant's audio level
VoxeetSDK.conference.audioLevel(participant, (level) => {
});
// Checks if a participant is speaking
VoxeetSDK.conference.isSpeaking(participant, (isSpeaking) => {
});
Changes in file presentations
-
Replaced the getThumbnail method with the thumbnail method.
-
Replaced the updateFilePresentation method with the update method.
The new methods use a page number as a parameter.
// v1.x
voxeet.startFilePresentation({ fileId: "fileId" });
voxeet.getImage({ fileId: "fileId" });
voxeet.getThumbnail({ fileId: "fileId" });
// v2.x
VoxeetSDK.filePresentation.image(page);
VoxeetSDK.filePresentation.thumbnail(page);
VoxeetSDK.filePresentation.update(page);
iOS SDK
General changes
- Some APIs were renamed. For more information, see the Release Notes.
Changes in the VTUser instances
- Replaced all
VTUser
instances with VTParticipant that embeds stream arrays and stream types:
// v1.x
// Checks if there is a stream associated with a specific conference participant
if user.hasStream {}
// v2.x
// Checks if there is a stream associated with a specific conference participant
if !participant.streams.isEmpty {}
// Gets a camera stream
if let stream = participant.streams.first(where: { $0.type == .Camera }) {}
Changes in creating and joining conferences
- Modified the create and join methods. These methods no longer take and return dictionaries, they take and return models:
// v1.x
// Creates a conference
VoxeetSDK.shared.conference.create(parameters: ["conferenceAlias": "alias", success: { json in
guard let conferenceID = json?["conferenceId"] as? String else { return }
// Joins a conference
VoxeetSDK.shared.conference.join(conferenceID: conferenceID, success: { json in
}, fail: { error in
})
}, fail: { error in
})
// v2.x
let options = VTConferenceOptions()
options.alias = "alias"
// Creates a conference
VoxeetSDK.shared.conference.create(options: options, success: { conference in
// Joins a conference
VoxeetSDK.shared.conference.join(conference: conference, success: { conference in
}, fail: { error in
})
}, fail: { error in
})
Changes in the VTConferenceDelegate instances
Modified the VTConferenceDelegate instances. The modified instances emit new events:
-
The participantJoined and screenShareStarted events were replaced with the streamAdded event
-
The participantUpdated event was replaced with the streamUpdated event
-
The participantLeft and screenShareStopped events were replaced with the streamRemoved event
// v1.x
extension Class: VTConferenceDelegate {
func participantJoined(userID: String, stream: MediaStream) {
if !stream.videoTracks.isEmpty {
videoView.attach(userID: userID, stream: stream)
}
}
func participantUpdated(userID: String, stream: MediaStream) {}
func participantLeft(userID: String) {}
func screenShareStarted(userID: String, stream: MediaStream) {}
func screenShareStopped(userID: String) {}
func messageReceived(userID: String, message: String) {}
}
// v2.x
extension Class: VTConferenceDelegate {
func streamAdded(participant: VTParticipant, stream: MediaStream) {
switch stream.type {
case .Camera:
if !stream.videoTracks.isEmpty {
videoView.attach(participant: participant, stream: stream)
}
case .ScreenShare: break
default: break
}
}
func streamUpdated(participant: VTParticipant, stream: MediaStream) {}
func streamRemoved(participant: VTParticipant, stream: MediaStream) {}
func statusUpdated(status: VTConferenceStatus) {}
func participantAdded(participant: VTParticipant) {}
func participantUpdated(participant: VTParticipant) {}
}
Android SDK
General changes
- Introduced services that can be used statically using VoxeetSDK:
//v1.x
VoxeetSDK.getInstance().XXX()
//v2.x
VoxeetSDK.XXX()
//The getInstance API is still available
VoxeetSDK.getInstance()
- Introduced promises that allow using transitive calls similarly to JavaScript promises:
VoxeetSdk.conference().create("")
.then((ThenPromise<CreateConferenceResult, Conference>) result ->
VoxeetSdk.conference().join(result.conferenceId))
.then(result -> {
//Manage the join result
})
.error(Throwable::printStackTrace);
Changes in the Conference service
-
Introduced the Conference service that returns classes without the
-Event
suffix -
Introduced ServerErrorException that returns server-side information. The error can occur after calling one of the following methods: join, listen, broadcast, or create:
VoxeetSDK.conference().join(conferenceId)
.then(result -> {
}).error(error -> {
if(error instanceof ServerErrorException) {
ServerErrorException err = (ServerErrorException) error;
//Manage error
} else {
//Manage the standard exception
}
})
Changes in the User instances
- Replaced the
User
instance with the Participant instance:
//v1.x
List<User> users = VoxeetSDK.conference().getUsers();
//v2.x
List<Participant> participants = VoxeetSDK.conference().getParticipants();
- Replaced the
getConferenceUsers()
method with the getParticipants method
Updated 7 months ago