forked from External/greenlight
add recording events to other meeting pages under room
This commit is contained in:
parent
02f59c49e6
commit
77fd74dd8f
|
@ -56,6 +56,7 @@ class BbbController < ApplicationController
|
|||
wait_for_moderator: true,
|
||||
meeting_recorded: true,
|
||||
meeting_name: meeting_name,
|
||||
room_owner: params[:room_id],
|
||||
user_is_moderator: current_user == user
|
||||
}
|
||||
else
|
||||
|
@ -117,7 +118,11 @@ class BbbController < ApplicationController
|
|||
load_room!
|
||||
|
||||
# bbb_res = bbb_get_recordings "#{@user.encrypted_id}-#{params[:id]}"
|
||||
bbb_res = bbb_get_recordings "#{@user.encrypted_id}"
|
||||
options = { "meta_room-id": @user.encrypted_id }
|
||||
if params[:id]
|
||||
options["meta_meeting-name"] = params[:id]
|
||||
end
|
||||
bbb_res = bbb_get_recordings(options)
|
||||
render_bbb_response bbb_res, bbb_res[:recordings]
|
||||
end
|
||||
|
||||
|
@ -127,7 +132,7 @@ class BbbController < ApplicationController
|
|||
metadata = params.select{ |k, v| k.match(/^meta_/) }
|
||||
bbb_res = bbb_update_recordings(params[:record_id], published, metadata)
|
||||
if bbb_res[:returncode]
|
||||
RecordingUpdatesJob.perform_later(@user.encrypted_id, params[:record_id])
|
||||
RecordingUpdatesJob.perform_later(@user.encrypted_id, params[:record_id], params[:id])
|
||||
end
|
||||
render_bbb_response bbb_res
|
||||
end
|
||||
|
@ -136,7 +141,7 @@ class BbbController < ApplicationController
|
|||
def delete_recordings
|
||||
bbb_res = bbb_delete_recordings(params[:record_id])
|
||||
if bbb_res[:returncode]
|
||||
RecordingDeletesJob.perform_later(@user.encrypted_id, params[:record_id])
|
||||
RecordingDeletesJob.perform_later(@user.encrypted_id, params[:record_id], params[:id])
|
||||
end
|
||||
render_bbb_response bbb_res
|
||||
end
|
||||
|
@ -161,7 +166,7 @@ class BbbController < ApplicationController
|
|||
def authorize_recording_owner!
|
||||
load_and_authorize_room_owner!
|
||||
|
||||
recordings = bbb_get_recordings(params[:room_id])[:recordings]
|
||||
recordings = bbb_get_recordings({recordID: params[:record_id]})[:recordings]
|
||||
recordings.each do |recording|
|
||||
if recording[:recordID] == params[:record_id]
|
||||
return true
|
||||
|
@ -194,7 +199,7 @@ class BbbController < ApplicationController
|
|||
# the webhook event doesn't have all the data we need, so we need
|
||||
# to send a getRecordings anyway
|
||||
# TODO: if the webhooks included all data in the event we wouldn't need this
|
||||
rec_info = bbb_get_recordings(token, record_id)
|
||||
rec_info = bbb_get_recordings({recordID: record_id})
|
||||
rec_info = rec_info[:recordings].first
|
||||
RecordingCreatedJob.perform_later(token, parse_recording_for_view(rec_info))
|
||||
|
||||
|
|
|
@ -19,16 +19,21 @@ class RecordingDeletesJob < ApplicationJob
|
|||
|
||||
queue_as :default
|
||||
|
||||
def perform(room, record_id)
|
||||
def perform(room, record_id, meeting=nil)
|
||||
tries = 0
|
||||
sleep_time = 2
|
||||
|
||||
while tries < 4
|
||||
bbb_res = bbb_get_recordings(nil, record_id)
|
||||
bbb_res = bbb_get_recordings({recordID: record_id})
|
||||
if !bbb_res[:recordings] || bbb_res[:messageKey] == 'noRecordings'
|
||||
full_id = room
|
||||
full_id += "-#{recording[:metadata][:"meeting-name"]}"
|
||||
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
||||
action: 'delete',
|
||||
id: record_id
|
||||
ActionCable.server.broadcast "#{full_id}_recording_updates_channel",
|
||||
action: 'delete',
|
||||
id: record_id
|
||||
break
|
||||
end
|
||||
sleep sleep_time
|
||||
|
|
|
@ -19,13 +19,20 @@ class RecordingUpdatesJob < ApplicationJob
|
|||
|
||||
queue_as :default
|
||||
|
||||
def perform(room, record_id)
|
||||
bbb_res = bbb_get_recordings(nil, record_id)
|
||||
def perform(room, record_id, meeting=nil)
|
||||
bbb_res = bbb_get_recordings({recordID: record_id})
|
||||
recording = bbb_res[:recordings].first
|
||||
full_id = room
|
||||
full_id += "-#{recording[:metadata][:"meeting-name"]}"
|
||||
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
||||
action: 'update',
|
||||
id: record_id,
|
||||
published: recording[:published],
|
||||
listed: bbb_is_recording_listed(recording)
|
||||
ActionCable.server.broadcast "#{full_id}_recording_updates_channel",
|
||||
action: 'update',
|
||||
id: record_id,
|
||||
published: recording[:published],
|
||||
listed: bbb_is_recording_listed(recording)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,6 +47,7 @@ module BbbApi
|
|||
options[:wait_for_moderator] ||= false
|
||||
options[:meeting_logout_url] ||= nil
|
||||
options[:meeting_name] ||= meeting_token
|
||||
options[:room_owner] ||= nil
|
||||
|
||||
if !bbb
|
||||
return call_invalid_res
|
||||
|
@ -81,6 +82,12 @@ module BbbApi
|
|||
{ "meta_#{BbbApi::META_HOOK_URL}": options[:hook_url] }
|
||||
) if options[:hook_url]
|
||||
|
||||
# these parameters are used to filter recordings by room and meeting
|
||||
meeting_options.merge!(
|
||||
{ "meta_room-id": options[:room_owner],
|
||||
"meta_meeting-name": options[:meeting_name]}
|
||||
) if options[:room_owner]
|
||||
|
||||
if Rails.configuration.use_webhooks
|
||||
webhook_register(options[:hook_url], meeting_id)
|
||||
end
|
||||
|
@ -114,13 +121,9 @@ module BbbApi
|
|||
response_data = bbb_exception_res exc
|
||||
end
|
||||
|
||||
def bbb_get_recordings(meeting_id, record_id=nil)
|
||||
options={}
|
||||
if record_id
|
||||
options[:recordID] = record_id
|
||||
end
|
||||
if meeting_id
|
||||
options[:meetingID] = bbb_meeting_id(meeting_id)
|
||||
def bbb_get_recordings(options={})
|
||||
if options[:meetingID]
|
||||
options[:meetingID] = bbb_meeting_id(options[:meetingID])
|
||||
end
|
||||
res = bbb_safe_execute :get_recordings, options
|
||||
|
||||
|
|
|
@ -32,10 +32,14 @@ Rails.application.routes.draw do
|
|||
patch '/rooms/:room_id/recordings/:record_id', to: 'bbb#update_recordings', defaults: {format: 'json'}
|
||||
delete '/rooms/:room_id/recordings/:record_id', to: 'bbb#delete_recordings', defaults: {format: 'json'}
|
||||
|
||||
|
||||
get '/rooms/:room_id', to: 'landing#resource', resource: 'rooms'
|
||||
get '/rooms/:room_id/recordings', to: 'bbb#recordings', defaults: {format: 'json'}
|
||||
get '/rooms/:room_id/:id', to: 'landing#resource', resource: 'rooms'
|
||||
delete '/rooms/:room_id/:id/end', to: 'bbb#end', defaults: {format: 'json'}
|
||||
get '/rooms/:room_id/:id/recordings', to: 'bbb#recordings', defaults: {format: 'json'}
|
||||
patch '/rooms/:room_id/:id/recordings/:record_id', to: 'bbb#update_recordings', defaults: {format: 'json'}
|
||||
delete '/rooms/:room_id/:id/recordings/:record_id', to: 'bbb#delete_recordings', defaults: {format: 'json'}
|
||||
|
||||
get '/:resource/:id', to: 'landing#resource', as: :resource
|
||||
get '/:resource/:id/join', to: 'bbb#join', as: :bbb_join, defaults: {format: 'json'}
|
||||
|
|
Loading…
Reference in New Issue