|
|
@ -42,7 +42,7 @@ define(["jquery", "underscore"], function($, _) { |
|
|
|
// videoLayout
|
|
|
|
// videoLayout
|
|
|
|
return ["$window", function($window) { |
|
|
|
return ["$window", function($window) { |
|
|
|
|
|
|
|
|
|
|
|
// Video layout with all persons rendered the same size.
|
|
|
|
// Video layout with all videos rendered the same size.
|
|
|
|
var OnePeople = function(container, scope, controller) { |
|
|
|
var OnePeople = function(container, scope, controller) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -59,15 +59,6 @@ define(["jquery", "underscore"], function($, _) { |
|
|
|
|
|
|
|
|
|
|
|
if (videos.length) { |
|
|
|
if (videos.length) { |
|
|
|
var remoteSize = getRemoteVideoSize(videos, peers); |
|
|
|
var remoteSize = getRemoteVideoSize(videos, peers); |
|
|
|
/*if (videos.length === 1) { |
|
|
|
|
|
|
|
var remoteVideo = peers[videos[0]].element.find("video").get(0); |
|
|
|
|
|
|
|
videoWidth = remoteVideo.videoWidth; |
|
|
|
|
|
|
|
videoHeight = remoteVideo.videoHeight; |
|
|
|
|
|
|
|
console.log("Remote video size: ", videoWidth, videoHeight); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
videoWidth = 1920; |
|
|
|
|
|
|
|
videoHeight = 1080; |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
videoWidth = remoteSize.width; |
|
|
|
videoWidth = remoteSize.width; |
|
|
|
videoHeight = remoteSize.height; |
|
|
|
videoHeight = remoteSize.height; |
|
|
|
} |
|
|
|
} |
|
|
@ -94,8 +85,8 @@ define(["jquery", "underscore"], function($, _) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var aspectRatio = videoWidth/videoHeight; |
|
|
|
var aspectRatio = videoWidth/videoHeight; |
|
|
|
var innerHeight = size.height; //scope.layoutparent.height();
|
|
|
|
var innerHeight = size.height; |
|
|
|
var innerWidth = size.width; //scope.layoutparent.width();
|
|
|
|
var innerWidth = size.width; |
|
|
|
|
|
|
|
|
|
|
|
//console.log("resize", innerHeight, innerWidth);
|
|
|
|
//console.log("resize", innerHeight, innerWidth);
|
|
|
|
//console.log("resize", container, videos.length, aspectRatio, innerHeight, innerWidth);
|
|
|
|
//console.log("resize", container, videos.length, aspectRatio, innerHeight, innerWidth);
|
|
|
@ -155,6 +146,17 @@ define(["jquery", "underscore"], function($, _) { |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Smally inherits from OnePeople
|
|
|
|
|
|
|
|
var Smally = function(container, scope, controller) { |
|
|
|
|
|
|
|
// Call super.
|
|
|
|
|
|
|
|
OnePeople.call(this, container, scope, controller); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Smally.prototype = Object.create(OnePeople.prototype); |
|
|
|
|
|
|
|
Smally.prototype.constructor = Smally; |
|
|
|
|
|
|
|
Smally.prototype.name = "smally"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// A view with one selectable large video. The others are small.
|
|
|
|
var ConferenceKiosk = function(container, scope, controller) { |
|
|
|
var ConferenceKiosk = function(container, scope, controller) { |
|
|
|
|
|
|
|
|
|
|
|
this.remoteVideos = $(container).find("#remoteVideos"); |
|
|
|
this.remoteVideos = $(container).find("#remoteVideos"); |
|
|
@ -228,10 +230,13 @@ define(["jquery", "underscore"], function($, _) { |
|
|
|
this.remoteVideos = null; |
|
|
|
this.remoteVideos = null; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Register renderers.
|
|
|
|
// Register renderers.
|
|
|
|
renderers[OnePeople.prototype.name] = OnePeople; |
|
|
|
renderers[OnePeople.prototype.name] = OnePeople; |
|
|
|
|
|
|
|
renderers[Smally.prototype.name] = Smally; |
|
|
|
renderers[ConferenceKiosk.prototype.name] = ConferenceKiosk; |
|
|
|
renderers[ConferenceKiosk.prototype.name] = ConferenceKiosk; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Public api.
|
|
|
|
// Public api.
|
|
|
|
var current = null; |
|
|
|
var current = null; |
|
|
|
return { |
|
|
|
return { |
|
|
@ -240,23 +245,26 @@ define(["jquery", "underscore"], function($, _) { |
|
|
|
var videos = _.keys(controller.peers); |
|
|
|
var videos = _.keys(controller.peers); |
|
|
|
var peers = controller.peers; |
|
|
|
var peers = controller.peers; |
|
|
|
var container = scope.container; |
|
|
|
var container = scope.container; |
|
|
|
|
|
|
|
var layoutparent = scope.layoutparent; |
|
|
|
|
|
|
|
|
|
|
|
if (!current) { |
|
|
|
if (!current) { |
|
|
|
current = new renderers[name](container, scope, controller) |
|
|
|
current = new renderers[name](container, scope, controller) |
|
|
|
console.log("Created new video layout renderer", name, current); |
|
|
|
console.log("Created new video layout renderer", name, current); |
|
|
|
$(container).addClass("renderer-"+name); |
|
|
|
$(layoutparent).addClass("renderer-"+name); |
|
|
|
|
|
|
|
return true; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (current.name !== name) { |
|
|
|
if (current.name !== name) { |
|
|
|
current.close(container, scope, controller); |
|
|
|
current.close(container, scope, controller); |
|
|
|
$(container).removeAttr("style"); |
|
|
|
$(container).removeAttr("style"); |
|
|
|
$(container).removeClass("renderer-"+current.name); |
|
|
|
$(layoutparent).removeClass("renderer-"+current.name); |
|
|
|
current = new renderers[name](container, scope, conroller) |
|
|
|
current = new renderers[name](container, scope, controller) |
|
|
|
$(container).addClass("renderer-"+name); |
|
|
|
$(layoutparent).addClass("renderer-"+name); |
|
|
|
console.log("Switched to new video layout renderer", name, current); |
|
|
|
console.log("Switched to new video layout renderer", name, current); |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
current.render(container, size, scope, videos, peers); |
|
|
|
return current.render(container, size, scope, videos, peers); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
register: function(name, impl) { |
|
|
|
register: function(name, impl) { |
|
|
|