Skip to content

Commit

Permalink
Portait mode fixed and tested manually
Browse files Browse the repository at this point in the history
  • Loading branch information
golgetahir committed Feb 21, 2021
1 parent be91646 commit f4f393b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/webapp/js/stream_merger.js
Expand Up @@ -10,7 +10,7 @@ export class StreamMerger{
this.audioDestination = this.audioCtx.createMediaStreamDestination()
this.autoMode = autoMode;

//3:4 portrait mode stream width height
//4:3 portrait mode stream width height
this.pwidth = 0
this.pheight = 0

Expand Down Expand Up @@ -60,7 +60,7 @@ export class StreamMerger{
stream.Xindex = options.Xindex || 0;
stream.Yindex = options.Yindex || 0;
stream.portrait = false;
stream.aspectRatio = 16/9;
stream.aspectRatio = 4/3;

options.x == undefined ? stream.x = (stream.width * stream.Xindex): stream.x = options.x;
options.x == undefined ? stream.y = (stream.height * stream.Yindex): stream.y = options.y;
Expand Down Expand Up @@ -103,6 +103,7 @@ export class StreamMerger{
stream.x += xoffset;
stream.width = this.pwidth;
stream.height = this.pheight;
console.log("Location offset from metadata x = " + stream.x + " y = " + stream.y);
}
}
}
Expand Down Expand Up @@ -144,7 +145,7 @@ export class StreamMerger{
let cropWidth = 0;
let cropHeight = 0;
let topWidth = 0;
let bottomWidth = 0;

let remainingStreams = this.streams.length;

let widthOffset = 0;
Expand Down Expand Up @@ -218,8 +219,6 @@ export class StreamMerger{
tmp += (this.width) / (divider)
console.log("Video width = " + stream.width + "Video height = " + stream.height);



if(xindex == 0){
cropHeight = cropHeight + stream.height;
console.debug("CropHeight = " + cropHeight);
Expand All @@ -228,7 +227,7 @@ export class StreamMerger{
xindex ++;
if(yindex >= (yNumber)-1 && this.streams.length != 1){
console.log("TopWidth = " + topWidth + " remainingStreams = " + remainingStreams);
widthOffset = (topWidth - (stream.width * remainingStreams )) / 2;
widthOffset = (topWidth - (this.vwidth * remainingStreams )) / 2;
stream.x += widthOffset;
}

Expand All @@ -246,6 +245,7 @@ export class StreamMerger{

this.vwidth = (this.width) / (divider + 1);
this.vheight = (this.height) / (divider + 1);

if(stream.portrait == true){
stream.width = this.pwidth;
stream.height = this.pheight;
Expand Down Expand Up @@ -344,6 +344,7 @@ export class StreamMerger{
}
}
console.log("removed streamId = " + streamId);

if(this.autoMode == true){
this.resizeAndSortV2();
}
Expand Down

0 comments on commit f4f393b

Please sign in to comment.