forked from External/greenlight
Merge pull request #22 from zach-chai/recording_previews
recording previews
This commit is contained in:
commit
595ff619c8
|
@ -88,16 +88,30 @@
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{ title: "Date Recorded", data: "start_time" },
|
{ title: "Date Recorded", data: "start_time" },
|
||||||
|
{ title: "Presentation", data: "previews"},
|
||||||
{ title: "Duration", data: "duration" },
|
{ title: "Duration", data: "duration" },
|
||||||
{ title: "Views", data: "playbacks" },
|
{ title: "Views", data: "playbacks" },
|
||||||
{ title: "Actions", data: "id" }
|
{ title: "Actions", data: "id" }
|
||||||
],
|
],
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{
|
{
|
||||||
targets: 2,
|
targets: 1,
|
||||||
render: function(data, type, row) {
|
render: function(data, type, row) {
|
||||||
if (type === 'display') {
|
if (type === 'display') {
|
||||||
var str = "";
|
var str = '';
|
||||||
|
for(let i in data) {
|
||||||
|
str += '<img height="50" width="50" src="'+data[i].url+'" alt="'+data[i].alt+'"></img> ';
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 3,
|
||||||
|
render: function(data, type, row) {
|
||||||
|
if (type === 'display') {
|
||||||
|
var str = '';
|
||||||
if (row.published) {
|
if (row.published) {
|
||||||
for(let i in data) {
|
for(let i in data) {
|
||||||
str += '<a href="'+data[i].url+'">'+data[i].type+'</a> ';
|
str += '<a href="'+data[i].url+'">'+data[i].type+'</a> ';
|
||||||
|
|
|
@ -75,7 +75,53 @@ module BbbApi
|
||||||
if meeting_id
|
if meeting_id
|
||||||
options[:meetingID] = (Digest::SHA1.hexdigest(Rails.application.secrets[:secret_key_base]+meeting_id)).to_s
|
options[:meetingID] = (Digest::SHA1.hexdigest(Rails.application.secrets[:secret_key_base]+meeting_id)).to_s
|
||||||
end
|
end
|
||||||
bbb_safe_execute :get_recordings, options
|
res = bbb_safe_execute :get_recordings, options
|
||||||
|
|
||||||
|
# ensure recordings is an array
|
||||||
|
if !res[:recordings]
|
||||||
|
res[:recordings] = []
|
||||||
|
elsif !res[:recordings].is_a? Array
|
||||||
|
res[:recordings] = [res[:recordings]]
|
||||||
|
end
|
||||||
|
|
||||||
|
res[:recordings].each do |recording|
|
||||||
|
pref_preview = {}
|
||||||
|
|
||||||
|
# create a playbacks attribute on recording for playback formats
|
||||||
|
recording[:playbacks] = if !recording[:playback] || !recording[:playback][:format]
|
||||||
|
[]
|
||||||
|
elsif recording[:playback][:format].is_a? Array
|
||||||
|
recording[:playback][:format]
|
||||||
|
else
|
||||||
|
[recording[:playback][:format]]
|
||||||
|
end
|
||||||
|
|
||||||
|
recording[:playbacks].each_with_index do |playback, index|
|
||||||
|
# create a previews attribute on playbacks for preview images
|
||||||
|
playback[:previews] = if !playback[:preview] || !playback[:preview][:images] || !playback[:preview][:images][:image]
|
||||||
|
[]
|
||||||
|
elsif playback[:preview][:images][:image].is_a? Array
|
||||||
|
playback[:preview][:images][:image]
|
||||||
|
else
|
||||||
|
[playback[:preview][:images][:image]]
|
||||||
|
end
|
||||||
|
if playback[:type] == 'presentation' && playback[:previews].present?
|
||||||
|
pref_preview[:presentation] = index
|
||||||
|
elsif playback[:previews].present? && pref_preview[:other].blank?
|
||||||
|
pref_preview[:other] = index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# create a previews attribute on recordings for preview images
|
||||||
|
recording[:previews] = if pref_preview[:presentation]
|
||||||
|
recording[:playbacks][pref_preview[:presentation]][:previews]
|
||||||
|
elsif pref_preview[:other]
|
||||||
|
recording[:playbacks][pref_preview[:other]][:previews]
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
res
|
||||||
end
|
end
|
||||||
|
|
||||||
def bbb_update_recordings(id, published)
|
def bbb_update_recordings(id, published)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
json.url preview[:content]
|
||||||
|
json.width preview[:width]
|
||||||
|
json.height preview[:height]
|
||||||
|
json.alt preview[:alt]
|
|
@ -2,22 +2,26 @@ json.partial! 'bbb', messageKey: @messageKey, message: @message, status: @status
|
||||||
unless @response.blank?
|
unless @response.blank?
|
||||||
json.is_owner current_user == @user
|
json.is_owner current_user == @user
|
||||||
json.recordings do
|
json.recordings do
|
||||||
unless @response.is_a? Array
|
|
||||||
@response = [@response]
|
|
||||||
end
|
|
||||||
json.array!(@response) do |recording|
|
json.array!(@response) do |recording|
|
||||||
json.id recording[:recordID]
|
json.id recording[:recordID]
|
||||||
json.name recording[:name]
|
json.name recording[:name]
|
||||||
json.start_time recording[:startTime]
|
json.start_time recording[:startTime]
|
||||||
json.end_time recording[:endTime]
|
json.end_time recording[:endTime]
|
||||||
json.published recording[:published]
|
json.published recording[:published]
|
||||||
json.playbacks do
|
json.previews do
|
||||||
unless recording[:playback][:format].is_a? Array
|
json.array!(recording[:previews]) do |preview|
|
||||||
recording[:playback][:format] = [recording[:playback][:format]]
|
json.partial! 'preview', preview: preview
|
||||||
end
|
end
|
||||||
json.array!(recording[:playback][:format]) do |playback|
|
end
|
||||||
|
json.playbacks do
|
||||||
|
json.array!(recording[:playbacks]) do |playback|
|
||||||
json.type playback[:type]
|
json.type playback[:type]
|
||||||
json.url playback[:url]
|
json.url playback[:url]
|
||||||
|
json.previews do
|
||||||
|
json.array!(playback[:previews]) do |preview|
|
||||||
|
json.partial! 'preview', preview: preview
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue