From 16af111bf6cd619abe189b46fcdb20bc5ad0606f Mon Sep 17 00:00:00 2001 From: Samuel MARTIN MORO Date: Fri, 21 May 2021 13:23:53 +0200 Subject: [PATCH 1/4] feat(chat-message): allow for custom message definition --- README.md | 1 + stream.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e87d5ed..9c9a5c4 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ You need to set some environment variables to run the container. * BBB_USER_NAME - the username to join the meeting. (Default: Live) * BBB_SHOW_CHAT - shows the chat on the left side of the window (Default: false) * BBB_RESOLUTION - the streamed/downloaded resolution (Default: 1920x1080) +* BBB_CHAT_MESSAGE - prefix for the message that would be posted to BBB chat, while joining a conference (Default: "This meeting is streamed to") * TZ - Timezone (Default: Europe/Vienna) #### Chat settings diff --git a/stream.py b/stream.py index 0ea136e..6992e32 100644 --- a/stream.py +++ b/stream.py @@ -149,7 +149,7 @@ def bbb_browser(): tmp_chatUrl = args.target.partition('//')[2].partition('/')[0] if args.chatUrl: tmp_chatUrl = args.chatUrl - tmp_chatMsg = "This meeting is streamed to" + tmp_chatMsg = os.environ.get('BBB_CHAT_MESSAGE', "This meeting is streamed to") if args.chatMsg: tmp_chatMsg = ' '.join(args.chatMsg).strip('"') element.send_keys("{0}: {1}".format(tmp_chatMsg, tmp_chatUrl)) From d81d33e211f0b911342f50e329226d18d54e35d7 Mon Sep 17 00:00:00 2001 From: Samuel MARTIN MORO Date: Wed, 26 May 2021 12:37:50 +0200 Subject: [PATCH 2/4] docs(examples): BBB_CHAT_MESSAGE --- examples/.env.chat_example | 4 +++- examples/.env.example | 2 ++ examples/docker-compose.yml.chat_example | 2 ++ examples/docker-compose.yml.example | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/.env.chat_example b/examples/.env.chat_example index a8e319f..43a4c78 100644 --- a/examples/.env.chat_example +++ b/examples/.env.chat_example @@ -15,4 +15,6 @@ BBB_REDIS_HOST=redis # Set REDIS channel to subscribe (default: 'chat') BBB_REDIS_CHANNEL=chat # Username for the chat (default: 'Chat') -BBB_CHAT_NAME=Chat \ No newline at end of file +BBB_CHAT_NAME=Chat +# Message to post in BBB Chat when joining a conference +BBB_CHAT_MESSAGE=This meeting is streamed to diff --git a/examples/.env.example b/examples/.env.example index af4fa4f..41af567 100644 --- a/examples/.env.example +++ b/examples/.env.example @@ -14,3 +14,5 @@ BBB_MODERATOR_PASSWORD=JjeQYksarqLQ BBB_MEETING_TITLE=liveStreaming Test # Media server url: BBB_STREAM_URL=rtmp://media_server_url/stream/stream_key +# Message to post in BBB Chat when joining a conference +BBB_CHAT_MESSAGE=This meeting is streamed to diff --git a/examples/docker-compose.yml.chat_example b/examples/docker-compose.yml.chat_example index fcf1828..5b8346a 100644 --- a/examples/docker-compose.yml.chat_example +++ b/examples/docker-compose.yml.chat_example @@ -20,6 +20,8 @@ services: - BBB_ENABLE_CHAT=true # show chat in live stream - BBB_SHOW_CHAT=false + # Message to post in BBB Chat when joining a conference + - BBB_CHAT_MESSAGE=This meeting is streamed to # Set REDIS host (default: 'redis') - BBB_REDIS_HOST=redis # Set REDIS channel to subscribe (default: 'chat') diff --git a/examples/docker-compose.yml.example b/examples/docker-compose.yml.example index fed3b9d..c23165f 100644 --- a/examples/docker-compose.yml.example +++ b/examples/docker-compose.yml.example @@ -29,6 +29,8 @@ services: - BBB_END_INTRO_AT= # Media server url: - BBB_STREAM_URL=rtmp://media_server_url/stream/stream_key + # Message to post in BBB Chat when joining a conference + - BBB_CHAT_MESSAGE=This meeting is streamed to # Resolution to be streamed/downloaded in format WxH (default 1920x1080) - BBB_RESOLUTION=1920x1080 # stream video bitrate From 29cd9c6c3e9f07bf1f7be9db40538638639307cf Mon Sep 17 00:00:00 2001 From: Samuel MARTIN MORO Date: Wed, 26 May 2021 12:47:55 +0200 Subject: [PATCH 3/4] feat(chat): allows to disable chat message post when joining in --- stream.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/stream.py b/stream.py index 6992e32..8842da2 100644 --- a/stream.py +++ b/stream.py @@ -146,14 +146,15 @@ def bbb_browser(): chat_send = browser.find_elements_by_css_selector('[aria-label="Send message"]')[0] # ensure chat is enabled (might be locked by moderator) if element.is_enabled() and chat_send.is_enabled(): - tmp_chatUrl = args.target.partition('//')[2].partition('/')[0] - if args.chatUrl: - tmp_chatUrl = args.chatUrl tmp_chatMsg = os.environ.get('BBB_CHAT_MESSAGE', "This meeting is streamed to") - if args.chatMsg: - tmp_chatMsg = ' '.join(args.chatMsg).strip('"') - element.send_keys("{0}: {1}".format(tmp_chatMsg, tmp_chatUrl)) - chat_send.click() + if not tmp_chatMsg in [ 'false', 'False', 'FALSE' ]: + tmp_chatUrl = args.target.partition('//')[2].partition('/')[0] + if args.chatUrl: + tmp_chatUrl = args.chatUrl + if args.chatMsg: + tmp_chatMsg = ' '.join(args.chatMsg).strip('"') + element.send_keys("{0}: {1}".format(tmp_chatMsg, tmp_chatUrl)) + chat_send.click() if args.chat: browser.execute_script("document.querySelector('[aria-label=\"User list\"]').parentElement.style.display='none';") From 94e4540a363c2ac4a3806833db6e0167368e3c32 Mon Sep 17 00:00:00 2001 From: Samuel MARTIN MORO Date: Wed, 26 May 2021 12:59:18 +0200 Subject: [PATCH 4/4] feat(chat-message): chat.py equivalent --- chat.py | 11 +++++++++-- examples/.env.chat_example | 2 +- examples/docker-compose.yml.chat_example | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/chat.py b/chat.py index 250916e..58aa170 100644 --- a/chat.py +++ b/chat.py @@ -85,8 +85,15 @@ def bbb_browser(): element = EC.invisibility_of_element((By.CSS_SELECTOR, '.ReactModal__Overlay')) WebDriverWait(browser, selenium_timeout).until(element) - browser.find_element_by_id('message-input').send_keys("Viewers of the live stream can now send messages to this meeting") - browser.find_elements_by_css_selector('[aria-label="Send message"]')[0].click() + + element = browser.find_element_by_id('message-input') + chat_send = browser.find_elements_by_css_selector('[aria-label="Send message"]')[0] + # ensure chat is enabled (might be locked by moderator) + if element.is_enabled() and chat_send.is_enabled(): + tmp_chatMsg = os.environ.get('BBB_CHAT_MESSAGE', "Viewers of the live stream can now send messages to this meeting") + if not tmp_chatMsg in [ 'false', 'False', 'FALSE' ]: + element.send_keys(tmp_chatMsg) + chat_send.click() redis_r = redis.Redis(host=args.redis,charset="utf-8", decode_responses=True) redis_s = redis_r.pubsub() diff --git a/examples/.env.chat_example b/examples/.env.chat_example index 43a4c78..da0bd49 100644 --- a/examples/.env.chat_example +++ b/examples/.env.chat_example @@ -17,4 +17,4 @@ BBB_REDIS_CHANNEL=chat # Username for the chat (default: 'Chat') BBB_CHAT_NAME=Chat # Message to post in BBB Chat when joining a conference -BBB_CHAT_MESSAGE=This meeting is streamed to +BBB_CHAT_MESSAGE=Viewers of the live stream can now send messages to this meeting diff --git a/examples/docker-compose.yml.chat_example b/examples/docker-compose.yml.chat_example index 5b8346a..c58263e 100644 --- a/examples/docker-compose.yml.chat_example +++ b/examples/docker-compose.yml.chat_example @@ -21,7 +21,7 @@ services: # show chat in live stream - BBB_SHOW_CHAT=false # Message to post in BBB Chat when joining a conference - - BBB_CHAT_MESSAGE=This meeting is streamed to + - BBB_CHAT_MESSAGE=Viewers of the live stream can now send messages to this meeting # Set REDIS host (default: 'redis') - BBB_REDIS_HOST=redis # Set REDIS channel to subscribe (default: 'chat')