Skip to content

Commit 03ef149

Browse files
authored
Merge pull request #6 from seanmtracey/camera-origin
Make the camera work across origins
2 parents 424b59f + c1ac634 commit 03ef149

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

component-scripts/camera.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
const videoStop = videoControls.querySelector('#stopCapture');
176176

177177
let captureType = domNode.getAttribute('data-nr-type') || 'still';
178+
const instanceOrigin = domNode.getAttribute('data-nr-origin')|| window.location.origin;
178179

179180
if(validCaptureTypes.indexOf(captureType) === -1){
180181
captureType = 'still';
@@ -210,8 +211,8 @@
210211
body : data
211212
};
212213

213-
console.log(`${window.location.origin}/nr-component-camera/${domNode.getAttribute('data-nr-name')}?type=${type}`);
214-
return fetch(`${window.location.origin}/nr-component-camera/${domNode.getAttribute('data-nr-name')}?type=${type}`, options)
214+
console.log(`${instanceOrigin}/nr-component-camera/${domNode.getAttribute('data-nr-name')}?type=${type}`);
215+
return fetch(`${instanceOrigin}/nr-component-camera/${domNode.getAttribute('data-nr-name')}?type=${type}`, options)
215216
.then(res => {
216217

217218
if(res.ok){

0 commit comments

Comments
 (0)