Commit 2a34b097 authored by Martin Schrott's avatar Martin Schrott
Browse files

added feature: start a meeting

added optional parameters
parent c57328bb
......@@ -22,6 +22,10 @@ You need to set some environment variables to run the container.
#### Optional settings
* BBB_AS_MODERATOR - if set to "true" the meeting will be joined as moderator
* BBB_START_MEETING - start meeting
* BBB_ATTENDEE_PASSWORD - attendee password (optional - has to be set to the attendee password of moodle/greenlight or any other frontend to allow joining via their links)
* BBB_MODERATOR_PASSWORD - moderator password (optional - has to be set to the moderator password of moodle/greenlight or any other frontend to allow joining via their links)
* BBB_MEETING_TITLE - meeting title (optional - only works if the meeting is started by the liveStreaming)
* 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)
......@@ -32,7 +36,7 @@ You need to set some environment variables to run the container.
* BBB_CHAT_NAME - the username to join the meeting for chatting. (Default: Chat)
### Starting liveStreaming
* wget -O docker-compose.yml https://raw.github.com/aau-zid/BigBlueButton-liveStreaming/1.0.0-beta.3/examples/docker-compose.yml.example
* wget -O docker-compose.yml https://raw.github.com/aau-zid/BigBlueButton-liveStreaming/1.0.0-beta.4/examples/docker-compose.yml.example
* (change configuration)
* docker-compose up -d
* docker-compose down
......
......@@ -8,6 +8,8 @@ BBB_MEETING_ID=your_meetingID
BBB_STREAM_URL=rtmp://media_server_url/stream/stream_key
# Enable chat functionality
BBB_ENABLE_CHAT=true
# show chat in live stream
BBB_SHOW_CHAT=false
# Set REDIS host (default: 'redis')
BBB_REDIS_HOST=redis
# Set REDIS channel to subscribe (default: 'chat')
......
......@@ -4,5 +4,13 @@ BBB_URL=https://your_BigBlueButton_server/bigbluebutton/api
BBB_SECRET=your_secret
# BigBlueButton meetingID:
BBB_MEETING_ID=your_meetingID
# start meeting (optional):
BBB_START_MEETING=false
# attendee password (optional - has to be set to the attendee password of moodle/greenlight or any other frontend to allow joining via their links):
BBB_ATTENDEE_PASSWORD=IVLHwOBSVmYP
# moderator password (optional - has to be set to the moderator password of moodle/greenlight or any other frontend to allow joining via their links):
BBB_MODERATOR_PASSWORD=JjeQYksarqLQ
# meeting title (optional):
BBB_MEETING_TITLE=liveStreaming Test
# Media server url:
BBB_STREAM_URL=rtmp://media_server_url/stream/stream_key
......@@ -17,6 +17,8 @@ services:
- BBB_STREAM_URL=rtmp://media_server_url/stream/stream_key
# Enable chat functionality
-BBB_ENABLE_CHAT=true
# show chat in live stream
-BBB_SHOW_CHAT=false
# Set REDIS host (default: 'redis')
-BBB_REDIS_HOST=redis
# Set REDIS channel to subscribe (default: 'chat')
......
......@@ -10,5 +10,13 @@ services:
- BBB_SECRET=your_secret
# BigBlueButton meetingID:
- BBB_MEETING_ID=your_meetingID
# start meeting (optional):
- BBB_START_MEETING=false
# attendee password (optional - has to be set to the attendee password of moodle/greenlight or any other frontend to allow joining via their links):
- BBB_ATTENDEE_PASSWORD=IVLHwOBSVmYP
# moderator password (optional - has to be set to the moderator password of moodle/greenlight or any other frontend to allow joining via their links):
- BBB_MODERATOR_PASSWORD=JjeQYksarqLQ
# meeting title (optional):
- BBB_MEETING_TITLE=liveStreaming Test
# Media server url:
- BBB_STREAM_URL=rtmp://media_server_url/stream/stream_key
......@@ -12,10 +12,34 @@ then
SHOW_CHAT="-c";
fi
START_MEETING="";
if [ "${BBB_START_MEETING}" != "" ]
then
START_MEETING="-S";
fi
ATTENDEE_PASSWORD="";
if [ "${BBB_ATTENDEE_PASSWORD}" != "" ]
then
ATTENDEE_PASSWORD="-A ${BBB_ATTENDEE_PASSWORD}";
fi
MODERATOR_PASSWORD="";
if [ "${BBB_MODERATOR_PASSWORD}" != "" ]
then
MODERATOR_PASSWORD="-M ${BBB_MODERATOR_PASSWORD}";
fi
MEETING_TITLE="";
if [ "${BBB_MEETING_TITLE}" != "" ]
then
MEETING_TITLE="${BBB_MEETING_TITLE}";
fi
if [ "${BBB_ENABLE_CHAT}" = "true" ]
then
xvfb-run -n 133 --server-args="-screen 0 1920x1080x24" python3 chat.py -s ${BBB_URL} -p ${BBB_SECRET} -i ${BBB_MEETING_ID} -r ${BBB_REDIS_HOST} -u ${BBB_CHAT_NAME} -c ${BBB_REDIS_CHANNEL} $JOIN_AS_MODERATOR &
xvfb-run -n 133 --server-args="-screen 0 1920x1080x24" python3 chat.py -s ${BBB_URL} -p ${BBB_SECRET} -i ${BBB_MEETING_ID} -r ${BBB_REDIS_HOST} -u ${BBB_CHAT_NAME} -c ${BBB_REDIS_CHANNEL} $START_MEETING $ATTENDEE_PASSWORD $MODERATOR_PASSWORD -T "$MEETING_TITLE" $JOIN_AS_MODERATOR &
sleep 10
fi
xvfb-run -n 122 --server-args="-screen 0 1920x1080x24" python3 stream.py -s ${BBB_URL} -p ${BBB_SECRET} -i ${BBB_MEETING_ID} -t ${BBB_STREAM_URL} -u ${BBB_USER_NAME} ${SHOW_CHAT} $JOIN_AS_MODERATOR;
xvfb-run -n 122 --server-args="-screen 0 1920x1080x24" python3 stream.py -s ${BBB_URL} -p ${BBB_SECRET} -i ${BBB_MEETING_ID} -t ${BBB_STREAM_URL} -u ${BBB_USER_NAME} ${SHOW_CHAT} $START_MEETING $ATTENDEE_PASSWORD $MODERATOR_PASSWORD -T "$MEETING_TITLE" $JOIN_AS_MODERATOR;
......@@ -3,7 +3,7 @@
import sys, argparse, time, subprocess, shlex, logging, os
from bigbluebutton_api_python import BigBlueButton
from bigbluebutton_api_python import BigBlueButton, exception
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
......@@ -23,6 +23,10 @@ parser.add_argument("-s","--server", help="Big Blue Button Server URL")
parser.add_argument("-p","--secret", help="Big Blue Button Secret")
parser.add_argument("-i","--id", help="Big Blue Button Meeting ID")
parser.add_argument("-m","--moderator", help="Join the meeting as moderator",action="store_true")
parser.add_argument("-S","--startMeeting", help="start the meeting if not running",action="store_true")
parser.add_argument("-A","--attendeePassword", help="attendee password (required to create meetings)")
parser.add_argument("-M","--moderatorPassword", help="moderator password (required to create a meeting)")
parser.add_argument("-T","--meetingTitle", help="meeting title (required to create a meeting)")
parser.add_argument("-u","--user", help="Name to join the meeting",default="Live")
parser.add_argument("-t","--target", help="RTMP Streaming URL")
parser.add_argument("-c","--chat", help="Show the chat",action="store_true")
......@@ -50,8 +54,14 @@ def set_up():
def bbb_browser():
global browser
logging.info('Open BBB and hide elements!!')
if args.startMeeting is True:
try:
logging.info("create_meeting...")
create_meeting()
except exception.bbbexception.BBBException as ERR:
logging.info(ERR)
logging.info("get_join_url...")
browser.get(get_join_url())
element = EC.presence_of_element_located((By.CSS_SELECTOR, '[aria-label="Listen only"]'))
WebDriverWait(browser, selelnium_timeout).until(element)
......@@ -73,13 +83,23 @@ def bbb_browser():
browser.execute_script("document.querySelector('[aria-label=\"Actions bar\"]').style.display='none';")
browser.execute_script("document.getElementById('container').setAttribute('style','margin-bottom:30px');")
def create_meeting():
create_params = {}
if args.moderatorPassword:
create_params['moderatorPW'] = args.moderatorPassword
if args.attendeePassword:
create_params['attendeePW'] = args.attendeePassword
if args.meetingTitle:
create_params['name'] = args.meetingTitle
return bbb.create_meeting(args.id, params=create_params)
def get_join_url():
minfo = bbb.get_meeting_info(args.id)
if args.moderator:
pwd = minfo.get_meetinginfo().get_moderatorpw()
else:
pwd = minfo.get_meetinginfo().get_attendeepw()
return bbb.get_join_meeting_url(args.user,args.id,pwd)
return bbb.get_join_meeting_url(args.user,args.id, pwd)
def watch():
while True:
......@@ -93,11 +113,10 @@ def stream():
ffmpeg_args = shlex.split(ffmpeg_stream)
p = subprocess.Popen(ffmpeg_args)
while bbb.is_meeting_running(args.id).is_meeting_running() != True:
logging.info("Meeting isn't running. We will try again in %d seconds!" % connect_timeout)
time.sleep(connect_timeout)
if args.startMeeting is False:
while bbb.is_meeting_running(args.id).is_meeting_running() != True:
logging.info("Meeting isn't running. We will try again in %d seconds!" % connect_timeout)
time.sleep(connect_timeout)
set_up()
bbb_browser()
stream()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment