From 5be5f8557d4d6fc9c838b1c07efd2f1e7d70a3bf Mon Sep 17 00:00:00 2001 From: hiroshisuga <45039819+hiroshisuga@users.noreply.github.com> Date: Sat, 1 Jul 2023 20:44:17 +0900 Subject: [PATCH 1/2] Update presentation.rb --- .../scripts/publish/presentation.rb | 42 ++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/record-and-playback/presentation/scripts/publish/presentation.rb b/record-and-playback/presentation/scripts/publish/presentation.rb index 86b7dfc8eefc..cd0232c79f2f 100755 --- a/record-and-playback/presentation/scripts/publish/presentation.rb +++ b/record-and-playback/presentation/scripts/publish/presentation.rb @@ -801,6 +801,7 @@ def process_presentation(package_dir) slides = [] panzooms = [] cursors = [] + cursors_all = {} shapes = {} # Iterate through the events.xml and store the events, building the @@ -868,12 +869,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 @@ -965,6 +964,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 +997,21 @@ 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 + panzooms_doc = Builder::XmlMarkup.new(indent: 2) panzooms_doc.instruct! panzooms_doc.recording(id: 'panzoom_events') { |xml| xml << panzooms_rec.target! } @@ -992,6 +1020,7 @@ 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) end def process_chat_messages(events, bbb_props) @@ -1169,6 +1198,7 @@ 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' @deskshare_xml_filename = 'deskshare.xml' @svg_shape_id = 1 @svg_shape_unique_id = 1 From ea06c997dc5daf7953d3be95e31f5ad0a2d5e407 Mon Sep 17 00:00:00 2001 From: hiroshisuga <45039819+hiroshisuga@users.noreply.github.com> Date: Sat, 8 Jul 2023 22:22:16 +0900 Subject: [PATCH 2/2] presenters.xml and participants.xml --- .../scripts/publish/presentation.rb | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/record-and-playback/presentation/scripts/publish/presentation.rb b/record-and-playback/presentation/scripts/publish/presentation.rb index cd0232c79f2f..7aa826a7df27 100755 --- a/record-and-playback/presentation/scripts/publish/presentation.rb +++ b/record-and-playback/presentation/scripts/publish/presentation.rb @@ -803,6 +803,8 @@ def process_presentation(package_dir) cursors = [] cursors_all = {} shapes = {} + presenters = [] + participants = {} # Iterate through the events.xml and store the events, building the # xml files as we go @@ -861,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 @@ -901,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 @@ -1011,6 +1026,29 @@ def process_presentation(package_dir) 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! @@ -1021,6 +1059,8 @@ def process_presentation(package_dir) 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) @@ -1199,6 +1239,8 @@ def copy_media_files_helper(media, media_files, package_dir) @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