Migrate From Vonage Video to Dyte with OpenTok Shim
Oh, the good ol' 2010s in the world of live video API providers! Remember when we used to gather around the virtual campfire, share tales of unexpected errors, and toast to every mysterious bug that would pop up without warning? All those edge cases that you had to handle on your own. Ah, yes, those were the days of true digital wilderness. As much as we've enjoyed being pioneering explorers, constantly charting unknown territories (and by that, I mean uncharted errors), the time for change has come.
Why Migrate from Vonage Video to Dyte?
Why would one want to migrate from one of the earliest WebRTC vendors — OpenTok/Vonage Video — to Dyte?
Well, the answer is simple: Dyte offers a superior experience.
- Easy to use APIs: With high-level abstractions and inbuilt access control — fewer bugs and requires less maintenance.
- UI components library: A comprehensive library of responsive components for React, Angular, Web Components, React Native, Flutter, Native Android, and iOS. Build real-time applications faster.
- Better media performance: With Dyte's global mesh network of media servers, and calls spanning multiple geographies — sense a significantly better experience.
- Reliable network/media handling: It selects the correct audio, and video devices, picks up the best resolution, FPS, and does it all reliably — handles reconnection, packet loss, and every other disruption.
- Better support: Has dedicated Slack support, code reviews, and technical assistance round the clock 24/7.
It is like switching houses after ages. It is not the easiest task, the packing, the labeling, the moving, but the inevitable realization hits — that you've collected too many unnecessary things over the years, and it's time for a clean-up and an upgrade.
Opentok Shim Library
While switching from Opentok to Dyte is not easy, we have something to make the transition smoother.
Introducing the OpenTok Shim library. Think of it as a translator fluent in both OpenTok and Dyte. The @dytesdk/opentok-shim
package wraps around the Dyte SDK, offering an external API fully compatible with Opentok JS. It's like having a doppelganger for Opentok JS, capable of handling most of the methods and events present in the original library.
Start migrating from Vonage Video to Dyte with Shim
To get started with the Dyte Shim for OpenTok, do the following:
- Install the Shim from the NPM registry using the following command:
npm install @dytesdk/opentok-shim
- Once you have installed the package, you can use it in your project by importing it:
import * as OT from "@dytesdk/opentok-shim";
Connection
To create a connection to an OpenTok session, you can use the OT.initSession()
method. This method takes the following arguments:
- Token
- Session ID
You can obtain the Dyte authentication token <DYTE-AUTH-TOKEN>
using the Add a Participant API.
const token = "<DYTE-AUTH-TOKEN>";
const sessionId = "";
const session = OT.initSession(token, sessionId);
Listen for events
session.on("streamCreated", function streamCreated(event) {
console.log("[streamCreated] index.ts: ", event.stream);
session.subscribe(
event.stream,
"subscriber",
{
insertMode: "append",
width: "100%",
height: "100%",
},
handleError
);
// }
});
let connections: OT.Connection[] = [];
session.on("connectionCreated", (connectionCreatedEvent) => {
console.log("session connectionCreatedEvent: ", connectionCreatedEvent);
connections.push(connectionCreatedEvent.connection);
if (
connections.find(
(connection) =>
connection.connectionId ===
connectionCreatedEvent.connection.connectionId
)
) {
console.log("connection already exists");
return;
}
connections.push(connectionCreatedEvent.connection);
});
session.on("connectionDestroyed", (connectionDestroyedEvent) => {
console.log("session connectionDestroyedEvent: ", connectionDestroyedEvent);
connections = connections.filter(
(connection) =>
connection.connectionId !==
connectionDestroyedEvent.connection.connectionId
);
});
The above code sample is a basic example. Please refer to this for the complete migration guide.
Conclusion
Migrating from Vonage Video to Dyte is not just about switching platforms but embracing a more efficient and developer-friendly environment. So, why wait? Start your migration journey today and experience the magic of Dyte!
Here's to nudge the adventurers towards exploring the change we built with love. If you have any thoughts or feedback, please get in touch with me on LinkedIn and Twitter. Stay tuned for more related blog posts in the future!
If you haven't heard about Dyte yet, head over to dyte.io to learn how we are revolutionizing communication through our SDKs and libraries and how you can get started quickly on your 10,000 free minutes, which renew every month. You can reach us at support@dyte.io or ask our developer community if you have any questions.