NEWDolby Interactivity APIs are now the Dolby.io Communications APIs Learn More >
X

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 previous VoxeetSdk() 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

// v1.x
voxeet.toggleMute(...);

// v2.x
VoxeetSDK.conference.mute(participant, isMuted);

Changes in isUserSpeaking and getUserLevel

// 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

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:

// 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

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();

Did this page help you?