2024-02-23 03:42:11 -08:00
|
|
|
<script>
|
|
|
|
export default {
|
2024-03-30 22:24:23 -07:00
|
|
|
props: ['cameraID'],
|
2024-02-23 03:42:11 -08:00
|
|
|
data() {
|
|
|
|
return {
|
2024-04-12 22:39:45 -07:00
|
|
|
localIp: 'http://172.20.10.8', //maybe change accordingly .env?
|
2024-03-03 00:12:50 -08:00
|
|
|
port: '5000', //maybe change accordingly
|
|
|
|
cameraUrls: {
|
|
|
|
1: 'video_feed', //cam url here
|
|
|
|
2: 'video_feed2',
|
|
|
|
|
|
|
|
}
|
2024-02-23 03:42:11 -08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2024-03-03 00:12:50 -08:00
|
|
|
// this.initCam();
|
2024-02-23 03:42:11 -08:00
|
|
|
},
|
|
|
|
methods: {
|
2024-03-03 00:12:50 -08:00
|
|
|
// async initCam() {
|
|
|
|
// try {
|
|
|
|
// const constraints = { video: true };
|
|
|
|
// const stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
|
|
// this.streams.push(stream);
|
|
|
|
// } catch (error) {
|
|
|
|
// console.error('Error accessing camera:', error);
|
|
|
|
// }
|
|
|
|
// },
|
2024-03-30 22:24:23 -07:00
|
|
|
getCameraImageUrl(cameraID) {
|
|
|
|
return `${this.localIp}:${this.port}/${this.cameraUrls[cameraID]}`;
|
2024-02-23 03:42:11 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div class="box video-section">
|
2024-03-30 22:24:23 -07:00
|
|
|
<img :src="getCameraImageUrl(cameraID)" class="video-image">
|
2024-02-23 03:42:11 -08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<style scoped>
|
2024-03-03 00:43:12 -08:00
|
|
|
/* .app {
|
2024-02-23 03:42:11 -08:00
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
height: 100vh;
|
2024-03-03 00:43:12 -08:00
|
|
|
} */
|
2024-02-23 03:42:11 -08:00
|
|
|
|
|
|
|
.video-section {
|
2024-03-03 00:12:50 -08:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2024-02-23 03:42:11 -08:00
|
|
|
box-sizing: border-box;
|
2024-03-03 00:12:50 -08:00
|
|
|
border: 2px solid #ccc;
|
2024-02-23 03:42:11 -08:00
|
|
|
}
|
|
|
|
|
2024-03-03 00:43:12 -08:00
|
|
|
.video-image {
|
2024-02-23 03:42:11 -08:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2024-03-03 00:43:12 -08:00
|
|
|
/* object-fit: contain; */
|
2024-02-23 03:42:11 -08:00
|
|
|
}
|
|
|
|
.box{
|
2024-03-03 00:12:50 -08:00
|
|
|
border: 2px solid #030303;
|
2024-02-23 03:42:11 -08:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|