Exemple #1
0
def join_room():
    """View to let user join a virtual room"""

    form = RoomForm()

    # if the form is submitted and valid
    if form.validate_on_submit():
        roomId = form.roomId.data.strip()
        password = form.password.data
        username = form.username.data.strip().replace(" ", "_")

        b = BigBlueButton(BBB_SERVER_URL, BBB_SERVER_SECRET)

        r = b.is_meeting_running(roomId)

        active_room = json.loads(r['xml']['running'].lower())

        # check if the meeting exists
        if not active_room:
            return render_template('conference/join_conference.html',
                                   form=form,
                                   existingId=True)
        else:
            # get room url
            room_url = b.get_join_meeting_url(username, roomId, password)

            # redirect to the room
            return redirect(room_url)

    return render_template('conference/join_conference.html', form=form)
    p = subprocess.call(ffmpeg_args)


def download():
    downloadFile = "/video/meeting-%s.mkv" % fileTimeStamp
    audio_options = '-f alsa -i pulse -ac 2'
    video_options = '-c:v libx264rgb -crf 0 -preset ultrafast'
    ffmpeg_stream = 'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080  -i :%d -thread_queue_size 1024 %s %s %s' % (
        122, audio_options, video_options, downloadFile)
    ffmpeg_args = shlex.split(ffmpeg_stream)
    logging.info("saving meeting as %s" % downloadFile)
    return subprocess.Popen(ffmpeg_args)


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)

# current date and time
now = datetime.now()
fileTimeStamp = now.strftime("%Y%m%d%H%M%S")

set_up()
if args.stream and args.intro:
    stream_intro()
if args.stream or args.download:
    bbb_browser()
if args.download: