|
@@ -68,6 +68,7 @@ export default {
|
|
|
closeCamera: function(newValue) {
|
|
|
if (newValue) {
|
|
|
console.log("关闭摄像头");
|
|
|
+ window.__stream = null;
|
|
|
if (this.$refs.video.srcObject) {
|
|
|
this.$refs.video.srcObject.getTracks().forEach(function(track) {
|
|
|
track.stop();
|
|
@@ -80,6 +81,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
async mounted() {
|
|
|
+ window.__stream = null;
|
|
|
this.openCamera();
|
|
|
|
|
|
this.checkFaceDetectorTimeout = setTimeout(() => {
|
|
@@ -90,6 +92,7 @@ export default {
|
|
|
clearTimeout(this.retrySnapTimeout);
|
|
|
clearTimeout(this.showSnapResultTimeout);
|
|
|
clearTimeout(this.checkFaceDetectorTimeout);
|
|
|
+ window.__stream = null;
|
|
|
if (this.$refs.video.srcObject) {
|
|
|
this.$refs.video.srcObject.getTracks().forEach(function(track) {
|
|
|
track.stop();
|
|
@@ -115,8 +118,8 @@ export default {
|
|
|
facingMode: "user",
|
|
|
aspectRatio: 4 / 3,
|
|
|
resizeMode: "crop-and-scale",
|
|
|
- width: 400,
|
|
|
- height: 300,
|
|
|
+ width: 640,
|
|
|
+ height: 480,
|
|
|
},
|
|
|
});
|
|
|
if (stream) {
|
|
@@ -127,6 +130,7 @@ export default {
|
|
|
getSettings: vt0.getSettings && vt0.getSettings(),
|
|
|
});
|
|
|
video.srcObject = stream;
|
|
|
+ window.__stream = stream;
|
|
|
try {
|
|
|
await video.play();
|
|
|
this.disableSnap = false;
|