CB-10113 Browser - Layer camera UI on top of all!
Adds CSS style {position: 'relative', z-index: 2147483647} (2147483647 is the highest possible z-index) on DOM appended elements. This closes #134
This commit is contained in:
parent
e48a7e5c5c
commit
5b38453262
@ -19,11 +19,15 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var HIGHEST_POSSIBLE_Z_INDEX = 2147483647;
|
||||||
|
|
||||||
function takePicture(success, error, opts) {
|
function takePicture(success, error, opts) {
|
||||||
if (opts && opts[2] === 1) {
|
if (opts && opts[2] === 1) {
|
||||||
capture(success, error);
|
capture(success, error);
|
||||||
} else {
|
} else {
|
||||||
var input = document.createElement('input');
|
var input = document.createElement('input');
|
||||||
|
input.style.position = 'relative';
|
||||||
|
input.style.zIndex = HIGHEST_POSSIBLE_Z_INDEX;
|
||||||
input.type = 'file';
|
input.type = 'file';
|
||||||
input.name = 'files[]';
|
input.name = 'files[]';
|
||||||
|
|
||||||
@ -51,6 +55,11 @@ function capture(success, errorCallback) {
|
|||||||
|
|
||||||
var video = document.createElement('video');
|
var video = document.createElement('video');
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button');
|
||||||
|
var parent = document.createElement('div');
|
||||||
|
parent.style.position = 'relative';
|
||||||
|
parent.style.zIndex = HIGHEST_POSSIBLE_Z_INDEX;
|
||||||
|
parent.appendChild(video);
|
||||||
|
parent.appendChild(button);
|
||||||
|
|
||||||
video.width = 320;
|
video.width = 320;
|
||||||
video.height = 240;
|
video.height = 240;
|
||||||
@ -74,8 +83,7 @@ function capture(success, errorCallback) {
|
|||||||
track.stop();
|
track.stop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
video.parentNode.removeChild(video);
|
parent.parentNode.removeChild(parent);
|
||||||
button.parentNode.removeChild(button);
|
|
||||||
|
|
||||||
return success(imageData);
|
return success(imageData);
|
||||||
};
|
};
|
||||||
@ -90,8 +98,7 @@ function capture(success, errorCallback) {
|
|||||||
video.src = window.URL.createObjectURL(localMediaStream);
|
video.src = window.URL.createObjectURL(localMediaStream);
|
||||||
video.play();
|
video.play();
|
||||||
|
|
||||||
document.body.appendChild(video);
|
document.body.appendChild(parent);
|
||||||
document.body.appendChild(button);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (navigator.getUserMedia) {
|
if (navigator.getUserMedia) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user