解决ios无法识别问题

This commit is contained in:
rucky 2021-12-28 18:20:39 +08:00
parent fb1d34bcf4
commit 5a4a777d03

View File

@ -260,12 +260,16 @@ export default {
const videoTracks = stream.getVideoTracks(); const videoTracks = stream.getVideoTracks();
this.stream = stream; // make variable available to browser console this.stream = stream; // make variable available to browser console
let streamSize = this.GetStreamDimensions(stream); let streamSize = this.GetStreamDimensions(stream);
// let handledSize = this.ScaleResolutionToHeight(
// streamSize,
// window.innerHeight
// );
// this.videoRealSize = handledSize; //
this.responseVideoAndCanvas();
let handledSize = this.ScaleResolutionToWidth(
{ width: this.video.width, height: this.video.height },
window.innerWidth
);
this.videoRealSize = handledSize;
console.log("Got stream with constraints:", constraints); console.log("Got stream with constraints:", constraints);
console.log(`Using video device: ${videoTracks[0].label}`); console.log(`Using video device: ${videoTracks[0].label}`);
@ -277,10 +281,9 @@ export default {
// handledSize // handledSize
); );
// this.responseVideoAndCanvas(handledSize);
this.video.srcObject = stream; this.video.srcObject = stream;
// this.video.play(); this.video.play();
// //
this.startDraw(); this.startDraw();
@ -291,13 +294,12 @@ export default {
}, },
// //
responseVideoAndCanvas(size) { responseVideoAndCanvas(size) {
this.video.width = size.width; this.video.width = window.innerWidth;
this.video.height = size.height; this.video.height = window.innerHeight;
// init canvcas // init canvcas
this.ctx = this.canvas.getContext("2d"); this.ctx = this.canvas.getContext("2d");
this.canvas.width = size.width; this.canvas.width = window.innerWidth;
this.canvas.height = size.height; this.canvas.height = window.innerHeight;
}, },
// stream // stream
GetStreamDimensions(stream) { GetStreamDimensions(stream) {
@ -540,8 +542,8 @@ export default {
align-content: center; align-content: center;
align-items: center; align-items: center;
.video { .video {
// .paLayout(50%,50%,auto,100%,0); .paLayout(50%,50%,auto,100%,0);
// transform: translate(-50%, -50%); transform: translate(-50%, -50%);
// transform: scaleX(-1); // transform: scaleX(-1);
// width: 750px; // width: 750px;
display: none; display: none;