Add endpoint to detect new recordings and update the interface

The endpoint receives events from BigBlueButton via webhooks or scripts
in the record and playback workflow.
For now it only treats the event for when a recording is ready.
When it happens, it uses action cable to update the interface dynamically
with the new recording.
This commit is contained in:
Leonardo Crauss Daronco
2016-12-07 16:20:10 -02:00
parent b518458622
commit e5efb05a01
11 changed files with 178 additions and 16 deletions

View File

@ -0,0 +1,26 @@
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
#
# Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
#
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
class RecordingCreatedJob < ApplicationJob
include BbbApi
queue_as :default
def perform(room, recording)
ActionCable.server.broadcast "#{room}_recording_updates_channel",
{ action: 'create' }.merge(recording)
end
end

View File

@ -28,7 +28,7 @@ class RecordingDeletesJob < ApplicationJob
if !bbb_res[:recordings] || bbb_res[:messageKey] == 'noRecordings'
ActionCable.server.broadcast "#{room}_recording_updates_channel",
action: 'delete',
record_id: record_id
id: record_id
break
end
sleep sleep_time

View File

@ -24,7 +24,7 @@ class RecordingUpdatesJob < ApplicationJob
recording = bbb_res[:recordings].first
ActionCable.server.broadcast "#{room}_recording_updates_channel",
action: 'update',
record_id: record_id,
id: record_id,
published: recording[:published],
listed: bbb_is_recording_listed(recording)
end