Pour les applications
Appels vidéo de groupe pour votre application
Une API et un SDK de visioconférence pour Next.js, Laravel, Django et tout autre stack. Réunions, cours, tables rondes et salons audio tournent sur nos serveurs multimédias, sans limite de personnes dans un appel, et l’écran d’appel est prêt à l’emploi : vous n’avez aucun serveur multimédia à faire tourner.
Les meilleurs tarifs pour les WebSockets, des appels 1 à 1 illimités avec des serveurs TURN dans le monde entier, et des appels de groupe et la diffusion en direct avec un quota inclus. À partir de $11.99 par mois pour 1 000 connexions simultanées, facturé à l’année, ou $14.99 facturé au mois.
Appels de groupe au-delà de votre formule : $0.20 pour 1 000 minutes, $0.10 en audio.
Next.js sur le serveur et React sur la page.
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})
}Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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'),
)Essayez un appel de groupe
Ouvrez une salle ici, puis faites venir jusqu’à trois autres personnes depuis leur téléphone ou d’autres fenêtres. Aucun compte requis.
Ce sont les écrans que le SDK donne à votre application. Votre navigateur demande la caméra et le micro, rien n’est enregistré, et la démo se termine après 10 minutes.
Appels de groupe
Des appels de groupe sur nos serveurs multimédias
Réunions, cours, tables rondes et salons audio tournent sur nos serveurs multimédias, pas entre les appareils : chaque appareil envoie sa caméra une seule fois, quel que soit le nombre de personnes dans l’appel.

Aucune limite de personnes
Chaque personne d’un appel de groupe envoie sa caméra, son micro et son écran une seule fois, et nos serveurs multimédias les transmettent à tous les autres, dans plusieurs régions.
Intervenants et auditeurs
Votre serveur dit qui envoie et qui regarde et écoute seulement, comme dans un cours ou une table ronde. Un hôte laisse parler un auditeur, puis le refait auditeur.
Les hôtes gardent l’ordre
Un hôte coupe un micro, laisse parler quelqu’un et retire quelqu’un de l’appel, depuis la vignette de chaque personne.
Votre serveur décide
Mener une réunion, du début à la fin
Votre serveur dit qui rejoint et qui anime, et la page ou votre serveur fait le reste. Voici une réunion d’équipe, puis un cours, tâche après tâche.
Next.js sur le serveur et React sur la page.
Donner un jeton à la page
Un appel de groupe n’est qu’un nom, comme meeting:7, sans rien à créer dans le cloud. Qui rejoint et qui anime relève de la logique propre à votre application : elle a donc sa place dans une route à vous, qui répond par un jeton. isMemberOf et isLeadOf sont vos propres vérifications.
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})
}Ajouter un bouton pour rejoindre
L’écran prêt à l’emploi : un bouton et une fenêtre d’appel avec chaque vignette et chaque commande, sans code d’appel. Le bouton demande son jeton à votre route.
Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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'),
)Le placer dans votre page
Le même écran à un endroit de votre choix, au lieu d’une fenêtre au-dessus de la page, qui rejoint à l’ouverture de la page si vous le souhaitez.
Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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();
}
}Rejoindre depuis votre propre code
Pour un écran que vous dessinez vous-même : obtenez un jeton auprès de votre route, puis rejoignez l’appel avec ce jeton. Chaque personne arrive avec sa caméra et son micro, et rien n’est envoyé tant que vous ne le demandez pas.
Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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),
]),
)Caméra, micro et écran
Les mêmes commandes dans un appel, un appel de groupe et une diffusion en direct, donc votre écran n’a aucun appareil à suivre. Une caméra s’arrête, et son voyant s’éteint, quand elle est désactivée ou que l’appel se termine.
Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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 noIntervenants et auditeurs
Un cours, une table ronde ou un salon audio : quelques-uns parlent et les autres écoutent. Votre route désigne les auditeurs, et votre serveur laisse parler l’un d’eux pendant l’appel, en gardant ce choix là où la route le lit pour ceux qui rejoignent ensuite.
// 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}'Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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);Couper le micro et retirer des personnes
L’hôte le fait depuis la page, comme son jeton le lui permet. L’écran d’appel propose ces actions sur chaque vignette.
Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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
}Mettre quelqu’un en avant
Place quelqu’un sur les vignettes principales pour tout le monde, jusqu’à quatre personnes, hôte compris.
Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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 everyoneLe piloter depuis votre serveur
Voyez qui est dans un appel et coupez le micro de n’importe qui, faites-en un auditeur ou retirez-le, sans aucune page ouverte. Une personne retirée reste dehors jusqu’à ce que votre serveur lui signe un nouveau jeton.
// 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'Y mettre fin pour tout le monde
Sort tout le monde d’un coup. Réutilisez le nom, et un nouvel appel commence.
// 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'Le chiffrer de bout en bout
Un mot dans votre jeton. Nos serveurs multimédias transmettent alors des images qu’ils ne peuvent pas lire, et un navigateur qui ne peut pas chiffrer est refusé plutôt que d’envoyer en clair.
// 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)})Des hooks et des composants pour toute app React, avec n'importe lequel des serveurs ci-dessus.
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();Facturer à la minute
Votre serveur apprend combien de temps chaque personne est restée dans l’appel, compté sur nos serveurs, pour que vous puissiez facturer vos propres utilisateurs. L’événement peut arriver deux fois, alors facturez une seule fois par id. charge est votre propre fonction.
// 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)
}Les appels dans chaque stack, avec toute la mise en place :
Cas d’usage
Ce que l’on construit avec les appels de groupe
Chacun est une application complète dans la documentation, avec son serveur en Node.js, PHP et Python.
Réunions d’équipe
Une réunion vidéo pour chaque équipe ou événement, avec partage d’écran, que l’animateur termine pour tous.
Cours et salons audio
Un enseignant ou un panel parle et les autres écoutent, en levant la main pour parler.
Visionnages en groupe
Une vidéo qui se lance, se met en pause et avance pour tous à la fois, comme le fait l’hôte, avec une discussion à côté et un appel du groupe.
Consultations sur rendez-vous
Une visite en vidéo avec une médecin, un avocat, une professeure ou un coach, ouverte seulement aux deux personnes inscrites, à son heure.
Salles d’attente et sous-groupes
Les invités attendent que l’hôte les admette, et l’hôte envoie des personnes dans de plus petites salles puis les fait revenir.
Facturer les appels
Votre serveur apprend combien de temps chaque personne a parlé, compté sur nos serveurs, pour facturer à la minute.
Tarifs
Un prix selon les connexions, jamais selon les messages
À partir de $11.99 par mois pour 1 000 connexions simultanées, facturé à l’année, ou $14.99 facturé au mois.
Appels de groupe au-delà de votre formule : $0.20 pour 1 000 minutes, $0.10 en audio.
Un seul prix quelle que soit la résolution. La bande passante, les relais et les messages ne sont jamais facturés, et les appels à deux sont inclus. Nous exploitons nos propres relais et serveurs multimédias, ce qui garde ces prix bas.
Avec 1 000 connexions, les appels de groupe ne sont pas décomptés jusqu’à 32 personnes en vidéo à la fois, une personne en audio comptant pour moitié, sans limite de personnes par appel. Chaque tranche de 1 000 connexions en plus ajoute 12 personnes en vidéo. Au-delà, chaque personne en vidéo de plus prend un crédit par minute, en audio la moitié, et votre formule ajoute 5 000 crédits par mois pour 1 000 connexions.
Questions
Questions fréquentes
Combien de personnes peuvent rejoindre un appel de groupe ?
Il n’y a pas de limite de personnes par appel. Avec 1 000 connexions, jusqu’à 32 personnes en vidéo à la fois ne prennent aucun crédit, une personne en audio comptant pour moitié, et chaque tranche de 1 000 connexions en plus en ajoute 12. Au-delà, chaque personne en vidéo de plus prend un crédit par minute.
Ai-je besoin de mes propres serveurs multimédias ?
Non. Chaque personne d’un appel de groupe envoie sa caméra, son micro et son écran une seule fois, et nos serveurs multimédias les transmettent à tous les autres, dans plusieurs régions. Vous n’avez rien à héberger.
Qui décide qui rejoint et qui anime ?
Votre application. Votre serveur donne un jeton à chaque personne, en lisant votre propre base de données, qui dit qui rejoint, qui parle et qui écoute seulement, et qui anime. Le cloud applique chaque jeton, et votre serveur peut retirer l’accès à tout moment.
Les appels de groupe sont-ils chiffrés ?
Quand votre serveur le dit, chaque image est chiffrée dans le navigateur avec une clé que seul votre serveur distribue, et nos serveurs multimédias transmettent ce qu’ils ne peuvent pas lire.
Quels stacks peuvent utiliser le SDK d’appels de groupe ?
Next.js et Express, Laravel et PHP sans framework, Django, FastAPI et Flask, Capacitor, iOS et Android, chacun avec un guide. Un serveur dans un autre langage utilise l’API HTTP. Les applications Flutter ont les appels sur iOS et Android, et les applications React Native sur iOS pour l’instant.
Puis-je construire mon propre écran de réunion ?
Oui. L’écran d’appel est facultatif. Changez ses couleurs et ses textes, ou dessinez la réunion vous-même avec le SDK, jusqu’à chaque personne qui s’y trouve.
Puis-je facturer les appels de groupe à mes utilisateurs ?
Oui. WordPlus Cloud indique à votre serveur par webhook le moment où chaque personne a rejoint et quitté, compté sur ses propres serveurs, pour que votre application facture chacune à la minute.
Des questions sur votre intégration ? Écrivez-nous : nous vous aidons avec les SDK, l’écran d’appel et votre stack.