Correctly handling multiple deskshare events inside a slide interval of time
This commit is contained in:
parent
fe9fde2330
commit
6aeabb9293
@ -720,11 +720,11 @@ def processSlideEvents
|
||||
|
||||
slide_size = FastImage.size(image_url)
|
||||
|
||||
|
||||
split_slide = false
|
||||
deskshare_start = deskshare_stop = 0.0
|
||||
orig_deskshare_start = orig_deskshare_stop = 0.0
|
||||
deskshare_video_filename = ""
|
||||
deskshare_starts = []
|
||||
deskshare_stops = []
|
||||
orig_deskshare_starts = []
|
||||
orig_deskshare_stops = []
|
||||
deskshare_video_filenames = []
|
||||
# checking if there's a deskshare event inside the slide interval of time
|
||||
deskshare_matched_evts.each do |start_evt|
|
||||
start_timestamp_orig = start_evt[:start_timestamp].to_f
|
||||
@ -734,43 +734,50 @@ def processSlideEvents
|
||||
stop_timestamp = ( translateTimestamp(stop_timestamp_orig) / 1000 ).round(1)
|
||||
|
||||
if(slide_start < start_timestamp && slide_end > stop_timestamp)
|
||||
split_slide = true
|
||||
deskshare_start = start_timestamp
|
||||
deskshare_stop = stop_timestamp
|
||||
orig_deskshare_start = ( start_timestamp_orig / 1000 ).round(1)
|
||||
orig_deskshare_stop = ( stop_timestamp_orig / 1000 ).round(1)
|
||||
deskshare_video_filename = "#{$deskshare_dir}/#{start_evt[:stream]}"
|
||||
deskshare_starts << start_timestamp
|
||||
deskshare_stops << stop_timestamp
|
||||
orig_deskshare_starts << ( start_timestamp_orig / 1000 ).round(1)
|
||||
orig_deskshare_stops << ( stop_timestamp_orig / 1000 ).round(1)
|
||||
deskshare_video_filenames << "#{$deskshare_dir}/#{start_evt[:stream]}"
|
||||
end
|
||||
end
|
||||
|
||||
if (split_slide)
|
||||
#Creating deskshare image (a transparent image with DS video resolution)
|
||||
$deskshare_page_count = $deskshare_page_count + 1
|
||||
deskshare_slide_src = "presentation/deskshare/slide-#{$deskshare_page_count}.png"
|
||||
deskshare_text = nil;
|
||||
deskshare_image_url = "#{$process_dir}/#{deskshare_slide_src}"
|
||||
FileUtils.mkdir_p("#{$process_dir}/presentation/deskshare")
|
||||
if (deskshare_starts.length > 0)
|
||||
FileUtils.mkdir_p("#{$process_dir}/presentation/deskshare")
|
||||
for i in 0..deskshare_starts.length-1
|
||||
#Creating deskshare image (a transparent image with DS video resolution)
|
||||
$deskshare_page_count = $deskshare_page_count + 1
|
||||
deskshare_slide_src = "presentation/deskshare/slide-#{$deskshare_page_count}.png"
|
||||
deskshare_text = nil;
|
||||
deskshare_image_url = "#{$process_dir}/#{deskshare_slide_src}"
|
||||
|
||||
BigBlueButton.logger.info("processSlideEvents - trying to open: #{deskshare_video_filename} to get its dimensions")
|
||||
if File.exist?(deskshare_video_filename)
|
||||
video_width = BigBlueButton.get_video_width(deskshare_video_filename)
|
||||
video_height = BigBlueButton.get_video_height(deskshare_video_filename)
|
||||
BigBlueButton.logger.info("processSlideEvents - video is #{video_width}x#{video_height}")
|
||||
command = "convert -size #{video_width}x#{video_height} xc:transparent -background transparent #{deskshare_image_url}"
|
||||
BigBlueButton.execute(command)
|
||||
BigBlueButton.logger.info("processSlideEvents - trying to open: #{deskshare_video_filenames[i]} to get its dimensions")
|
||||
if File.exist?(deskshare_video_filenames[i])
|
||||
video_width = BigBlueButton.get_video_width(deskshare_video_filenames[i])
|
||||
video_height = BigBlueButton.get_video_height(deskshare_video_filenames[i])
|
||||
BigBlueButton.logger.info("processSlideEvents - video is #{video_width}x#{video_height}")
|
||||
command = "convert -size #{video_width}x#{video_height} xc:transparent -background transparent #{deskshare_image_url}"
|
||||
BigBlueButton.execute(command)
|
||||
|
||||
deskshare_slide_size = FastImage.size(deskshare_image_url)
|
||||
deskshare_slide_size = FastImage.size(deskshare_image_url)
|
||||
|
||||
#Insert 3 slides:
|
||||
# 1. current slide with IN=slide_start and OUT=(deskshare_start-0.1)
|
||||
# 2. deskshare "slide" with IN=deskshare_start and OUT=deskshare_stop
|
||||
# 3. current slide (again) with IN=(deskshare_stop+0.1) and OUT=slide_end
|
||||
processSlideImage(slide_src, slide_size, slide_start, (deskshare_start-0.1), slide_text, orig_slide_start, (orig_deskshare_start-0.1))
|
||||
processSlideImage(deskshare_slide_src, deskshare_slide_size, deskshare_start, deskshare_stop, deskshare_text, orig_deskshare_start, orig_deskshare_stop)
|
||||
processSlideImage(slide_src, slide_size, (deskshare_stop+0.1), slide_end, slide_text, (orig_deskshare_stop+0.1), orig_slide_end)
|
||||
else
|
||||
BigBlueButton.logger.info("processSlideEvents - deskshare video file DOES NOT exist: #{deskshare_video_filename}")
|
||||
end
|
||||
if (i == 0)
|
||||
processSlideImage(slide_src, slide_size, slide_start, (deskshare_starts[0]-0.1), slide_text, orig_slide_start, (orig_deskshare_starts[0]-0.1))
|
||||
else
|
||||
processSlideImage(slide_src, slide_size, (deskshare_stops[i-1]+0.1), (deskshare_starts[i]-0.1), slide_text, (orig_deskshare_stops[i-1]+0.1), (orig_deskshare_starts[i]-0.1))
|
||||
end
|
||||
|
||||
#insert deskshare image
|
||||
processSlideImage(deskshare_slide_src, deskshare_slide_size, deskshare_starts[i], deskshare_stops[i], deskshare_text, orig_deskshare_starts[i], orig_deskshare_stops[i])
|
||||
|
||||
if (i == deskshare_starts.length-1)
|
||||
processSlideImage(slide_src, slide_size, (deskshare_stops[i]+0.1), slide_end, slide_text, (orig_deskshare_stops[i]+0.1), orig_slide_end)
|
||||
end
|
||||
|
||||
else
|
||||
BigBlueButton.logger.info("processSlideEvents - deskshare video file DOES NOT exist: #{deskshare_video_filename[i]}")
|
||||
end
|
||||
end
|
||||
else
|
||||
processSlideImage(slide_src, slide_size, slide_start, slide_end, slide_text, orig_slide_start, orig_slide_end)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user