修正授权部分

This commit is contained in:
rucky 2021-12-29 18:28:44 +08:00
parent 74249abc2e
commit 1ae69bd972

View File

@ -192,10 +192,29 @@ export default {
.getUserMedia(constraints) .getUserMedia(constraints)
.then((stream) => { .then((stream) => {
if (stream) { if (stream) {
const tracks = stream.getTracks(); if (typeof stream.stop === "function") {
tracks.forEach(function (track) { stream.stop();
track.stop(); } else {
}); let trackList = [
stream.getAudioTracks(),
stream.getVideoTracks(),
];
for (let i = 0; i < trackList.length; i++) {
let tracks = trackList[i];
if (tracks && tracks.length > 0) {
for (let j = 0; j < tracks.length; j++) {
let track = tracks[j];
if (typeof track.stop === "function") {
track.stop();
}
}
}
}
}
// const tracks = stream.getTracks();
// tracks.forEach(function (track) {
// track.stop();
// });
// stopStreamTracks(stream); // stopStreamTracks(stream);
return true; return true;
@ -686,6 +705,7 @@ export default {
}, },
// //
updatePosition(x, y, scale) { updatePosition(x, y, scale) {
if (!this.renderer_) return;
gsap.to(this.renderer_.domElement, { autoAlpha: 1 }); gsap.to(this.renderer_.domElement, { autoAlpha: 1 });
if (this.mesh_) { if (this.mesh_) {
@ -713,6 +733,7 @@ export default {
}, },
// hide all // hide all
hideAll() { hideAll() {
if (!this.renderer_) return;
gsap.to(this.renderer_.domElement, { autoAlpha: 0 }); gsap.to(this.renderer_.domElement, { autoAlpha: 0 });
}, },
animate() { animate() {
@ -721,6 +742,7 @@ export default {
}, },
// THREE canvas render // THREE canvas render
Render() { Render() {
if (!this.renderer_) return;
this.stats.update(); this.stats.update();
this.renderer_.render(this.scene_, this.camera_); this.renderer_.render(this.scene_, this.camera_);
if (this.lineBox) { if (this.lineBox) {