- Implemented the InternalWHIP component for managing WHIP server configurations. - Added functionality to load live WHIP state from Core and handle OBS URL generation. - Included polling for active streams and notifying parent components of state changes. - Created comprehensive tests for the InternalWHIP component covering various scenarios including fallback mechanisms and state changes. test: add integration tests for WHIP source component - Developed end-to-end tests for the InternalWHIP component to verify its behavior under different configurations. - Ensured that the component correctly handles the loading of WHIP state, displays appropriate messages, and emits the correct onChange events. test: add Settings WHIP configuration tests - Implemented tests for the WHIP settings tab to validate loading and saving of WHIP configurations. - Verified that the correct values are sent back to the Core when the user saves changes. - Ensured that the UI reflects the current state of the WHIP configuration after Core restarts or changes.
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
'use strict';
|
|
const { AccessToken } = require('../node_modules/livekit-server-sdk');
|
|
const https = require('https');
|
|
|
|
(async () => {
|
|
const at = new AccessToken(
|
|
'APIBTqTGxf9htMK',
|
|
'0dOHWPffwneaPg7OYpe4PeAes21zLJfeYJB9cKzSTtXW',
|
|
{ ttl: 3600 },
|
|
);
|
|
at.addGrant({ roomCreate: true, roomList: true, roomAdmin: true, ingressAdmin: true });
|
|
const token = await at.toJwt();
|
|
|
|
const body = JSON.stringify({
|
|
inputType: 1,
|
|
name: 'test-twirp',
|
|
roomName: 'test-room',
|
|
participantIdentity: 'obs',
|
|
participantName: 'OBS',
|
|
});
|
|
|
|
const options = {
|
|
hostname: 'livekit-server.nextream.sytes.net',
|
|
path: '/twirp/livekit.Ingress/CreateIngress',
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
Authorization: 'Bearer ' + token,
|
|
'Content-Length': Buffer.byteLength(body),
|
|
},
|
|
};
|
|
|
|
const req = https.request(options, (res) => {
|
|
let data = '';
|
|
res.on('data', (c) => (data += c));
|
|
res.on('end', () => {
|
|
console.log('Status:', res.statusCode);
|
|
console.log(data);
|
|
});
|
|
});
|
|
req.on('error', (e) => console.error(e.message));
|
|
req.write(body);
|
|
req.end();
|
|
})();
|