Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

videoroom: add "admin_key" parameter to list API #37

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/plugins/videoroom-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,12 +1071,15 @@ class VideoRoomHandle extends Handle {
/**
* List all the available rooms.
*
* @param {object} params
* @param {string} [params.admin_key] - The admin key needed for invoking the API
* @returns {Promise<module:videoroom-plugin~VIDEOROOM_EVENT_LIST>}
*/
async list() {
async list({ admin_key } = {}) {
const body = {
request: REQUEST_LIST_ROOMS,
};
if (typeof admin_key === 'string') body.admin_key = admin_key;

const response = await this.message(body);
const { event, data: evtdata } = response._janode || {};
Expand All @@ -1097,6 +1100,7 @@ class VideoRoomHandle extends Handle {
* @param {boolean} [params.is_private] - Make the room private (hidden from listing)
* @param {string} [params.secret] - The secret that will be used to modify the room
* @param {string} [params.pin] - The pin needed to access the room
* @param {string} [params.admin_key] - The admin key needed for invoking the API
* @param {number} [params.bitrate] - The bitrate cap that will be used for publishers
* @param {boolean} [params.bitrate_cap] - Make the bitrate cap an insormountable limit
* @param {number} [params.fir_freq] - The PLI interval in seconds
Expand All @@ -1113,7 +1117,7 @@ class VideoRoomHandle extends Handle {
* @param {string} [params.h264_profile] - H264 specific profile to prefer
* @returns {Promise<module:videoroom-plugin~VIDEOROOM_EVENT_CREATED>}
*/
async create({ room, description, max_publishers, permanent, is_private, secret, pin, bitrate,
async create({ room, description, max_publishers, permanent, is_private, secret, pin, admin_key, bitrate,
bitrate_cap, fir_freq, audiocodec, videocodec, talking_events, talking_level_threshold, talking_packets_threshold,
require_pvtid, require_e2ee, record, rec_dir, videoorient, h264_profile }) {
const body = {
Expand All @@ -1126,6 +1130,7 @@ class VideoRoomHandle extends Handle {
if (typeof is_private === 'boolean') body.is_private = is_private;
if (typeof secret === 'string') body.secret = secret;
if (typeof pin === 'string') body.pin = pin;
if (typeof admin_key === 'string') body.admin_key = admin_key;
if (typeof bitrate === 'number') body.bitrate = bitrate;
if (typeof bitrate_cap === 'boolean') body.bitrate_cap = bitrate_cap;
if (typeof fir_freq === 'number') body.fir_freq = fir_freq;
Expand Down Expand Up @@ -1260,16 +1265,18 @@ class VideoRoomHandle extends Handle {
* @param {number|string} params.feed - The feed identifier for the forwarder to stop (must be published)
* @param {number|string} params.stream - The forwarder identifier as returned by the start forward API
* @param {string} [params.secret] - The secret needed for managing the room
* @param {string} [params.admin_key] - The admin key needed for invoking the API
* @returns {Promise<module:videoroom-plugin~VIDEOROOM_EVENT_RTP_FWD_STOPPED>}
*/
async stopForward({ room, feed, stream, secret }) {
async stopForward({ room, feed, stream, secret, admin_key }) {
const body = {
request: REQUEST_RTP_FWD_STOP,
room,
publisher_id: feed,
stream_id: stream,
};
if (typeof secret === 'string') body.secret = secret;
if (typeof admin_key === 'string') body.admin_key = admin_key;

const response = await this.message(body);
const { event, data: evtdata } = response._janode || {};
Expand Down