mirror of https://github.com/OpenVidu/openvidu.git
442 lines
11 KiB
TypeScript
442 lines
11 KiB
TypeScript
import type { ParticipantDocument } from '../../src/index.js';
|
|
import {
|
|
ACTIVE_ROOM,
|
|
at,
|
|
between,
|
|
CLOSED_ROOM,
|
|
EG,
|
|
ENTITIES_RETENTION_MS,
|
|
NODE_ALPHA,
|
|
NODE_BETA,
|
|
P,
|
|
plus,
|
|
REGION,
|
|
schemaVersion,
|
|
T
|
|
} from './scenario.js';
|
|
|
|
type Base = Pick<ParticipantDocument, 'roomSid' | 'roomName' | 'nodeId' | 'schemaVersion'>;
|
|
|
|
const closedRoom: Base = { roomSid: CLOSED_ROOM.sid, roomName: CLOSED_ROOM.name, nodeId: NODE_ALPHA, schemaVersion };
|
|
const activeRoom: Base = { roomSid: ACTIVE_ROOM.sid, roomName: ACTIVE_ROOM.name, nodeId: NODE_BETA, schemaVersion };
|
|
|
|
const standardPermission = { canSubscribe: true, canPublish: true, canPublishData: true };
|
|
const recorderPermission = { canSubscribe: true, canPublish: false, canPublishData: false, hidden: true };
|
|
const noTracks = { published: 0, bySource: {}, subscribed: 0, subscribeFailures: 0 };
|
|
const noQuality = { scoreSum: 0, scoreCount: 0, poor: 0, lost: 0 };
|
|
|
|
const desktopChrome = {
|
|
sdk: 'JS',
|
|
version: '2.15.7',
|
|
os: 'Windows',
|
|
osVersion: '11',
|
|
browser: 'Chrome',
|
|
browserVersion: '130.0.0.0',
|
|
network: 'wifi'
|
|
} as const;
|
|
|
|
const desktopSafari = {
|
|
sdk: 'JS',
|
|
version: '2.15.7',
|
|
os: 'macOS',
|
|
osVersion: '15.1',
|
|
browser: 'Safari',
|
|
browserVersion: '18.1',
|
|
network: 'wired',
|
|
address: '198.51.100.24'
|
|
} as const;
|
|
|
|
function closed(
|
|
joinedAt: Date,
|
|
leftAt: Date
|
|
): Pick<ParticipantDocument, 'joinedAt' | 'leftAt' | 'durationMs' | 'expiresAt'> {
|
|
return { joinedAt, leftAt, durationMs: between(joinedAt, leftAt), expiresAt: plus(leftAt, ENTITIES_RETENTION_MS) };
|
|
}
|
|
|
|
export const participants: ParticipantDocument[] = [
|
|
{
|
|
_id: P.alice,
|
|
identity: 'alice',
|
|
identityLower: 'alice',
|
|
name: 'Alice',
|
|
...closedRoom,
|
|
kind: 'STANDARD',
|
|
status: 'left',
|
|
...closed(at('09:00:05'), at('09:40:00')),
|
|
activeAt: at('09:00:06.200'),
|
|
disconnectReason: 'CLIENT_INITIATED',
|
|
closedBy: 'event',
|
|
connectTimeMs: 1200,
|
|
connectionType: 'udp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: { ...desktopChrome, address: '203.0.113.10' },
|
|
permission: standardPermission,
|
|
isPublisher: true,
|
|
tracks: { published: 2, bySource: { CAMERA: 1, MICROPHONE: 1 }, subscribed: 0, subscribeFailures: 0 },
|
|
bytes: { up: 380_000_000, down: 2_000_000 },
|
|
quality: {
|
|
scoreSum: 600,
|
|
scoreCount: 150,
|
|
minScore: 3.9,
|
|
poor: 0,
|
|
lost: 0,
|
|
lastScore: 4.1,
|
|
lastScoreAt: at('09:39:30')
|
|
},
|
|
lastEventAt: at('09:40:00'),
|
|
lastStatsAt: at('09:39:30'),
|
|
internal: { trackSids: [T.aliceCamera, T.aliceMic] }
|
|
},
|
|
{
|
|
_id: P.bob1,
|
|
identity: 'bob',
|
|
identityLower: 'bob',
|
|
name: 'Bob',
|
|
...closedRoom,
|
|
kind: 'STANDARD',
|
|
status: 'left',
|
|
...closed(at('09:01:00'), at('09:10:00')),
|
|
activeAt: at('09:01:01.500'),
|
|
disconnectReason: 'DUPLICATE_IDENTITY',
|
|
closedBy: 'event',
|
|
connectTimeMs: 1500,
|
|
connectionType: 'udp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: desktopSafari,
|
|
permission: standardPermission,
|
|
isPublisher: false,
|
|
tracks: { published: 0, bySource: {}, subscribed: 1, subscribeFailures: 0 },
|
|
bytes: { up: 1_000_000, down: 120_000_000 },
|
|
quality: {
|
|
scoreSum: 72,
|
|
scoreCount: 18,
|
|
minScore: 3.8,
|
|
poor: 0,
|
|
lost: 0,
|
|
lastScore: 4,
|
|
lastScoreAt: at('09:09:30')
|
|
},
|
|
lastEventAt: at('09:10:00'),
|
|
lastStatsAt: at('09:09:30')
|
|
},
|
|
{
|
|
_id: P.bob2,
|
|
identity: 'bob',
|
|
identityLower: 'bob',
|
|
name: 'Bob',
|
|
...closedRoom,
|
|
kind: 'STANDARD',
|
|
status: 'left',
|
|
...closed(at('09:10:02'), at('09:45:00')),
|
|
activeAt: at('09:10:03'),
|
|
disconnectReason: 'ROOM_DELETED',
|
|
closedBy: 'event',
|
|
connectTimeMs: 1000,
|
|
connectionType: 'tcp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: desktopSafari,
|
|
permission: standardPermission,
|
|
isPublisher: false,
|
|
tracks: { published: 0, bySource: {}, subscribed: 1, subscribeFailures: 1 },
|
|
bytes: { up: 3_000_000, down: 480_000_000 },
|
|
quality: {
|
|
scoreSum: 264,
|
|
scoreCount: 70,
|
|
minScore: 1.8,
|
|
poor: 6,
|
|
lost: 0,
|
|
lastScore: 3.9,
|
|
lastScoreAt: at('09:44:30')
|
|
},
|
|
lastEventAt: at('09:45:00'),
|
|
lastStatsAt: at('09:44:30')
|
|
},
|
|
{
|
|
_id: P.carol,
|
|
identity: 'Carol',
|
|
identityLower: 'carol',
|
|
...closedRoom,
|
|
kind: 'STANDARD',
|
|
status: 'aborted',
|
|
...closed(at('09:05:00'), at('09:05:20')),
|
|
disconnectReason: 'CONNECTION_TIMEOUT',
|
|
closedBy: 'event',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: {
|
|
sdk: 'JS',
|
|
version: '2.15.7',
|
|
os: 'Linux',
|
|
browser: 'Chrome',
|
|
browserVersion: '129.0.0.0',
|
|
network: 'wired',
|
|
address: '192.0.2.77'
|
|
},
|
|
permission: standardPermission,
|
|
isPublisher: false,
|
|
tracks: noTracks,
|
|
bytes: { up: 0, down: 0 },
|
|
quality: noQuality,
|
|
lastEventAt: at('09:05:20')
|
|
},
|
|
{
|
|
_id: P.egressRecorder,
|
|
identity: EG.recording,
|
|
identityLower: EG.recording.toLowerCase(),
|
|
...closedRoom,
|
|
kind: 'EGRESS',
|
|
status: 'left',
|
|
...closed(at('09:02:00'), at('09:40:05')),
|
|
activeAt: at('09:02:02'),
|
|
disconnectReason: 'CLIENT_INITIATED',
|
|
closedBy: 'event',
|
|
connectTimeMs: 2000,
|
|
connectionType: 'udp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: { sdk: 'GO', version: '2.11.0', os: 'linux' },
|
|
permission: recorderPermission,
|
|
isPublisher: false,
|
|
tracks: { published: 0, bySource: {}, subscribed: 0, subscribeFailures: 0 },
|
|
bytes: { up: 500_000, down: 250_000_000 },
|
|
quality: {
|
|
scoreSum: 160,
|
|
scoreCount: 40,
|
|
minScore: 3.7,
|
|
poor: 0,
|
|
lost: 0,
|
|
lastScore: 4,
|
|
lastScoreAt: at('09:39:30')
|
|
},
|
|
lastEventAt: at('09:40:05'),
|
|
lastStatsAt: at('09:39:30')
|
|
},
|
|
{
|
|
_id: P.agent,
|
|
identity: 'agent-assistant',
|
|
identityLower: 'agent-assistant',
|
|
name: 'Assistant',
|
|
...closedRoom,
|
|
kind: 'AGENT',
|
|
status: 'left',
|
|
// Its leave event was lost: the reconciler closed it at its last stats flush.
|
|
...closed(at('09:00:10'), at('09:44:30')),
|
|
activeAt: at('09:00:11'),
|
|
disconnectReason: 'RECONCILED',
|
|
closedBy: 'reconciler',
|
|
connectTimeMs: 900,
|
|
connectionType: 'udp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: { sdk: 'PYTHON', version: '1.2.0', os: 'linux' },
|
|
permission: standardPermission,
|
|
isPublisher: false,
|
|
tracks: { published: 0, bySource: {}, subscribed: 0, subscribeFailures: 0 },
|
|
bytes: { up: 400_000, down: 30_000_000 },
|
|
quality: {
|
|
scoreSum: 120,
|
|
scoreCount: 30,
|
|
minScore: 3.9,
|
|
poor: 0,
|
|
lost: 0,
|
|
lastScore: 4,
|
|
lastScoreAt: at('09:44:30')
|
|
},
|
|
lastEventAt: at('09:00:11'),
|
|
lastStatsAt: at('09:44:30')
|
|
},
|
|
{
|
|
_id: P.sip,
|
|
identity: 'sip-caller-1',
|
|
identityLower: 'sip-caller-1',
|
|
name: 'Caller',
|
|
...closedRoom,
|
|
kind: 'SIP',
|
|
status: 'left',
|
|
...closed(at('09:20:00'), at('09:30:00')),
|
|
activeAt: at('09:20:02'),
|
|
disconnectReason: 'CLIENT_INITIATED',
|
|
closedBy: 'event',
|
|
connectTimeMs: 2000,
|
|
connectionType: 'udp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
permission: standardPermission,
|
|
isPublisher: false,
|
|
tracks: { published: 0, bySource: {}, subscribed: 0, subscribeFailures: 0 },
|
|
bytes: { up: 100_000, down: 6_000_000 },
|
|
quality: {
|
|
scoreSum: 51,
|
|
scoreCount: 12,
|
|
minScore: 4.2,
|
|
poor: 0,
|
|
lost: 0,
|
|
lastScore: 4.3,
|
|
lastScoreAt: at('09:29:30')
|
|
},
|
|
lastEventAt: at('09:30:00'),
|
|
lastStatsAt: at('09:29:30')
|
|
},
|
|
{
|
|
_id: P.dave,
|
|
identity: 'dave',
|
|
identityLower: 'dave',
|
|
name: 'Dave',
|
|
...activeRoom,
|
|
kind: 'STANDARD',
|
|
status: 'active',
|
|
joinedAt: at('10:00:03'),
|
|
activeAt: at('10:00:04'),
|
|
connectTimeMs: 900,
|
|
connectionType: 'turn',
|
|
region: REGION,
|
|
resumes: 1,
|
|
client: {
|
|
sdk: 'ANDROID',
|
|
version: '2.9.0',
|
|
os: 'Android',
|
|
osVersion: '15',
|
|
deviceModel: 'Pixel 9',
|
|
network: 'cellular',
|
|
address: '203.0.113.200'
|
|
},
|
|
permission: standardPermission,
|
|
isPublisher: true,
|
|
tracks: { published: 2, bySource: { CAMERA: 1, MICROPHONE: 1 }, subscribed: 2, subscribeFailures: 0 },
|
|
bytes: { up: 90_000_000, down: 58_000_000 },
|
|
quality: {
|
|
scoreSum: 420,
|
|
scoreCount: 104,
|
|
minScore: 3.6,
|
|
poor: 0,
|
|
lost: 0,
|
|
lastScore: 4.1,
|
|
lastScoreAt: at('10:35:00')
|
|
},
|
|
lastEventAt: at('10:30:05'),
|
|
lastStatsAt: at('10:35:00'),
|
|
internal: { trackSids: [T.daveCamera, T.daveMic], subscribedTrackSids: [T.ingressVideo1, T.ingressVideo2] },
|
|
expiresAt: null
|
|
},
|
|
{
|
|
_id: P.erin,
|
|
identity: 'erin',
|
|
identityLower: 'erin',
|
|
name: 'Erin',
|
|
...activeRoom,
|
|
kind: 'STANDARD',
|
|
status: 'joining',
|
|
joinedAt: at('10:31:00'),
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: {
|
|
sdk: 'JS',
|
|
version: '2.15.7',
|
|
os: 'macOS',
|
|
osVersion: '15.1',
|
|
browser: 'Firefox',
|
|
browserVersion: '131.0',
|
|
network: 'wifi',
|
|
address: '198.51.100.99'
|
|
},
|
|
permission: standardPermission,
|
|
isPublisher: false,
|
|
tracks: noTracks,
|
|
bytes: { up: 0, down: 0 },
|
|
quality: noQuality,
|
|
lastEventAt: at('10:31:00'),
|
|
expiresAt: null
|
|
},
|
|
{
|
|
_id: P.ingress1,
|
|
identity: 'obs-studio',
|
|
identityLower: 'obs-studio',
|
|
name: 'OBS',
|
|
...activeRoom,
|
|
kind: 'INGRESS',
|
|
status: 'left',
|
|
...closed(at('10:00:10'), at('10:20:00')),
|
|
activeAt: at('10:00:11'),
|
|
disconnectReason: 'CLIENT_INITIATED',
|
|
closedBy: 'event',
|
|
connectTimeMs: 500,
|
|
connectionType: 'udp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: { sdk: 'GO', version: '2.11.0', os: 'linux' },
|
|
permission: { canSubscribe: false, canPublish: true, canPublishData: true },
|
|
isPublisher: true,
|
|
tracks: { published: 1, bySource: { CAMERA: 1 }, subscribed: 0, subscribeFailures: 0 },
|
|
bytes: { up: 7_000_000, down: 100_000 },
|
|
quality: {
|
|
scoreSum: 40,
|
|
scoreCount: 10,
|
|
minScore: 3.9,
|
|
poor: 0,
|
|
lost: 0,
|
|
lastScore: 4,
|
|
lastScoreAt: at('10:19:30')
|
|
},
|
|
lastEventAt: at('10:20:00'),
|
|
lastStatsAt: at('10:19:30')
|
|
},
|
|
{
|
|
_id: P.ingress2,
|
|
identity: 'obs-studio',
|
|
identityLower: 'obs-studio',
|
|
name: 'OBS',
|
|
...activeRoom,
|
|
kind: 'INGRESS',
|
|
status: 'active',
|
|
joinedAt: at('10:30:00'),
|
|
activeAt: at('10:30:01'),
|
|
connectTimeMs: 600,
|
|
connectionType: 'udp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: { sdk: 'GO', version: '2.11.0', os: 'linux' },
|
|
permission: { canSubscribe: false, canPublish: true, canPublishData: true },
|
|
isPublisher: true,
|
|
tracks: { published: 1, bySource: { CAMERA: 1 }, subscribed: 0, subscribeFailures: 0 },
|
|
bytes: { up: 1_500_000, down: 20_000 },
|
|
quality: {
|
|
scoreSum: 26,
|
|
scoreCount: 6,
|
|
minScore: 4.2,
|
|
poor: 0,
|
|
lost: 0,
|
|
lastScore: 4.4,
|
|
lastScoreAt: at('10:35:00')
|
|
},
|
|
lastEventAt: at('10:30:02'),
|
|
lastStatsAt: at('10:35:00'),
|
|
expiresAt: null
|
|
},
|
|
{
|
|
_id: P.egressStreamer,
|
|
identity: EG.streaming,
|
|
identityLower: EG.streaming.toLowerCase(),
|
|
...activeRoom,
|
|
kind: 'EGRESS',
|
|
status: 'active',
|
|
joinedAt: at('10:05:00'),
|
|
activeAt: at('10:05:02'),
|
|
connectTimeMs: 1800,
|
|
connectionType: 'udp',
|
|
region: REGION,
|
|
resumes: 0,
|
|
client: { sdk: 'GO', version: '2.11.0', os: 'linux' },
|
|
permission: recorderPermission,
|
|
isPublisher: false,
|
|
tracks: { published: 0, bySource: {}, subscribed: 0, subscribeFailures: 0 },
|
|
bytes: { up: 300_000, down: 41_000_000 },
|
|
quality: noQuality,
|
|
lastEventAt: at('10:05:02'),
|
|
lastStatsAt: at('10:35:00'),
|
|
expiresAt: null
|
|
}
|
|
];
|