Tutorials

Video conferencing API: run meetings and webinars from your own code

How the DCAST rooms API lets your own code create meeting rooms, admit guests from the waiting room, run quizzes and handle refused requests.

dcast Team
8 min read
Share:
office environment, discussion, collaboration, presentation, business, technology, ties, work environment, people, conference
On this page

If you want meetings or webinars inside your own product, a video conferencing API lets your code do what a host would otherwise do by hand. With the DCAST rooms API your code creates meeting rooms, lets guests in from the waiting room and runs quizzes, and when a request is refused the answer names the field you need to fix. This article walks through the decisions you face when you build on it, in the order a real webinar goes, and it points out where your own code should be careful.

Upload, stream and sell your videos. Start on the free plan — no card needed.

Get Started Free

What a room API gives you

A room is the object everything else hangs from. Through the partner API you can list rooms, read one, create one, change it, replace it, delete it, start it and end it. Around that core sit the calls for people and activities: the participants of a room, admitting, muting or removing a participant, polls, quizzes and reactions. You do not need the dashboard open for any of this, which is what makes a webinar something your own scheduling page or customer portal can run.

The calls that act on a live room, such as admitting a guest or starting a recording, need an API key that is allowed to operate rooms. If one of those calls is refused, check the permissions of the key you give your server before you blame your own code. Give the key only what your integration needs, because the same key will be sitting in your back end for as long as the integration runs.

Create a room for now or for later

The first decision is the type of room. You can create a room for right now or schedule one, and the start time you send is stored and comes back in the answer. Choose an instant room for an ad hoc call, such as a support session started from a button. Choose a scheduled room for a webinar, where your registration page already knows the date and your code can show the same time back to attendees.

Send a title that is real text and, for a scheduled room, a start time in the standard ISO 8601 date format. A start time that is not a real date, or a title that is not text, is refused with the field named. That helps you when you debug: your logs say which field was wrong instead of a vague failure, so you can show your own user a precise message or fix the bug in your form.

Expect the same care when you reschedule. When you change a schedule, an end that falls before the start is refused and nothing is written. So if your editor lets an organiser drag the end of a webinar earlier than its start, you can treat the refusal as a validation message and keep the stored room exactly as it was.

One more property matters for public webinars. A room created through the API is closed to visitors without a DCAST account: such a visitor is refused at its join link. Plan your invitation flow around that, and test the join link with someone who is not signed in before you promise attendees an open door.

Start and end a room from your code

Starting behaves differently for the two types, and your code should read the answer rather than assume. When your code starts a scheduled room, the answer shows the room waiting for people to join. An instant room is live from the moment it is created, and starting it answers it as it is. So after a start call, branch on the status you receive: waiting means the room is open for people to join, live means it is already running.

Starting a scheduled room is also refused when your plan has no active-room place left. Handle that refusal in your code as a capacity condition, not a bug. Show your organiser a clear message that the room cannot open yet, and decide in advance whether your product should offer to end another room or simply ask them to try again later.

The answers to start and end describe the room the way your code reads it, without its password or internal server details. You can pass those answers on to your own front end without filtering secrets out first, though you should still shape the data to what your page needs.

Ending is safe to repeat. Ending a room a second time does not move its end time and does not count the participants' time again. That matters because real systems retry: a timeout on your side, a job queue that delivers twice or an impatient host clicking an end button twice will not distort the end time you store.

To build a dashboard of your own events, use the list of rooms. It can be filtered by status, and a status that does not exist is refused instead of being ignored. That protects you from a typo that would otherwise quietly return the wrong set of rooms and make an events page look broken.

Admit guests from the waiting room

The waiting room is where a webinar stays under your control. Your code lists the participants of a room and calls the admit operation for the ones you accept. A guest admitted from the waiting room can watch and send data, and can send camera, microphone and screen only as far as your room settings allow, before your admit call marks them as joined. This order means the guest never appears as joined while still lacking access.

Because rights follow your room settings, decide those settings before the event rather than expecting every guest to get everything. In a room where raising a hand opens the microphone, the guest is admitted without it, which suits a large audience where you give the floor to one person at a time.

Plan for failure too. If the media server refuses to let the guest in, the guest stays in the waiting room and the answer is a temporary error your code can retry. Your admit button should therefore show a retry state instead of marking the person as present. And since a guest who has not connected yet can still be admitted ahead of time, you can admit a list of expected speakers before they open the link.

Run quizzes and send reactions

Quizzes turn a webinar into something people take part in. A quiz question takes its own points and time limit, and a negative value or a word instead of a number is refused before anything is stored. If your form lets a host type a time limit freely, convert it to a number on your side first, and show the refusal to the host if it still comes back.

Reactions need one distinction in your error handling. A reaction sent into a room that is not running yet is answered as a room that is not active, not as an outage. Treat the first as a normal timing case, for example by disabling the reaction button until the room is running, and reserve alarms for the second kind of failure, where the transport itself did not work.

Recording and plan conditions

Recording is the one room operation tied to your plan. Recording a room through the API works on the STAR, PRO and VIP plans, and on the FREE plan the answer says recording is a paid feature. If your product offers recordings to its own customers, check the plan of the DCAST account behind your key at design time, and show your users a plain message when the answer says recording is locked, rather than a generic error.

Keep your key safe and rehearse first

Keep your API key on your server and never place it in a page that your visitors load. Anyone who can read the key in a page can act as your integration, so every room call should go from your back end, with your own login deciding which of your users may ask for it. Your page talks to your server, and your server talks to DCAST.

Before your first webinar, try the waiting room with a colleague, so you know how admitting a guest looks on both sides. Run the whole path once: create a scheduled room, start it, let your colleague join, admit them, send a reaction and end the room. Then end it again on purpose to confirm your code copes with a repeated call. A rehearsal like this finds permission and settings problems while nobody is watching.

Finally, keep a record in your own database of what each refusal told you. Because the answers name the field to fix, a short log line per failed call is usually enough to tell a form bug from a capacity condition or a temporary error, and it lets your support team answer an organiser without reading code.

The same key also serves the video side of the partner API, so a site that already adds videos or live broadcasts from its own code can reuse its server-side setup for rooms. Videos added this way belong to the account that owns the key, and the same rule applies: keep that key away from pages your visitors load.

API documentation for this topic

d

dcast Team

Professional video streaming experts helping creators succeed.

Start Your Video Business Today

Upload, stream and sell your videos. Start on the free plan — no card needed.

Get Started Free