Include webrtc webcams in recording processing

This commit is contained in:
Calvin Walton 2018-04-24 15:09:56 -04:00
parent c45fa74da0
commit ce84c5517b
2 changed files with 13 additions and 97 deletions

View File

@ -106,17 +106,6 @@ module BigBlueButton
start_events start_events
end end
# Get stop video events
def self.get_stop_video_events(events_xml)
BigBlueButton.logger.info("Task: Getting stop video events")
stop_events = []
doc = Nokogiri::XML(File.open(events_xml))
doc.xpath("//event[@eventname='StopWebcamShareEvent']").each do |stop_event|
stop_events << {:stop_timestamp => stop_event['timestamp'].to_i, :stream => stop_event.xpath('stream').text}
end
stop_events
end
# Build a webcam EDL # Build a webcam EDL
def self.create_webcam_edl(archive_dir) def self.create_webcam_edl(archive_dir)
events = Nokogiri::XML(File.open("#{archive_dir}/events.xml")) events = Nokogiri::XML(File.open("#{archive_dir}/events.xml"))
@ -139,13 +128,22 @@ module BigBlueButton
:areas => { :webcam => [] } :areas => { :webcam => [] }
} }
events.xpath('/recording/event[@module="WEBCAM"]').each do |event| events.xpath('/recording/event[@module="WEBCAM" or @module="bbb-webrtc-sfu"]').each do |event|
timestamp = event['timestamp'].to_i - initial_timestamp timestamp = event['timestamp'].to_i - initial_timestamp
# Determine the video filename
case event['eventname'] case event['eventname']
when 'StartWebcamShareEvent' when 'StartWebcamShareEvent', 'StopWebcamShareEvent'
stream = event.at_xpath('stream').text stream = event.at_xpath('stream').text
filename = "#{video_dir}/#{stream}.flv" filename = "#{video_dir}/#{stream}.flv"
when 'StartWebRTCShareEvent', 'StopWebRTCShareEvent'
uri = event.at_xpath('filename').text
filename = "#{video_dir}/#{File.basename(uri)}"
end
raise "Couldn't determine webcam filename" if filename.nil?
# Add the video to the EDL
case event['eventname']
when 'StartWebcamShareEvent', 'StartWebRTCShareEvent'
videos[filename] = { :timestamp => timestamp } videos[filename] = { :timestamp => timestamp }
active_videos << filename active_videos << filename
@ -160,10 +158,7 @@ module BigBlueButton
} }
end end
video_edl << edl_entry video_edl << edl_entry
when 'StopWebcamShareEvent' when 'StopWebcamShareEvent', 'StopWebRTCShareEvent'
stream = event.at_xpath('stream').text
filename = "#{video_dir}/#{stream}.flv"
active_videos.delete(filename) active_videos.delete(filename)
edl_entry = { edl_entry = {
@ -494,7 +489,7 @@ module BigBlueButton
# of the final recording # of the final recording
def self.have_webcam_events(events_xml) def self.have_webcam_events(events_xml)
BigBlueButton.logger.debug("Checking if webcams were used...") BigBlueButton.logger.debug("Checking if webcams were used...")
webcam_events = events_xml.xpath('/recording/event[@module="WEBCAM"]') webcam_events = events_xml.xpath('/recording/event[@eventname="StartWebcamShareEvent" or @eventname="StartWebRTCShareEvent"]')
if webcam_events.length > 0 if webcam_events.length > 0
BigBlueButton.logger.debug("Webcam events seen in recording") BigBlueButton.logger.debug("Webcam events seen in recording")
return true return true

View File

@ -1,79 +0,0 @@
#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 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/>.
#
require 'spec_helper'
require 'digest/md5'
module BigBlueButton
describe "DeskshareProcessing" do
context "#success" do
it "should get the 2 webcam start events" do
dir = "resources/raw"
events_xml = "#{dir}/webcam-events.xml"
se = BigBlueButton::Events.get_start_video_events(events_xml)
se.size.should == 2
end
it "should get the 2 webcam stop events" do
dir = "resources/raw"
events_xml = "#{dir}/webcam-events.xml"
se = BigBlueButton::Events.get_stop_video_events(events_xml)
se.size.should == 2
end
it "should get the 2 deskshare start events" do
dir = "resources/raw/974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2"
events_xml = "#{dir}/events.xml"
BigBlueButton::Events.get_start_deskshare_events(events_xml).size.should == 2
end
it "should get the 2 deskshare stop events" do
dir = "resources/raw/974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2"
events_xml = "#{dir}/events.xml"
BigBlueButton::Events.get_stop_deskshare_events(events_xml).size.should == 2
end
it "should get the webcam start events" do
dir = "resources/raw"
events_xml = "#{dir}/webcam-events.xml"
se = BigBlueButton::Events.get_start_video_events(events_xml)
se.size.should == 2
end
it "should get the webcam stop events" do
dir = "resources/raw"
events_xml = "#{dir}/webcam-events.xml"
se = BigBlueButton::Events.get_stop_video_events(events_xml)
se.size.should == 2
end
it "should get the deskshare start events" do
dir = "resources/raw/8774263b-c4a6-4078-b2e6-46b7d4bc91c1"
events_xml = "#{dir}/events.xml"
BigBlueButton::Events.get_start_deskshare_events(events_xml).size.should == 1
end
it "should get the deskshare stop events" do
dir = "resources/raw/8774263b-c4a6-4078-b2e6-46b7d4bc91c1"
events_xml = "#{dir}/events.xml"
BigBlueButton::Events.get_stop_deskshare_events(events_xml).size.should == 1
end
end
end
end