mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1116856 - rely on dynamically resizing tab mirror video stream based on window size r=mfinkle
This commit is contained in:
parent
c7b46e4d82
commit
d03ef1cae5
@ -41,30 +41,16 @@ TabMirror.prototype = {
|
||||
this._pc.onicecandidate = this._onIceCandidate.bind(this);
|
||||
|
||||
let windowId = this._window.BrowserApp.selectedBrowser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
let viewport = this._window.BrowserApp.selectedTab.getViewport();
|
||||
let maxWidth = Math.max(viewport.cssWidth, viewport.width);
|
||||
let maxHeight = Math.max(viewport.cssHeight, viewport.height);
|
||||
|
||||
let videoWidth = 0;
|
||||
let videoHeight = 0;
|
||||
if (this._screenSize.width/this._screenSize.height < maxWidth / maxHeight) {
|
||||
videoWidth = this._screenSize.width;
|
||||
videoHeight = Math.ceil(videoWidth * maxHeight / maxWidth);
|
||||
} else {
|
||||
videoHeight = this._screenSize.height;
|
||||
videoWidth = Math.ceil(videoHeight * maxWidth / maxHeight);
|
||||
}
|
||||
|
||||
let constraints = {
|
||||
video: {
|
||||
mediaSource: "browser",
|
||||
browserWindow: windowId,
|
||||
scrollWithPage: true,
|
||||
advanced: [
|
||||
{ width: { min: videoWidth, max: videoWidth },
|
||||
height: { min: videoHeight, max: videoHeight }
|
||||
{ width: { min: 0, max: this._screenSize.width },
|
||||
height: { min: 0, max: this._screenSize.height }
|
||||
},
|
||||
{ aspectRatio: maxWidth / maxHeight }
|
||||
{ aspectRatio: this._screenSize.width / this._screenSize.height }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
@ -288,24 +288,9 @@ function RemoteMirror(url, win, viewport, mirrorStartedCallback, contentWindow)
|
||||
// This code insures the generated tab mirror is not wider than 1280 nor taller than 720
|
||||
// Better dimensions should be chosen after the Roku Channel is working.
|
||||
let windowId = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
let cWidth = Math.max(viewport.cssWidth, viewport.width);
|
||||
let cHeight = Math.max(viewport.cssHeight, viewport.height);
|
||||
|
||||
const MAX_WIDTH = 1280;
|
||||
const MAX_HEIGHT = 720;
|
||||
|
||||
let tWidth = 0;
|
||||
let tHeight = 0;
|
||||
|
||||
// division and multiplication by 4 to ensure dimensions are multiples of 4
|
||||
if ((cWidth / MAX_WIDTH) > (cHeight / MAX_HEIGHT)) {
|
||||
tHeight = Math.ceil((MAX_WIDTH / (4* cWidth)) * cHeight) * 4;
|
||||
tWidth = MAX_WIDTH;
|
||||
} else {
|
||||
tWidth = Math.ceil((MAX_HEIGHT / (4 * cHeight)) * cWidth) * 4;
|
||||
tHeight = MAX_HEIGHT;
|
||||
}
|
||||
|
||||
let constraints = {
|
||||
video: {
|
||||
mediaSource: "browser",
|
||||
@ -313,10 +298,10 @@ function RemoteMirror(url, win, viewport, mirrorStartedCallback, contentWindow)
|
||||
scrollWithPage: true,
|
||||
advanced: [
|
||||
{
|
||||
width: { min: tWidth, max: tWidth },
|
||||
height: { min: tHeight, max: tHeight }
|
||||
width: { min: 0, max: MAX_WIDTH },
|
||||
height: { min: 0, max: MAX_HEIGHT }
|
||||
},
|
||||
{ aspectRatio: cWidth / cHeight }
|
||||
{ aspectRatio: MAX_WIDTH/MAX_HEIGHT }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user