Voor apps
Groepsvideogesprekken voor je app
Een API en SDK voor videovergaderen voor Next.js, Laravel, Django en elke andere stack. Vergaderingen, lessen, panels en audioruimtes draaien op onze mediaservers, zonder limiet op mensen in een gesprek, en het belscherm is klaar voor gebruik, dus je hoeft geen mediaserver te draaien.
De beste prijzen voor WebSockets, onbeperkte 1-op-1-gesprekken met TURN-servers wereldwijd, en groepsgesprekken en livestreaming met een inbegrepen tegoed. Vanaf $11.99 per maand voor 1.000 gelijktijdige verbindingen, jaarlijks gefactureerd, of $14.99 maandelijks gefactureerd.
Groepsgesprekken boven je abonnement: $0.20 per 1.000 minuten, $0.10 met audio.
Next.js op de server en React op de pagina.
export async function GET( request: Request ) {
const me = await currentUserId();
const id = new URL( request.url ).searchParams.get( 'id' )!;
// Your own check: only its team, and its lead is the host.
if ( ! me || ! await isMemberOf( id, me ) ) {
return new Response( null, { status: 403 } );
}
const token = await realtime.groupCallToken( me, 'meeting:' + id, {
admin: await isLeadOf( id, me ),
} );
return Response.json( { token } );
}app.get( '/api/meeting-token', async ( req, res ) => {
const me = userOf( req );
const { id } = req.query;
// Your own check: only its team, and its lead is the host.
if ( ! me || ! await isMemberOf( id, me ) ) {
return res.sendStatus( 403 );
}
const token = await realtime.groupCallToken( me, 'meeting:' + id, {
admin: await isLeadOf( id, me ),
} );
res.json( { token } );
} );import { createServer } from 'node:http';
createServer( async ( req, res ) => {
const url = new URL( req.url, 'http://localhost' );
if ( url.pathname === '/api/meeting-token' ) {
const me = userOf( req );
const id = url.searchParams.get( 'id' );
// Your own check: only its team, and its lead is the host.
if ( ! me || ! await isMemberOf( id, me ) ) {
res.writeHead( 403 );
return res.end();
}
const token = await realtime.groupCallToken( me, 'meeting:' + id, {
admin: await isLeadOf( id, me ),
} );
res.writeHead( 200, { 'Content-Type': 'application/json' } );
return res.end( JSON.stringify( { token } ) );
}
// Your pages, and realtime.node( userOf ) for the SDK's routes.
} ).listen( 3000 );use Illuminate\Http\Request;
use WordPlus\Realtime\Laravel\Facades\Realtime;
Route::get( '/api/meeting-token', function ( Request $request ) {
$me = $request->user()->id;
$id = $request->query( 'id' );
// Your own check: only its team, and its lead is the host.
abort_unless( is_member_of( $id, $me ), 403 );
return [ 'token' => Realtime::groupCallToken( $me, 'meeting:' . $id, [
'admin' => is_lead_of( $id, $me ),
] ) ];
} )->middleware( 'auth' );require __DIR__ . '/../src/realtime.php';
$me = current_user_id();
$id = $_GET['id'] ?? '';
// Your own check: only its team, and its lead is the host.
if ( ! $me || ! is_member_of( $id, $me ) ) {
http_response_code( 403 );
exit;
}
header( 'Content-Type: application/json' );
echo json_encode( [
'token' => $realtime->groupCallToken( $me, 'meeting:' . $id, [
'admin' => is_lead_of( $id, $me ),
] ),
] );from django.contrib.auth.decorators import login_required
from django.http import HttpResponseForbidden, JsonResponse
from .realtime import realtime
# In urls.py: path("api/meeting-token", views.meeting_token)
@login_required
def meeting_token(request):
me = request.user.id
id = request.GET["id"]
# Your own check: only its team, and its lead is the host.
if not is_member_of(id, me):
return HttpResponseForbidden()
token = realtime.group_call_token(
me, "meeting:" + id, admin=is_lead_of(id, me)
)
return JsonResponse({"token": token})from fastapi import Depends, HTTPException
from realtime import realtime
@app.get("/api/meeting-token")
def meeting_token(id: str, me: int = Depends(current_user_id)):
# Your own check: only its team, and its lead is the host.
if not me or not is_member_of(id, me):
raise HTTPException(403)
token = realtime.group_call_token(
me, "meeting:" + id, admin=is_lead_of(id, me)
)
return {"token": token}from flask import abort, request, session
from realtime import realtime
@app.get("/api/meeting-token")
def meeting_token():
me = session.get("user_id")
id = request.args["id"]
# Your own check: only its team, and its lead is the host.
if not me or not is_member_of(id, me):
abort(403)
token = realtime.group_call_token(
me, "meeting:" + id, admin=is_lead_of(id, me)
)
return {"token": token}// http.HandleFunc("GET /api/meeting-token", meetingToken)
func meetingToken(w http.ResponseWriter, r *http.Request) {
me := userOf(r)
id := r.URL.Query().Get("id")
// Your own check: only its team, and its lead is the host.
if me == "" || !isMemberOf(id, me) {
w.WriteHeader(403)
return
}
token := app.GroupCallToken(me, "meeting:"+id, wordplus.GroupPlace{
Admin: isLeadOf(id, me),
Info: profile(me),
})
reply(w, map[string]string{"token": token})
}Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window.
await rt.callScreen();
// And in the page:
// <group-call-button call="meeting:7"
// token-url="/api/meeting-token?id=7"
// type="video" title="Daily meeting">
// Join the meeting
// </group-call-button><group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
Join the meeting
</group-call-button>
<script type="module">
// The call window, on every page a meeting may open from.
await window.Echo.connector.rt.callScreen();
</script>'use client'; // in Next.js
import { CallScreen, GroupCallButton } from '@wordplus/realtime/react';
// Inside <RealtimeProvider>, once for the whole app.
export function JoinMeeting() {
return (
<>
<CallScreen />
<GroupCallButton call="meeting:7" tokenUrl="/api/meeting-token?id=7" type="video" title="Daily meeting">
Join the meeting
</GroupCallButton>
</>
);
}<script setup>
import { watchEffect } from 'vue';
import { useRealtime } from '@wordplus/realtime/vue';
// provideRealtime() once, in your root component.
const rt = useRealtime();
// The call window, on every page a meeting may open from.
watchEffect( () => rt.value?.callScreen() );
</script>
<!-- isCustomElement for this tag, in vite.config.js -->
<template>
<group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
Join the meeting
</group-call-button>
</template><script>
import { useRealtime } from '@wordplus/realtime/svelte';
// provideRealtime() once, in your root component.
const rt = useRealtime();
// The call window, on every page a meeting may open from.
$effect( () => { rt.current?.callScreen(); } );
</script>
<group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
Join the meeting
</group-call-button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-join-meeting',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">Join the meeting</group-call-button>`,
} )
export class JoinMeetingComponent {
async ngOnInit() {
const rt = await realtime;
// The call window, on every page a meeting may open from.
await rt.callScreen();
}
}import WordPlusRealtimeCalls
import WordPlusRealtimeUI
let token = try await api.meetingToken(id: 7) // your own request to your route
let meeting = try await rt.joinGroupCall(token)
CallScreen.shared.show(meeting, title: "Daily meeting")import cloud.wordplus.realtime.calls.joinGroupCall
import cloud.wordplus.realtime.ui.CallScreen
val token = api.meetingToken(id = 7) // your own request to your route
val meeting = rt.joinGroupCall(context, token)
CallScreen.show(context, meeting, title = "Daily meeting")import {
CallScreen, GroupCallButton, RealtimeProvider,
} from '@wordplus/realtime-react-native';
// Your server, in full, as an app has no address of its own.
const API = 'https://app.example.com/api';
const options = {
app: 's1500000007',
endpoint: API + '/realtime',
headers: { Authorization: 'Bearer ' + session.token },
};
export function App() {
return (
<RealtimeProvider options={ options }>
<CallScreen />
<GroupCallButton call="meeting:7" type="video" title="Daily meeting"
tokenUrl={ API + '/meeting-token?id=7' }>
Join the meeting
</GroupCallButton>
</RealtimeProvider>
);
}import 'package:flutter/material.dart';
import 'package:wordplus_realtime/wordplus_realtime.dart';
// Your server, in full, as an app has no address of its own.
const api = 'https://app.example.com/api';
// Once, as your app starts.
final rt = await WordPlusRealtime.connect(
app: 's1500000007',
endpoint: '$api/realtime',
headers: {'Authorization': 'Bearer ${session.token}'},
);
// The call window.
await rt.callScreen();
// In your build:
GroupCallButton(
rt: rt,
call: 'meeting:7',
tokenUrl: '$api/meeting-token?id=7',
title: 'Daily meeting',
child: const Text('Join the meeting'),
)Probeer een groepsgesprek
Start hier een ruimte en haal tot drie anderen erbij via hun telefoon of andere vensters. Geen account nodig.
Dit zijn de schermen die de SDK je app geeft. Je browser vraagt om je camera en microfoon, er wordt niets opgenomen en de demo stopt na 10 minuten.
Groepsgesprekken
Groepsgesprekken op onze mediaservers
Vergaderingen, lessen, panels en audioruimtes draaien op onze mediaservers, niet tussen de apparaten, dus elk apparaat stuurt zijn camera één keer, hoeveel mensen er ook in het gesprek zitten.

Geen limiet op mensen
Iedereen in een groepsgesprek stuurt camera, microfoon en scherm één keer, en onze mediaservers geven ze door aan alle anderen, in meerdere regio’s.
Sprekers en luisteraars
Je server bepaalt wie uitzendt en wie alleen kijkt en luistert, zoals in een les of een panel. Een host laat een luisteraar spreken en maakt hem daarna weer luisteraar.
Hosts houden de orde
Een host zet een microfoon uit, laat iemand spreken en haalt iemand uit het gesprek, vanaf de tegel van elke persoon.
Je server beslist
Een vergadering leiden, van begin tot eind
Je server bepaalt wie meedoet en wie host is, en de pagina of je server doet de rest. Hier is een teamvergadering en daarna een les, taak voor taak.
Next.js op de server en React op de pagina.
De pagina een token geven
Een groepsgesprek is alleen een naam, zoals meeting:7, zonder iets aan te maken in de cloud. Wie meedoet en wie host is, is de eigen logica van je app, dus dat staat in een eigen route, die antwoordt met een token. isMemberOf en isLeadOf zijn je eigen controles.
export async function GET( request: Request ) {
const me = await currentUserId();
const id = new URL( request.url ).searchParams.get( 'id' )!;
// Your own check: only its team, and its lead is the host.
if ( ! me || ! await isMemberOf( id, me ) ) {
return new Response( null, { status: 403 } );
}
const token = await realtime.groupCallToken( me, 'meeting:' + id, {
admin: await isLeadOf( id, me ),
} );
return Response.json( { token } );
}app.get( '/api/meeting-token', async ( req, res ) => {
const me = userOf( req );
const { id } = req.query;
// Your own check: only its team, and its lead is the host.
if ( ! me || ! await isMemberOf( id, me ) ) {
return res.sendStatus( 403 );
}
const token = await realtime.groupCallToken( me, 'meeting:' + id, {
admin: await isLeadOf( id, me ),
} );
res.json( { token } );
} );import { createServer } from 'node:http';
createServer( async ( req, res ) => {
const url = new URL( req.url, 'http://localhost' );
if ( url.pathname === '/api/meeting-token' ) {
const me = userOf( req );
const id = url.searchParams.get( 'id' );
// Your own check: only its team, and its lead is the host.
if ( ! me || ! await isMemberOf( id, me ) ) {
res.writeHead( 403 );
return res.end();
}
const token = await realtime.groupCallToken( me, 'meeting:' + id, {
admin: await isLeadOf( id, me ),
} );
res.writeHead( 200, { 'Content-Type': 'application/json' } );
return res.end( JSON.stringify( { token } ) );
}
// Your pages, and realtime.node( userOf ) for the SDK's routes.
} ).listen( 3000 );use Illuminate\Http\Request;
use WordPlus\Realtime\Laravel\Facades\Realtime;
Route::get( '/api/meeting-token', function ( Request $request ) {
$me = $request->user()->id;
$id = $request->query( 'id' );
// Your own check: only its team, and its lead is the host.
abort_unless( is_member_of( $id, $me ), 403 );
return [ 'token' => Realtime::groupCallToken( $me, 'meeting:' . $id, [
'admin' => is_lead_of( $id, $me ),
] ) ];
} )->middleware( 'auth' );require __DIR__ . '/../src/realtime.php';
$me = current_user_id();
$id = $_GET['id'] ?? '';
// Your own check: only its team, and its lead is the host.
if ( ! $me || ! is_member_of( $id, $me ) ) {
http_response_code( 403 );
exit;
}
header( 'Content-Type: application/json' );
echo json_encode( [
'token' => $realtime->groupCallToken( $me, 'meeting:' . $id, [
'admin' => is_lead_of( $id, $me ),
] ),
] );from django.contrib.auth.decorators import login_required
from django.http import HttpResponseForbidden, JsonResponse
from .realtime import realtime
# In urls.py: path("api/meeting-token", views.meeting_token)
@login_required
def meeting_token(request):
me = request.user.id
id = request.GET["id"]
# Your own check: only its team, and its lead is the host.
if not is_member_of(id, me):
return HttpResponseForbidden()
token = realtime.group_call_token(
me, "meeting:" + id, admin=is_lead_of(id, me)
)
return JsonResponse({"token": token})from fastapi import Depends, HTTPException
from realtime import realtime
@app.get("/api/meeting-token")
def meeting_token(id: str, me: int = Depends(current_user_id)):
# Your own check: only its team, and its lead is the host.
if not me or not is_member_of(id, me):
raise HTTPException(403)
token = realtime.group_call_token(
me, "meeting:" + id, admin=is_lead_of(id, me)
)
return {"token": token}from flask import abort, request, session
from realtime import realtime
@app.get("/api/meeting-token")
def meeting_token():
me = session.get("user_id")
id = request.args["id"]
# Your own check: only its team, and its lead is the host.
if not me or not is_member_of(id, me):
abort(403)
token = realtime.group_call_token(
me, "meeting:" + id, admin=is_lead_of(id, me)
)
return {"token": token}// http.HandleFunc("GET /api/meeting-token", meetingToken)
func meetingToken(w http.ResponseWriter, r *http.Request) {
me := userOf(r)
id := r.URL.Query().Get("id")
// Your own check: only its team, and its lead is the host.
if me == "" || !isMemberOf(id, me) {
w.WriteHeader(403)
return
}
token := app.GroupCallToken(me, "meeting:"+id, wordplus.GroupPlace{
Admin: isLeadOf(id, me),
Info: profile(me),
})
reply(w, map[string]string{"token": token})
}Een knop om mee te doen toevoegen
Het kant-en-klare scherm: een knop en een gespreksvenster met elke tegel en bediening, zonder gesprekscode. De knop vraagt je route om zijn token.
Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button>import { connect } from '@wordplus/realtime';
const rt = await connect();
// The call window, on every page a meeting may open from.
await rt.callScreen();
// And in the page. The button asks your route for its token.
// <group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
// Join the meeting
// </group-call-button><group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
Join the meeting
</group-call-button>
<script type="module">
// The call window, on every page a meeting may open from.
await window.Echo.connector.rt.callScreen();
</script>'use client'; // in Next.js
import { CallScreen, GroupCallButton } from '@wordplus/realtime/react';
// Inside <RealtimeProvider>, once for the whole app.
export function JoinMeeting() {
return (
<>
<CallScreen />
<GroupCallButton call="meeting:7" tokenUrl="/api/meeting-token?id=7" type="video" title="Daily meeting">
Join the meeting
</GroupCallButton>
</>
);
}<script setup>
import { watchEffect } from 'vue';
import { useRealtime } from '@wordplus/realtime/vue';
// provideRealtime() once, in your root component.
const rt = useRealtime();
// The call window, on every page a meeting may open from.
watchEffect( () => rt.value?.callScreen() );
</script>
<!-- isCustomElement for this tag, in vite.config.js -->
<template>
<group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
Join the meeting
</group-call-button>
</template><script>
import { useRealtime } from '@wordplus/realtime/svelte';
// provideRealtime() once, in your root component.
const rt = useRealtime();
// The call window, on every page a meeting may open from.
$effect( () => { rt.current?.callScreen(); } );
</script>
<group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">
Join the meeting
</group-call-button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-join-meeting',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<group-call-button call="meeting:7" token-url="/api/meeting-token?id=7" type="video" title="Daily meeting">Join the meeting</group-call-button>`,
} )
export class JoinMeetingComponent {
async ngOnInit() {
const rt = await realtime;
// The call window, on every page a meeting may open from.
await rt.callScreen();
}
}import WordPlusRealtimeCalls
import WordPlusRealtimeUI
let token = try await api.meetingToken(id: 7) // your own request to your route
let meeting = try await rt.joinGroupCall(token)
CallScreen.shared.show(meeting, title: "Daily meeting")import cloud.wordplus.realtime.calls.joinGroupCall
import cloud.wordplus.realtime.ui.CallScreen
val token = api.meetingToken(id = 7) // your own request to your route
val meeting = rt.joinGroupCall(context, token)
CallScreen.show(context, meeting, title = "Daily meeting")import {
CallScreen, GroupCallButton, RealtimeProvider,
} from '@wordplus/realtime-react-native';
// Your server, in full, as an app has no address of its own.
const API = 'https://app.example.com/api';
const options = {
app: 's1500000007',
endpoint: API + '/realtime',
headers: { Authorization: 'Bearer ' + session.token },
};
export function App() {
return (
<RealtimeProvider options={ options }>
<CallScreen />
<GroupCallButton call="meeting:7" type="video" title="Daily meeting"
tokenUrl={ API + '/meeting-token?id=7' }>
Join the meeting
</GroupCallButton>
</RealtimeProvider>
);
}import 'package:flutter/material.dart';
import 'package:wordplus_realtime/wordplus_realtime.dart';
// Your server, in full, as an app has no address of its own.
const api = 'https://app.example.com/api';
// Once, as your app starts.
final rt = await WordPlusRealtime.connect(
app: 's1500000007',
endpoint: '$api/realtime',
headers: {'Authorization': 'Bearer ${session.token}'},
);
// The call window.
await rt.callScreen();
// In your build:
GroupCallButton(
rt: rt,
call: 'meeting:7',
tokenUrl: '$api/meeting-token?id=7',
title: 'Daily meeting',
child: const Text('Join the meeting'),
)In je pagina zetten
Hetzelfde scherm op een eigen plek, in plaats van een venster boven de pagina, en als je wilt doet het mee zodra de pagina opent.
Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { connect } from '@wordplus/realtime';
const rt = await connect();
await rt.callScreen();
// And in the page. The meeting opens here, with no window over it,
// joining as the page opens, the camera and microphone on:
// <call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot><call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>
<script type="module">
await window.Echo.connector.rt.callScreen();
</script>'use client'; // in Next.js
import { CallScreen, CallSpot } from '@wordplus/realtime/react';
// Inside <RealtimeProvider>, once for the whole app.
export function Meeting() {
return (
<>
<CallScreen />
<CallSpot call="meeting:7" tokenUrl="/api/meeting-token?id=7" join="video" joinWith="microphone camera" />
</>
);
}<script setup>
import { watchEffect } from 'vue';
import { useRealtime } from '@wordplus/realtime/vue';
// provideRealtime() once, in your root component.
const rt = useRealtime();
watchEffect( () => rt.value?.callScreen() );
</script>
<!-- isCustomElement for this tag, in vite.config.js -->
<template>
<call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>
</template><script>
import { useRealtime } from '@wordplus/realtime/svelte';
// provideRealtime() once, in your root component.
const rt = useRealtime();
$effect( () => { rt.current?.callScreen(); } );
</script>
<call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-meeting',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<call-spot call="meeting:7" token-url="/api/meeting-token?id=7" join="video" join-with="microphone camera"></call-spot>`,
} )
export class MeetingComponent {
async ngOnInit() {
const rt = await realtime;
await rt.callScreen();
}
}Meedoen vanuit je eigen code
Voor een scherm dat je zelf tekent: haal een token op bij je route en neem daarmee deel. Elke persoon komt met zijn camera en microfoon, en er wordt niets verstuurd totdat je erom vraagt.
Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();const rt = window.Echo.connector.rt; // the connection Echo made
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();'use client'; // in Next.js
import { AudioTrack, useGroupCall, VideoTrack } from '@wordplus/realtime/react';
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
// Inside <RealtimeProvider>, once for the whole app.
export function Meeting() {
const { people, camera, setCamera, setMicrophone } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
return (
<>
{ people.map( ( person ) => (
<div key={ person.user }>
<VideoTrack track={ person.camera } />
<AudioTrack track={ person.microphone } />
</div>
) ) }
<VideoTrack track={ camera } />
<button onClick={ () => setCamera( ! camera ) }>Camera</button>
<button onClick={ () => setMicrophone( true ) }>Microphone</button>
</>
);
}<script setup>
import { AudioTrack, useGroupCall, VideoTrack } from '@wordplus/realtime/vue';
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
// provideRealtime() once, in your root component.
const { people, camera, setCamera, setMicrophone } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
</script>
<template>
<div v-for="person in people" :key="person.user">
<VideoTrack :track="person.camera" />
<AudioTrack :track="person.microphone" />
</div>
<VideoTrack :track="camera" />
<button @click="setCamera( ! camera )">Camera</button>
<button @click="setMicrophone( true )">Microphone</button>
</template><script>
import { track, useGroupCall } from '@wordplus/realtime/svelte';
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
// provideRealtime() once, in your root component.
const meeting = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
</script>
{#each meeting.people as person (person.user)}
<video use:track={ person.camera } muted autoplay playsinline></video>
<audio use:track={ person.microphone } autoplay></audio>
{/each}
<video use:track={ meeting.camera } muted autoplay playsinline></video>
<button onclick={ () => meeting.setCamera( ! meeting.camera ) }>Camera</button>
<button onclick={ () => meeting.setMicrophone( true ) }>Microphone</button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-meeting',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your tiles here -->`,
} )
export class MeetingComponent {
async ngOnInit() {
const rt = await realtime;
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// tileFor() and removeTile() are your own: a <video> for each person.
group.on( 'person', ( person ) => person.camera?.attach( tileFor( person.user ) ) );
group.on( 'person_left', ( person ) => removeTile( person.user ) );
await group.setMicrophone( true );
await group.setCamera( true );
leave.onclick = () => group.leave();
}
}let token = try await api.meetingToken(id: 7) // your own request to your route
let group = try await rt.joinGroupCall(token)
group.setMicrophone(true) // nothing is sent until asked
group.setCamera(true)
// tile(for:) is your own: a GroupVideoView for each person.
group.onPeople {
for person in group.people { tile(for: person).show(person.identity, of: group) }
}
leave.addAction(UIAction { _ in group.leave() }, for: .touchUpInside)val token = api.meetingToken(id = 7) // your own request to your route
val group = rt.joinGroupCall(context, token)
group.setMicrophone(true) // nothing is sent until asked
group.setCamera(true)
// tileFor() is your own: a GroupVideoView for each person.
group.onPeople {
for (person in group.people) tileFor(person).show(person.identity, group)
}
leave.setOnClickListener { group.leave() }import { Button, Text, View } from 'react-native';
import { GroupVideo, useGroupCall, useRealtime } from '@wordplus/realtime-react-native';
const API = 'https://app.example.com/api'; // your server, in full
// Inside <RealtimeProvider>, once for the whole app.
export function Meeting() {
const rt = useRealtime();
// Asks your route from the first step, once connected.
const { group, state, error } = useGroupCall( 'meeting:7', () => rt.tokenFrom( API + '/meeting-token', { id: 7 } ) );
if ( ! state ) return <Text>{ error ?? 'Joining…' }</Text>;
return (
<View>
{ state.people.map( ( person ) => (
<GroupVideo key={ person.identity } group={ group } person={ person.identity } style={ { aspectRatio: 16 / 9 } } />
) ) }
<GroupVideo group={ group } source="own" mirrored style={ { height: 120 } } />
<Button title="Camera" onPress={ () => group.setCamera( ! state.camera ) } />
<Button title="Microphone" onPress={ () => group.setMicrophone( ! state.microphone ) } />
</View>
);
}final token = await rt.tokenFrom('$api/meeting-token', {'id': 7});
final group = await rt.joinGroupCall(token);
await group.setMicrophone(true); // nothing is sent until asked
await group.setCamera(true);
// In your build:
ListenableBuilder(
listenable: group, // someone arrives or leaves, or what they send changes
builder: (context, _) => GridView.count(crossAxisCount: 2, children: [
for (final person in group.people)
GroupVideo(key: ValueKey(person.identity), group: group, person: person.identity),
GroupVideo(group: group, source: GroupVideoSource.own, mirrored: true),
]),
)Camera, microfoon en scherm
Dezelfde opdrachten in een gesprek, een groepsgesprek en een livestream, dus je scherm hoeft geen apparaat bij te houden. Een camera stopt, en het lampje gaat uit, wanneer hij wordt uitgezet of het gesprek eindigt.
Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );import { connect } from '@wordplus/realtime';
const rt = await connect();
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );const rt = window.Echo.connector.rt; // the connection Echo made
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );// In the component that holds the meeting, on the same useGroupCall().
const { camera, microphone, screen, setCamera, setMicrophone, setScreenShare } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
return (
<>
<button onClick={ () => setMicrophone( ! microphone ) }>Microphone</button>
<button onClick={ () => setCamera( ! camera ) }>Camera</button>
<button onClick={ () => setScreenShare( ! screen ) }>Share screen</button>
</>
);<script setup>
// In the component that holds the meeting, on the same useGroupCall().
const { camera, microphone, screen, setCamera, setMicrophone, setScreenShare } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
</script>
<template>
<button @click="setMicrophone( ! microphone )">Microphone</button>
<button @click="setCamera( ! camera )">Camera</button>
<button @click="setScreenShare( ! screen )">Share screen</button>
</template><!-- In the component that holds the meeting, on the same useGroupCall(). -->
<button onclick={ () => meeting.setMicrophone( ! meeting.microphone ) }>Microphone</button>
<button onclick={ () => meeting.setCamera( ! meeting.camera ) }>Camera</button>
<button onclick={ () => meeting.setScreenShare( ! meeting.screen ) }>Share screen</button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-controls',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your buttons here -->`,
} )
export class ControlsComponent {
async ngOnInit() {
const rt = await realtime;
await group.setMicrophone( false ); // muted
await group.setCamera( false ); // stopped, and the light goes off
const shared = await group.setScreenShare( true ); // false if they picked nothing
// Move to another camera with no gap for the others.
const { cameras } = await group.devices();
await group.setCamera( true, { deviceId: cameras[ 1 ].id } );
}
}group.setMicrophone(false) // muted
group.setCamera(false) // stops sending the camera
group.flipCamera() // the front one to the back, and back
// Puts up the system's picker, in an app built with the broadcast extension.
await group.setScreenShare(true)group.setMicrophone(false) // muted
group.setCamera(false) // stops sending the camera
group.flipCamera() // the front one to the back, and back
// answer is what the system's dialog gave: ScreenShare.permissionIntent(activity).
group.setScreenShare(true, answer.data)// In the component that holds the meeting, on the same useGroupCall().
const { group, state } = useGroupCall( 'meeting:7', () => rt.tokenFrom( API + '/meeting-token', { id: 7 } ) );
// Sharing the phone's screen isn't in React Native yet.
return (
<>
<Button title="Microphone" onPress={ () => group?.setMicrophone( ! state.microphone ) } />
<Button title="Camera" onPress={ () => group?.setCamera( ! state.camera ) } />
<Button title="Flip camera" onPress={ () => group?.flipCamera() } />
</>
);await group.setMicrophone(false); // muted
await group.setCamera(false); // stops sending the camera
await group.flipCamera(); // the front one to the back, and back
// Android asks with the system's dialog, iOS needs the broadcast extension.
final shared = await group.setScreenShare(true); // false if they said noSprekers en luisteraars
Een les, een panel of een audioruimte: een paar mensen spreken en de rest luistert. Je route maakt de luisteraars, en je server laat er tijdens het gesprek één spreken en bewaart die keuze waar de route haar leest voor wie later meedoet.
// Your route, as in the first step, for /api/class-token?id=7.
const teacher = await isTeacherOf( id, me );
if ( ! teacher && ! await isStudentOf( id, me ) ) return refuse();
const token = await realtime.groupCallToken( me, 'class:' + id, {
type: 'audio',
admin: teacher,
publish: teacher || await maySpeak( id, me ), // a student listens until let speak
} );// The teacher's Let speak button, in a route that checks it is the teacher.
await setMaySpeak( 7, 34, true ); // where your route reads it
await realtime.call( 'class:7' ).letSpeak( 34 ); // and at once in the call// Your route, as in the first step, for /api/class-token?id=7.
const teacher = await isTeacherOf( id, me );
if ( ! teacher && ! await isStudentOf( id, me ) ) return refuse();
const token = await realtime.groupCallToken( me, 'class:' + id, {
type: 'audio',
admin: teacher,
publish: teacher || await maySpeak( id, me ), // a student listens until let speak
} );
// The teacher's Let speak button, in a route that checks it is the teacher.
await setMaySpeak( 7, 34, true ); // where your route reads it
await realtime.call( 'class:7' ).letSpeak( 34 ); // and at once in the call// Your route, as in the first step, for /api/class-token?id=7.
const teacher = await isTeacherOf( id, me );
if ( ! teacher && ! await isStudentOf( id, me ) ) return refuse();
const token = await realtime.groupCallToken( me, 'class:' + id, {
type: 'audio',
admin: teacher,
publish: teacher || await maySpeak( id, me ), // a student listens until let speak
} );
// The teacher's Let speak button, in a route that checks it is the teacher.
await setMaySpeak( 7, 34, true ); // where your route reads it
await realtime.call( 'class:7' ).letSpeak( 34 ); // and at once in the call// Your route, as in the first step, for /api/class-token?id=7.
$teacher = is_teacher_of( $id, $me );
abort_unless( $teacher || is_student_of( $id, $me ), 403 );
$token = Realtime::groupCallToken( $me, 'class:' . $id, [
'type' => 'audio',
'admin' => $teacher,
'publish' => $teacher || may_speak( $id, $me ), // a student listens until let speak
] );// The teacher's Let speak button, in a route that checks it is the teacher.
set_may_speak( 7, 34, true ); // where your route reads it
Realtime::call( 'class:7' )->letSpeak( 34 ); // and at once in the call// Your route, as in the first step, for /class-token.php?id=7.
$teacher = is_teacher_of( $id, $me );
if ( ! $teacher && ! is_student_of( $id, $me ) ) {
http_response_code( 403 );
exit;
}
$token = $realtime->groupCallToken( $me, 'class:' . $id, [
'type' => 'audio',
'admin' => $teacher,
'publish' => $teacher || may_speak( $id, $me ), // a student listens until let speak
] );// The teacher's Let speak button, in a route that checks it is the teacher.
set_may_speak( 7, 34, true ); // where your route reads it
$realtime->call( 'class:7' )->letSpeak( 34 ); // and at once in the call# Your route, as in the first step, for /api/class-token?id=7.
teacher = is_teacher_of(id, me)
if not teacher and not is_student_of(id, me):
return refuse()
token = realtime.group_call_token(
me,
"class:" + id,
type="audio",
admin=teacher,
publish=teacher or may_speak(id, me), # a student listens until let speak
)
# The teacher's Let speak button, in a route that checks it is the teacher.
set_may_speak(7, 34, True) # where your route reads it
realtime.call("class:7").let_speak(34) # and at once in the call# Your route, as in the first step, for /api/class-token?id=7.
teacher = is_teacher_of(id, me)
if not teacher and not is_student_of(id, me):
return refuse()
token = realtime.group_call_token(
me,
"class:" + id,
type="audio",
admin=teacher,
publish=teacher or may_speak(id, me), # a student listens until let speak
)
# In a def route, as these calls block.
# The teacher's Let speak button, in a route that checks it is the teacher.
set_may_speak(7, 34, True) # where your route reads it
realtime.call("class:7").let_speak(34) # and at once in the call# Your route, as in the first step, for /api/class-token?id=7.
teacher = is_teacher_of(id, me)
if not teacher and not is_student_of(id, me):
return refuse()
token = realtime.group_call_token(
me,
"class:" + id,
type="audio",
admin=teacher,
publish=teacher or may_speak(id, me), # a student listens until let speak
)
# The teacher's Let speak button, in a route that checks it is the teacher.
set_may_speak(7, 34, True) # where your route reads it
realtime.call("class:7").let_speak(34) # and at once in the call// Your route, as in the first step, for /api/class-token?id=7.
teacher := isTeacherOf(id, me)
if !teacher && !isStudentOf(id, me) {
w.WriteHeader(403)
return
}
token := app.GroupCallToken(me, "class:"+id, wordplus.GroupPlace{
Kind: "audio",
Admin: teacher,
Listener: !teacher && !maySpeak(id, me), // a student listens until let speak
Info: profile(me),
})# The teacher's Let speak button, in a route that checks it is the teacher.
wordplus POST '/wordplus/realtime/calls/class%3A7/permit' '{"user":"34","publish":true}'Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );import { connect } from '@wordplus/realtime';
const rt = await connect();
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );const rt = window.Echo.connector.rt; // the connection Echo made
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );'use client'; // in Next.js
import { useEffect } from 'react';
import { useGroupCall } from '@wordplus/realtime/react';
// Asks your server for a token: your route for the class.
const classToken = async () => ( await ( await fetch( '/api/class-token?id=7' ) ).json() ).token;
// Inside <RealtimeProvider>, once for the whole app.
export function ClassRoom() {
const { group, people } = useGroupCall( 'class:7', classToken );
// Let on, it speaks. Back to listening, the microphone closes by itself.
useEffect( () => {
const speak = ( { publish } ) => publish && group?.setMicrophone( true );
group?.on( 'permissions', speak );
return () => { group?.off( 'permissions', speak ); };
}, [ group ] );
return <People speakers={ people.filter( ( person ) => person.publish ) } />;
}<script setup>
import { computed, watch } from 'vue';
import { useGroupCall } from '@wordplus/realtime/vue';
// Asks your server for a token: your route for the class.
const classToken = async () => ( await ( await fetch( '/api/class-token?id=7' ) ).json() ).token;
// provideRealtime() once, in your root component.
const { group, people } = useGroupCall( 'class:7', classToken );
// Let on, it speaks. Back to listening, the microphone closes by itself.
watch( group, ( now ) => {
now?.on( 'permissions', ( { publish } ) => publish && now.setMicrophone( true ) );
} );
const speakers = computed( () => people.value.filter( ( person ) => person.publish ) );
</script>
<template>
<People :speakers="speakers" />
</template><script>
import { useGroupCall } from '@wordplus/realtime/svelte';
// Asks your server for a token: your route for the class.
const classToken = async () => ( await ( await fetch( '/api/class-token?id=7' ) ).json() ).token;
// provideRealtime() once, in your root component.
const room = useGroupCall( 'class:7', classToken );
// Let on, it speaks. Back to listening, the microphone closes by itself.
$effect( () => {
room.group?.on( 'permissions', ( { publish } ) => publish && room.group.setMicrophone( true ) );
} );
</script>
<People speakers={ room.people.filter( ( person ) => person.publish ) } />import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-class-room',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your list here -->`,
} )
export class ClassRoomComponent {
async ngOnInit() {
const rt = await realtime;
const answer = await fetch( '/api/class-token?id=7' );
const group = await rt.joinGroupCall( ( await answer.json() ).token );
// Let on, it speaks. Back to listening, the microphone closes by itself.
group.on( 'permissions', ( { publish } ) => {
if ( publish ) group.setMicrophone( true );
} );
// Everyone sees who may speak.
group.on( 'person', ( person ) => place( person, person.publish ? speakers : listeners ) );
}
}let token = try await api.classToken(id: 7) // your own request to your route
let group = try await rt.joinGroupCall(token)
// Let on, it speaks. Back to listening, the media server took it down already.
group.onPermissions { can in
group.microphone = can.publish
}
let speakers = group.people.filter(\.publish)val token = api.classToken(id = 7) // your own request to your route
val group = rt.joinGroupCall(context, token)
// Let on, it speaks. Back to listening, the media server took it down already.
group.onPermissions { can ->
group.microphone = can.publish
}
val speakers = group.people.filter { it.publish }import { useEffect, useRef } from 'react';
import { useGroupCall, useRealtime } from '@wordplus/realtime-react-native';
const API = 'https://app.example.com/api'; // your server, in full
// Inside <RealtimeProvider>, once for the whole app.
export function ClassRoom() {
const rt = useRealtime();
const { group, state } = useGroupCall( 'class:7', () => rt.tokenFrom( API + '/class-token', { id: 7 } ) );
const letOn = state?.self?.publish;
const before = useRef( letOn );
// Let on, it speaks. Back to listening, the microphone closes by itself.
useEffect( () => {
if ( letOn && before.current === false ) group.setMicrophone( true );
before.current = letOn;
}, [ group, letOn ] );
return <People speakers={ state?.people.filter( ( person ) => person.publish ) } />;
}final token = await rt.tokenFrom('$api/class-token', {'id': 7});
final group = await rt.joinGroupCall(token);
// Let on, it speaks. Back to listening, the media server took it down already.
group.onPermissions((can) {
if (can.publish) group.setMicrophone(true);
});
final speakers = group.people.where((person) => person.publish);Mensen dempen en verwijderen
De host doet het vanaf de pagina, zoals zijn token dat toestaat. Het belscherm heeft dit op elke tegel.
Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}import { connect } from '@wordplus/realtime';
const rt = await connect();
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}const rt = window.Echo.connector.rt; // the connection Echo made
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}// In the component that holds the meeting, on the same useGroupCall().
const { group } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
// For the one your token made the host. Anyone else is refused forbidden.
if ( group?.can.admin ) {
return (
<>
<button onClick={ () => group.mute( 34 ) }>Mute</button>
<button onClick={ () => group.makeListener( 34 ) }>Make a listener</button>
<button onClick={ () => group.remove( 34 ) }>Remove</button>
</>
);
}<script setup>
// In the component that holds the meeting, on the same useGroupCall().
const { group } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
</script>
<template>
<!-- For the one your token made the host. Anyone else is refused forbidden. -->
<template v-if="group?.can.admin">
<button @click="group.mute( 34 )">Mute</button>
<button @click="group.makeListener( 34 )">Make a listener</button>
<button @click="group.remove( 34 )">Remove</button>
</template>
</template><!-- In the component that holds the meeting, on the same useGroupCall(). -->
<!-- For the one your token made the host. Anyone else is refused forbidden. -->
{#if meeting.group?.can.admin}
<button onclick={ () => meeting.group.mute( 34 ) }>Mute</button>
<button onclick={ () => meeting.group.makeListener( 34 ) }>Make a listener</button>
<button onclick={ () => meeting.group.remove( 34 ) }>Remove</button>
{/if}import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-host',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your buttons here -->`,
} )
export class HostComponent {
async ngOnInit() {
const rt = await realtime;
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// For the one your token made the host. Anyone else is refused forbidden.
if ( group.can.admin ) {
await group.mute( 34 ); // their microphone off, which they may turn on again
await group.makeListener( 34 ); // sends nothing, until let speak
await group.letSpeak( 34 );
await group.remove( 34 ); // out of the call
}
}
}// For the one your token made the host. Anyone else is refused forbidden.
if group.can.admin {
try await group.mute("34") // their microphone off, which they may turn on again
try await group.makeListener("34") // sends nothing, until let speak
try await group.letSpeak("34")
try await group.remove("34") // out of the call
}// For the one your token made the host. Anyone else is refused forbidden.
if (group.can.admin) {
group.mute("34") // their microphone off, which they may turn on again
group.makeListener("34") // sends nothing, until let speak
group.letSpeak("34")
group.remove("34") // out of the call
}// In the component that holds the meeting, on the same useGroupCall().
const { group, state } = useGroupCall( 'meeting:7', () => rt.tokenFrom( API + '/meeting-token', { id: 7 } ) );
// For the one your token made the host. Anyone else is refused forbidden.
if ( state?.can.admin ) {
return (
<>
<Button title="Mute" onPress={ () => group.mute( '34' ) } />
<Button title="Make a listener" onPress={ () => group.makeListener( '34' ) } />
<Button title="Let speak" onPress={ () => group.letSpeak( '34' ) } />
<Button title="Remove" onPress={ () => group.remove( '34' ) } />
</>
);
}// For the one your token made the host. Anyone else is refused forbidden.
if (group.can.admin) {
await group.mute('34'); // their microphone off, which they may turn on again
await group.makeListener('34'); // sends nothing, until let speak
await group.letSpeak('34');
await group.remove('34'); // out of the call
}Iemand in de spotlight zetten
Zet iemand op de hoofdtegels voor iedereen, tot vier personen, ook de host.
Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneimport { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneimport { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneimport { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneimport { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneimport { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneimport { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneimport { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneimport { connect } from '@wordplus/realtime';
const rt = await connect();
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyoneconst rt = window.Echo.connector.rt; // the connection Echo made
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyone// In the component that holds the meeting, on the same useGroupCall().
const { group } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
// On the main tiles for everyone, up to four people. group.spotlit names them.
return (
<>
<button onClick={ () => group?.spotlightOn( 34 ) }>Spotlight</button>
<button onClick={ () => group?.spotlightOff( 34 ) }>Remove spotlight</button>
</>
);<script setup>
// In the component that holds the meeting, on the same useGroupCall().
const { group } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
</script>
<template>
<!-- On the main tiles for everyone, up to four people. group.spotlit names them. -->
<button @click="group?.spotlightOn( 34 )">Spotlight</button>
<button @click="group?.spotlightOff( 34 )">Remove spotlight</button>
</template><!-- In the component that holds the meeting, on the same useGroupCall(). -->
<!-- On the main tiles for everyone, up to four people. group.spotlit names them. -->
<button onclick={ () => meeting.group?.spotlightOn( 34 ) }>Spotlight</button>
<button onclick={ () => meeting.group?.spotlightOff( 34 ) }>Remove spotlight</button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-spotlight',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your buttons here -->`,
} )
export class SpotlightComponent {
async ngOnInit() {
const rt = await realtime;
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
// On the main tiles for everyone, up to four people.
await group.spotlightOn( 34 );
group.on( 'spotlit', ( users ) => redraw( users ) );
await group.spotlightOff( 34 ); // or spotlightOff() for everyone
}
}// On the main tiles for everyone, up to four people.
try await group.spotlightOn("34")
group.onSpotlit { users in redraw(users) }
try await group.spotlightOff("34") // or spotlightOff() for everyone// On the main tiles for everyone, up to four people.
group.spotlightOn("34")
group.onSpotlit { users -> redraw(users) }
group.spotlightOff("34") // or spotlightOff() for everyone// In the component that holds the meeting, on the same useGroupCall().
const { group, state } = useGroupCall( 'meeting:7', () => rt.tokenFrom( API + '/meeting-token', { id: 7 } ) );
// On the main tiles for everyone, up to four people. state.spotlit names them.
return (
<>
<Button title="Spotlight" onPress={ () => group?.spotlightOn( '34' ) } />
<Button title="Remove spotlight" onPress={ () => group?.spotlightOff( '34' ) } />
</>
);// On the main tiles for everyone, up to four people.
await group.spotlightOn('34');
group.onSpotlit((users) => redraw(users));
await group.spotlightOff('34'); // or spotlightOff() for everyoneBeheren vanaf je server
Zie wie er in een gesprek zit en demp, maak luisteraar of verwijder wie je wilt, zonder open pagina. Wie is verwijderd, blijft buiten totdat je server een nieuw token voor hem ondertekent.
// No page needs to be open. Check who asks, in your own route.
const call = realtime.call( 'meeting:7' );
await call.get(); // { people, started_at, list: [ { user, camera, microphone, screen } ] }
await call.mute( 34 ); // or mute( 34, 'camera' ), mute( 34, 'screen' )
await call.makeListener( 34 ); // sends nothing, until letSpeak( 34 )
await call.remove( 34 ); // out now
await realtime.listCalls(); // every group call going on: [ { name, people, started_at } ]// No page needs to be open. Check who asks, in your own route.
const call = realtime.call( 'meeting:7' );
await call.get(); // { people, started_at, list: [ { user, camera, microphone, screen } ] }
await call.mute( 34 ); // or mute( 34, 'camera' ), mute( 34, 'screen' )
await call.makeListener( 34 ); // sends nothing, until letSpeak( 34 )
await call.remove( 34 ); // out now
await realtime.listCalls(); // every group call going on: [ { name, people, started_at } ]// No page needs to be open. Check who asks, in your own route.
const call = realtime.call( 'meeting:7' );
await call.get(); // { people, started_at, list: [ { user, camera, microphone, screen } ] }
await call.mute( 34 ); // or mute( 34, 'camera' ), mute( 34, 'screen' )
await call.makeListener( 34 ); // sends nothing, until letSpeak( 34 )
await call.remove( 34 ); // out now
await realtime.listCalls(); // every group call going on: [ { name, people, started_at } ]// No page needs to be open. Check who asks, in your own route.
$call = Realtime::call( 'meeting:7' );
$call->get(); // [ 'people', 'started_at', 'list' => [ [ 'user', 'camera', 'microphone', 'screen' ] ] ]
$call->mute( 34 ); // or mute( 34, 'camera' ), mute( 34, 'screen' )
$call->makeListener( 34 ); // sends nothing, until letSpeak( 34 )
$call->remove( 34 ); // out now
Realtime::listCalls(); // every group call going on// No page needs to be open. Check who asks, in your own route.
$call = $realtime->call( 'meeting:7' );
$call->get(); // [ 'people', 'started_at', 'list' => [ [ 'user', 'camera', 'microphone', 'screen' ] ] ]
$call->mute( 34 ); // or mute( 34, 'camera' ), mute( 34, 'screen' )
$call->makeListener( 34 ); // sends nothing, until letSpeak( 34 )
$call->remove( 34 ); // out now
$realtime->listCalls(); // every group call going on# No page needs to be open. Check who asks, in your own route.
call = realtime.call("meeting:7")
call.get() # {"people", "started_at", "list": [{"user", "camera", "microphone", "screen"}]}
call.mute(34) # or mute(34, "camera"), mute(34, "screen")
call.make_listener(34) # sends nothing, until let_speak(34)
call.remove(34) # out now
realtime.list_calls() # every group call going on# In a def route, as these calls block.
# No page needs to be open. Check who asks, in your own route.
call = realtime.call("meeting:7")
call.get() # {"people", "started_at", "list": [{"user", "camera", "microphone", "screen"}]}
call.mute(34) # or mute(34, "camera"), mute(34, "screen")
call.make_listener(34) # sends nothing, until let_speak(34)
call.remove(34) # out now
realtime.list_calls() # every group call going on# No page needs to be open. Check who asks, in your own route.
call = realtime.call("meeting:7")
call.get() # {"people", "started_at", "list": [{"user", "camera", "microphone", "screen"}]}
call.mute(34) # or mute(34, "camera"), mute(34, "screen")
call.make_listener(34) # sends nothing, until let_speak(34)
call.remove(34) # out now
realtime.list_calls() # every group call going on# No page needs to be open. Check who asks, in your own route.
wordplus GET '/wordplus/realtime/calls/meeting%3A7'
wordplus POST '/wordplus/realtime/calls/meeting%3A7/mute' '{"user":"34","track":"microphone"}'
wordplus POST '/wordplus/realtime/calls/meeting%3A7/permit' '{"user":"34","publish":false}'
wordplus POST '/wordplus/realtime/calls/meeting%3A7/remove' '{"user":"34"}'
# Every group call going on.
wordplus GET '/wordplus/realtime/calls'Voor iedereen beëindigen
Haalt iedereen in één keer eruit. Gebruik de naam opnieuw, en er begint een nieuw gesprek.
// Everyone out, and the tokens signed before don't open it again.
await realtime.call( 'meeting:7' ).end();// Everyone out, and the tokens signed before don't open it again.
await realtime.call( 'meeting:7' ).end();// Everyone out, and the tokens signed before don't open it again.
await realtime.call( 'meeting:7' ).end();// Everyone out, and the tokens signed before don't open it again.
Realtime::call( 'meeting:7' )->end();// Everyone out, and the tokens signed before don't open it again.
$realtime->call( 'meeting:7' )->end();# Everyone out, and the tokens signed before don't open it again.
realtime.call("meeting:7").end()# In a def route, as these calls block.
# Everyone out, and the tokens signed before don't open it again.
realtime.call("meeting:7").end()# Everyone out, and the tokens signed before don't open it again.
realtime.call("meeting:7").end()# Everyone out, and the tokens signed before don't open it again.
wordplus POST '/wordplus/realtime/calls/meeting%3A7/end'End-to-end versleutelen
Eén woord in je token. Onze mediaservers geven dan frames door die ze niet kunnen lezen, en een browser die niet kan versleutelen wordt geweigerd in plaats van onversleuteld te versturen.
// In your route. Frames are encrypted in each browser, with a key your server makes.
const token = await realtime.groupCallToken( me, 'meeting:' + id, { encrypt: true } );// In your route. Frames are encrypted in each browser, with a key your server makes.
const token = await realtime.groupCallToken( me, 'meeting:' + id, { encrypt: true } );// In your route. Frames are encrypted in each browser, with a key your server makes.
const token = await realtime.groupCallToken( me, 'meeting:' + id, { encrypt: true } );// In your route. Frames are encrypted in each browser, with a key your server makes.
$token = Realtime::groupCallToken( $me, 'meeting:' . $id, [ 'encrypt' => true ] );// In your route. Frames are encrypted in each browser, with a key your server makes.
$token = $realtime->groupCallToken( $me, 'meeting:' . $id, [ 'encrypt' => true ] );# In your route. Frames are encrypted in each browser, with a key your server makes.
token = realtime.group_call_token(me, "meeting:" + id, encrypt=True)# In your route. Frames are encrypted in each browser, with a key your server makes.
token = realtime.group_call_token(me, "meeting:" + id, encrypt=True)# In your route. Frames are encrypted in each browser, with a key your server makes.
token = realtime.group_call_token(me, "meeting:" + id, encrypt=True)// In your route. Frames are encrypted in each browser, with a key your server makes.
token := app.GroupCallToken(me, "meeting:"+id, wordplus.GroupPlace{Encrypt: true, Info: profile(me)})Hooks en componenten voor elke React-app, op elk van de servers hierboven.
import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();import { connect } from '@wordplus/realtime';
const rt = await connect();
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();const rt = window.Echo.connector.rt; // the connection Echo made
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();// In the component that holds the meeting, on the same useGroupCall().
const { group } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
return group?.encrypted ? <Lock /> : null;<script setup>
// In the component that holds the meeting, on the same useGroupCall().
const { group } = useGroupCall( 'meeting:7', () => meetingToken( 7 ) );
</script>
<template>
<Lock v-if="group?.encrypted" />
</template><!-- In the component that holds the meeting, on the same useGroupCall(). -->
{#if meeting.group?.encrypted}
<Lock />
{/if}import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
// realtime.ts, one connection for the whole app:
// export const realtime = connect();
import { realtime } from './realtime';
@Component( {
selector: 'app-meeting',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
template: `<!-- Your lock here -->`,
} )
export class MeetingComponent {
async ngOnInit() {
const rt = await realtime;
// Asks your server for a token: your route from the first step.
async function meetingToken( id ) {
const answer = await fetch( '/api/meeting-token?id=' + id );
if ( ! answer.ok ) throw new Error( 'Your server said no' );
return ( await answer.json() ).token;
}
const group = await rt.joinGroupCall( await meetingToken( 7 ) );
if ( group.encrypted ) showLock();
}
}let token = try await api.meetingToken(id: 7) // your own request to your route
let group = try await rt.joinGroupCall(token)
if group.encrypted { showLock() }val token = api.meetingToken(id = 7) // your own request to your route
val group = rt.joinGroupCall(context, token)
if (group.encrypted) showLock()// In the component that holds the meeting, on the same useGroupCall().
const { state } = useGroupCall( 'meeting:7', () => rt.tokenFrom( API + '/meeting-token', { id: 7 } ) );
return state?.encrypted ? <Lock /> : null;final token = await rt.tokenFrom('$api/meeting-token', {'id': 7});
final group = await rt.joinGroupCall(token);
if (group.encrypted) showLock();Per minuut factureren
Je server weet hoe lang elke persoon in het gesprek zat, geteld op onze servers, zodat je je eigen gebruikers kunt factureren. De gebeurtenis kan twee keer komen, dus breng per id één keer kosten in rekening. charge is je eigen functie.
// Each person, for their own time in it, by the minute begun. Charge once for each id.
realtime.on( 'group.left', async ( { id, user, seconds } ) => {
if ( seconds ) await charge( id, user, Math.ceil( seconds / 60 ) );
} );// Each person, for their own time in it, by the minute begun. Charge once for each id.
realtime.on( 'group.left', async ( { id, user, seconds } ) => {
if ( seconds ) await charge( id, user, Math.ceil( seconds / 60 ) );
} );// Each person, for their own time in it, by the minute begun. Charge once for each id.
realtime.on( 'group.left', async ( { id, user, seconds } ) => {
if ( seconds ) await charge( id, user, Math.ceil( seconds / 60 ) );
} );$this->callAfterResolving( Realtime::class, function ( Realtime $realtime ) {
// Each person, for their own time in it, by the minute begun. Charge once for each id.
$realtime->on( 'group.left', function ( array $e ) {
if ( $e['seconds'] ) {
charge( $e['id'], $e['user'], (int) ceil( $e['seconds'] / 60 ) );
}
} );
} );// Each person, for their own time in it, by the minute begun. Charge once for each id.
$realtime->on( 'group.left', function ( array $e ) {
if ( $e['seconds'] ) {
charge( $e['id'], $e['user'], (int) ceil( $e['seconds'] / 60 ) );
}
} );# Each person, for their own time in it, by the minute begun. Charge once for each id.
def group_left(e):
if e["seconds"]:
charge(e["id"], e["user"], math.ceil(e["seconds"] / 60))
realtime.on("group.left", group_left)# Each person, for their own time in it, by the minute begun. Charge once for each id.
def group_left(e):
if e["seconds"]:
charge(e["id"], e["user"], math.ceil(e["seconds"] / 60))
realtime.on("group.left", group_left)# Each person, for their own time in it, by the minute begun. Charge once for each id.
def group_left(e):
if e["seconds"]:
charge(e["id"], e["user"], math.ceil(e["seconds"] / 60))
realtime.on("group.left", group_left)// In your webhook route, once its signature is checked as the docs say.
// Each person, for their own time in it, by the minute begun. Charge once for each id.
if event.Type == "group.left" && event.Seconds > 0 {
charge(event.ID, event.User, (event.Seconds+59)/60)
}Gesprekken in elke stack, met de hele opzet:
Toepassingen
Wat er met groepsgesprekken wordt gebouwd
Elk is een complete app in de documentatie, met de server in Node.js, PHP en Python.
Teamvergaderingen
Een videovergadering voor elk team of evenement, met schermdelen, die de leider voor iedereen beëindigt.
Lessen en audioruimtes
Een docent of een panel spreekt en de rest luistert, met een hand opsteken om te spreken.
Watchparty's
Een video die voor iedereen tegelijk afspeelt, pauzeert en verspringt zoals de host doet, met een chat ernaast en een gesprek van het gezelschap.
Consulten op afspraak
Een videoconsult bij een arts, een advocaat, een bijlesgever of een coach, alleen open voor de twee die geboekt zijn, op het afgesproken tijdstip.
Wachtkamers en deelruimtes
Gasten wachten tot de host ze binnenlaat, en de host stuurt mensen naar kleinere ruimtes en weer terug.
Gesprekken in rekening brengen
Je server weet hoe lang elke persoon sprak, geteld op onze servers, om per minuut te factureren.
Prijzen
Geprijsd op verbindingen, nooit op berichten
Vanaf $11.99 per maand voor 1.000 gelijktijdige verbindingen, jaarlijks gefactureerd, of $14.99 maandelijks gefactureerd.
Groepsgesprekken boven je abonnement: $0.20 per 1.000 minuten, $0.10 met audio.
Eén prijs bij elke resolutie. Bandbreedte, relays en berichten worden nooit in rekening gebracht, en gesprekken tussen twee personen zijn inbegrepen. We draaien onze eigen relays en mediaservers, en daardoor blijven deze prijzen laag.
Met 1.000 verbindingen worden groepsgesprekken niet gemeten tot 32 mensen met video tegelijk, iemand met audio telt half, zonder limiet op mensen per gesprek. Elke 1.000 verbindingen extra voegen 12 mensen met video toe. Daarboven kost elke extra persoon met video een credit per minuut, met audio de helft, en je abonnement voegt 5.000 credits per maand toe per 1.000 verbindingen.
Vragen
Veelgestelde vragen
Hoeveel mensen kunnen aan een groepsgesprek deelnemen?
Er is geen limiet op mensen per gesprek. Met 1.000 verbindingen kosten tot 32 mensen met video tegelijk geen credits, iemand met audio telt half, en elke 1.000 verbindingen extra voegen er 12 toe. Daarboven kost elke extra persoon met video een credit per minuut.
Heb ik eigen mediaservers nodig?
Nee. Iedereen in een groepsgesprek stuurt camera, microfoon en scherm één keer, en onze mediaservers geven ze door aan alle anderen, in meerdere regio’s. Je hoeft niets te hosten.
Wie bepaalt wie meedoet en wie host is?
Je app. Je server geeft elke persoon een token en leest daarvoor je eigen database, die bepaalt wie meedoet, wie spreekt en wie alleen luistert, en wie host is. De cloud handhaaft elk token, en je server kan de toegang op elk moment intrekken.
Zijn groepsgesprekken versleuteld?
Wanneer je server dat zegt, wordt elk frame in de browser versleuteld met een sleutel die alleen je server uitgeeft, zodat onze mediaservers doorgeven wat ze niet kunnen lezen.
Welke stacks kunnen de SDK voor groepsgesprekken gebruiken?
Next.js en Express, Laravel en kale PHP, Django, FastAPI en Flask, Capacitor, iOS en Android, elk met een gids. Een server in een andere taal gebruikt de HTTP API. Flutter-apps hebben gesprekken op iOS en Android, en React Native-apps voorlopig op iOS.
Kan ik mijn eigen vergaderscherm bouwen?
Ja. Het belscherm is optioneel. Pas de kleuren en teksten aan, of teken de vergadering zelf met de SDK, tot op elke persoon erin.
Kan ik mijn gebruikers groepsgesprekken in rekening brengen?
Ja. WordPlus Cloud laat je server per webhook weten wanneer elke persoon binnenkwam en wegging, geteld op de eigen servers, zodat je app ieder per minuut kan factureren.
Vragen over je integratie? Schrijf ons: we helpen met de SDK’s, het belscherm en je stack.