Skip to content

Commit

Permalink
Merge pull request #126 from Worteks/feat-115
Browse files Browse the repository at this point in the history
feat(chat-message): allow for custom message definition
  • Loading branch information
mtsonline authored May 26, 2021
2 parents d7c4a21 + 4469afb commit 10cc6bf
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ def bbb_browser():
element = EC.presence_of_element_located((By.ID, 'message-input'))
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()
Expand Down
4 changes: 3 additions & 1 deletion examples/.env.chat_example
Original file line number Diff line number Diff line change
Expand Up @@ -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
BBB_CHAT_NAME=Chat
# Message to post in BBB Chat when joining a conference
BBB_CHAT_MESSAGE=Viewers of the live stream can now send messages to this meeting
2 changes: 2 additions & 0 deletions examples/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/docker-compose.yml.chat_example
Original file line number Diff line number Diff line change
Expand Up @@ -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=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')
Expand Down
2 changes: 2 additions & 0 deletions examples/docker-compose.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,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 = "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()
tmp_chatMsg = os.environ.get('BBB_CHAT_MESSAGE', "This meeting is streamed to")
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';")
Expand Down

0 comments on commit 10cc6bf

Please sign in to comment.