Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions www/opentok.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,25 +166,27 @@ var OTPublisherError, OTReplacePublisher, TBError, TBGenerateDomHelper, TBGetScr
streamElements = {};

getPosition = function(pubDiv) {
var computedStyle, curleft, curtop, height, width;
if (!pubDiv) {
return {};
}
computedStyle = window.getComputedStyle ? getComputedStyle(pubDiv, null) : {};
width = pubDiv.offsetWidth;
height = pubDiv.offsetHeight;
curtop = pubDiv.offsetTop;
curleft = pubDiv.offsetLeft;
while ((pubDiv = pubDiv.offsetParent)) {
curleft += pubDiv.offsetLeft;
curtop += pubDiv.offsetTop;
var boundingRects = pubDiv.getBoundingClientRect ? pubDiv.getBoundingClientRect().toJSON() : null;
if(boundingRects) {
// for browsers that do not support width and height
if(!boundingRects.width) {
boundingRects.width = (boundingRects.right - boundingRects.left);
}
if(!boundingRects.height) {
boundingRects.height = (boundingRects.bottom - boundingRects.top);
}
}
return {
top: curtop,
left: curleft,
width: width,
height: height
var position = {
width: pubDiv.offsetWidth,
height: pubDiv.offsetHeight,
top: pubDiv.offsetTop,
left: pubDiv.offsetLeft
};

return boundingRects || position;
};

replaceWithVideoStream = function(element, streamId, properties) {
Expand Down