webcam getCapabilities not supported on firefox

This commit is contained in:
j3d1 2024-02-29 22:50:29 +01:00
parent c7c91f87ba
commit 751f3deaab

View file

@ -6,7 +6,8 @@
<div class="modal" :class="{'d-block': show_modal}" tabindex="-1">
<div class="modal-dialog modal-fullscreen">
<div class="modal-content p-2">
<button type="button" class="btn-close position-absolute fixed-top m-2" style="right: 1rem; left: auto;"
<button type="button" class="btn-close position-absolute fixed-top m-2"
style="right: 1rem; left: auto;"
@click="close"></button>
<div v-if="error" class="alert alert-danger" role="alert">
{{ lastError }}
@ -100,12 +101,16 @@ export default {
if (this.stream) this.allowed = true;
},
async assignStream() {
console.log(this.stream.getTracks()[0]);
const track = this.stream.getTracks()[0];
if (track.getCapabilities) {
const capabilities = this.stream.getTracks()[0].getCapabilities();
await this.attemptGetUserMedia({
deviceId: capabilities.deviceId,
width: {exact: capabilities.width.max},
height: {exact: capabilities.height.max}
})
width: {ideal: capabilities.width.max},
height: {ideal: capabilities.height.max}
});
}
this.capturing = true;
this.streaming = false;
const {video} = this.$refs;