-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add support for breakout rooms #2
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
Merged
marcos-cereijo-pexip
merged 8 commits into
master
from
feat/add-support-for-breakout-rooms
Sep 5, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0bfb172
feat: add support for breakout rooms
marcos-cereijo-pexip 6be8408
chore: update some dependencies
marcos-cereijo-pexip ee7de84
chore: increase version
marcos-cereijo-pexip 8c7a586
chore: remove test script in package.json, since we don't have any
marcos-cereijo-pexip 11ed8be
fix: copy the message overlay from the main room to the breakouts whe…
marcos-cereijo-pexip e0cb13c
feat: add selector to choose the room to which change the message ove…
marcos-cereijo-pexip 14b471b
chore: remove breakoutRoom file
marcos-cereijo-pexip 1ee1507
refactor: remove getPlugin and export the plugin variable directly
marcos-cereijo-pexip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Change Log | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](http://keepachangelog.com/) and this | ||
| project adheres to [Semantic Versioning](http://semver.org/). | ||
|
|
||
| ## [1.1.0] 2024-08-30 | ||
|
|
||
| ### Added | ||
|
|
||
| - Support for breakout rooms. | ||
|
|
||
| ## [1.0.0] - 2024-06-03 | ||
|
|
||
| ### Added | ||
|
|
||
| - Change message overlay for the main room in a VMR (only Pexip Infinity v35 and | ||
| later). |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,27 @@ | ||
| { | ||
| "name": "message-overlay", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "Plugin that allows the host to display messages embedded in the video stream.", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "start": "vite", | ||
| "build": "vite build", | ||
| "test": "jest --detectOpenHandles --silent", | ||
| "lint": "eslint ." | ||
| }, | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC", | ||
| "type": "module", | ||
| "dependencies": { | ||
| "@pexip/plugin-api": "19.3.2" | ||
| "@pexip/plugin-api": "19.3.3" | ||
| }, | ||
| "devDependencies": { | ||
| "eslint": "^8.1.0", | ||
| "eslint-config-love": "^47.0.0", | ||
| "eslint-config-prettier": "^9.1.0", | ||
| "prettier": "^3.3.0", | ||
| "prettier": "^3.3.3", | ||
| "typescript": "^5.4.5", | ||
| "vite": "^5.2.12", | ||
| "vite-plugin-mkcert": "^1.17.5" | ||
| "vite": "^5.4.2", | ||
| "vite-plugin-mkcert": "^1.17.6" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { setMessageOverlay } from '../messageOverlay' | ||
| import { plugin } from '../plugin' | ||
|
|
||
| export const createInputMessageForm = async ( | ||
| roomId: string, | ||
| currentMessage: string, | ||
| roomName?: string, | ||
| breakoutRooms?: Map<string, string> | ||
| ): Promise<void> => { | ||
| const messageName = | ||
| roomName != null ? `"${roomName}" message` : 'Room message' | ||
|
|
||
| const form = await plugin.ui.addForm({ | ||
| title: 'Set message overlay', | ||
| description: | ||
| 'Write your message overlay text below. If you would like to get a new line press enter or make a new line in the textarea', | ||
| form: { | ||
| elements: { | ||
| message: { | ||
| name: messageName, | ||
| type: 'textarea', | ||
| isOptional: true, | ||
| placeholder: 'Enter your message', | ||
| value: currentMessage | ||
| } | ||
| }, | ||
| submitBtnTitle: 'Submit' | ||
| } | ||
| }) | ||
|
|
||
| form.onInput.add(async (result): Promise<void> => { | ||
| await form.remove() | ||
|
|
||
| if (result.message == null) { | ||
| return | ||
| } | ||
|
|
||
| if (roomId === '') { | ||
| setMessageOverlay('main', result.message).catch(console.error) | ||
| breakoutRooms?.forEach((_breakoutName, breakoutUuid) => { | ||
| setMessageOverlay(breakoutUuid, result.message).catch(console.error) | ||
| }) | ||
| } else { | ||
| setMessageOverlay(roomId, result.message).catch(console.error) | ||
| } | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { createInputMessageForm } from './createInputMessageForm' | ||
| import { getMessageOverlay } from '../messageOverlay' | ||
| import { plugin } from '../plugin' | ||
|
|
||
| export const createSelectRoomForm = async ( | ||
| breakoutRooms: Map<string, string> | ||
| ): Promise<void> => { | ||
| const form = await plugin.ui.addForm({ | ||
| title: 'Set message overlay', | ||
| description: 'Choose the room you want to set the message overlay for.', | ||
| form: { | ||
| elements: { | ||
| room: { | ||
| name: 'Select room', | ||
| type: 'select', | ||
| isOptional: true, | ||
| options: [ | ||
| { | ||
| id: '', | ||
| label: 'All rooms' | ||
| }, | ||
| { | ||
| id: 'main', | ||
| label: 'Main room' | ||
| }, | ||
| ...Array.from(breakoutRooms).map(([roomId, roomName]) => ({ | ||
| id: roomId, | ||
| label: roomName | ||
| })) | ||
| ] | ||
| } | ||
| }, | ||
| submitBtnTitle: 'Choose' | ||
| } | ||
| }) | ||
|
|
||
| form.onInput.add(async (result): Promise<void> => { | ||
| await form.remove() | ||
|
|
||
| if (result.room == null) { | ||
| return | ||
| } | ||
|
|
||
| const roomId = result.room | ||
| let currentMessage = '' | ||
|
|
||
| if (roomId !== '') { | ||
| try { | ||
| currentMessage = await getMessageOverlay(result.room) | ||
| } catch (e) { | ||
| console.error(e) | ||
| } | ||
| } | ||
|
|
||
| const roomName = | ||
| roomId === '' | ||
| ? 'All rooms' | ||
| : roomId === 'main' | ||
| ? 'Main room' | ||
| : breakoutRooms.get(roomId) | ||
|
|
||
| await createInputMessageForm(roomId, currentMessage, roomName) | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { plugin } from './plugin' | ||
|
|
||
| export const getMessageOverlay = async (roomId: string): Promise<string> => { | ||
| let path = 'get_message_text' | ||
| if (roomId !== 'main') { | ||
| path = `breakouts/${roomId}/${path}` | ||
| } | ||
|
|
||
| const response = await (plugin.conference as any).sendRequest({ | ||
| method: 'GET', | ||
| path | ||
| }) | ||
|
|
||
| return response.data.result.text ?? '' | ||
| } | ||
|
|
||
| export const setMessageOverlay = async ( | ||
| roomId: string, | ||
| text: string | ||
| ): Promise<void> => { | ||
| let path = 'set_message_text' | ||
| if (roomId !== 'main') { | ||
| path = `breakouts/${roomId}/${path}` | ||
| } | ||
|
|
||
| ;(plugin.conference as any).sendRequest({ | ||
| method: 'POST', | ||
| path, | ||
| payload: { text } | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { type Plugin } from '@pexip/plugin-api' | ||
|
|
||
| export let plugin: Plugin | ||
|
|
||
| export const setPlugin = (p: Plugin): void => { | ||
| plugin = p | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.