diff --git a/record-and-playback/presentation/scripts/publish/presentation.rb b/record-and-playback/presentation/scripts/publish/presentation.rb index 86b7dfc8eefc..7aa826a7df27 100755 --- a/record-and-playback/presentation/scripts/publish/presentation.rb +++ b/record-and-playback/presentation/scripts/publish/presentation.rb @@ -801,7 +801,10 @@ def process_presentation(package_dir) slides = [] panzooms = [] cursors = [] + cursors_all = {} shapes = {} + presenters = [] + participants = {} # Iterate through the events.xml and store the events, building the # xml files as we go @@ -860,6 +863,12 @@ def process_presentation(package_dir) presenter = event.at_xpath('userid').text cursor_visible = false cursor_changed = true + presenter_changed = true + + when 'ParticipantJoinEvent' + name_participant = event.at_xpath('name').text + userId_participant = event.at_xpath('userId').text + participants[userId_participant] = name_participant when 'CursorMoveEvent' cursor_x = event.at_xpath('xOffset').text.to_f @@ -868,12 +877,10 @@ def process_presentation(package_dir) when 'WhiteboardCursorMoveEvent' user_id = event.at_xpath('userId')&.text - # Only draw cursor for current presentor. TODO multi-cursor support - if !user_id || user_id == presenter - cursor_x = event.at_xpath('xOffset').text.to_f - cursor_y = event.at_xpath('yOffset').text.to_f - cursor_visible = cursor_changed = true - end + cursor_x = event.at_xpath('xOffset').text.to_f + cursor_y = event.at_xpath('yOffset').text.to_f + cursor_visible = cursor_changed = true + cursor_userId = user_id if user_id && user_id != presenter end # Perform slide finalization if slide_changed @@ -902,6 +909,13 @@ def process_presentation(package_dir) end end + # Presenter finalization + if presenter_changed && + (presenters.empty? || + (presenters[-1][:timestamp] != timestamp || presenters[-1][:userId] != presenter)) + presenters << {timestamp: timestamp, userId: presenter} + end + # Perform panzoom finalization if panzoom_changed slide = slides.last @@ -965,6 +979,20 @@ def process_presentation(package_dir) in: timestamp, } cursors << cursor + + if !cursor_userId && presenter + if cursors_all[presenter] + cursors_all[presenter].push(cursor) + else + cursors_all[presenter] = [cursor] + end + elsif cursor_userId && cursor_userId != "" + if cursors_all[cursor_userId] + cursors_all[cursor_userId].push(cursor) + else + cursors_all[cursor_userId] = [cursor] + end + end end end end @@ -984,6 +1012,44 @@ def process_presentation(package_dir) cursors_doc.instruct! cursors_doc.recording(id: 'cursor_events') { |xml| xml << cursors_rec.target! } + cursors_all.each do |uid, cs| + cs.last[:out] = last_timestamp + end + cursors_all_doc = Nokogiri::XML::Builder.new do |xml| + xml.recording(:id => 'cursor_all_events') do + cursors_all.each do |uid, cs| + xml.user(:userId => uid) do |user| + cs.each do |c| + cursors_emit_event(user, c) + end + end + end + end + end + #BigBlueButton.logger.info("CURSORALL #{cursors_all}") + + #BigBlueButton.logger.info("PRESENTERS #{presenters}") + presenters_doc = Nokogiri::XML::Builder.new do |xml| + xml.recording(:id => 'assign_presenter_events') do + presenters.each do |p| + xml.event(:timestamp => p[:timestamp]) do + xml.userId(p[:userId]) + end + end + end + end + + #BigBlueButton.logger.info("PARTICIPANTS #{participants}") + participants_doc = Nokogiri::XML::Builder.new do |xml| + xml.recording(:id => 'participants_names') do + participants.each do |k, v| + xml.participant(:userId => k) do + xml.name(v) + end + end + end + end + panzooms_doc = Builder::XmlMarkup.new(indent: 2) panzooms_doc.instruct! panzooms_doc.recording(id: 'panzoom_events') { |xml| xml << panzooms_rec.target! } @@ -992,6 +1058,9 @@ def process_presentation(package_dir) File.write("#{package_dir}/#{@shapes_svg_filename}", shapes_doc.to_xml) File.write("#{package_dir}/#{@panzooms_xml_filename}", panzooms_doc.target!) File.write("#{package_dir}/#{@cursor_xml_filename}", cursors_doc.target!) + File.write("#{package_dir}/#{@cursors_xml_filename}", cursors_all_doc.to_xml) + File.write("#{package_dir}/#{@presenters_xml_filename}", presenters_doc.to_xml) + File.write("#{package_dir}/#{@participants_xml_filename}", participants_doc.to_xml) end def process_chat_messages(events, bbb_props) @@ -1169,6 +1238,9 @@ def copy_media_files_helper(media, media_files, package_dir) @shapes_svg_filename = 'shapes.svg' @panzooms_xml_filename = 'panzooms.xml' @cursor_xml_filename = 'cursor.xml' +@cursors_xml_filename = 'cursors.xml' +@presenters_xml_filename = 'presenters.xml' +@participants_xml_filename = 'participants.xml' @deskshare_xml_filename = 'deskshare.xml' @svg_shape_id = 1 @svg_shape_unique_id = 1