Files
Rover-Project/static/js/script.js
2024-03-03 09:11:10 -06:00

18 lines
863 B
JavaScript

// Function to fetch and display webcam feed
function displayWebcamFeed() {
// Endpoint URL for fetching webcam feed
const webcamFeedUrl = ' http://192.168.86.23:8080/html/cam_pic_new.php?time=1709478595111&pDelay=40000'; // Replace with your actual RPI cam server address and port
// Select the div where you want to display the webcam feed
const webcamFeedDiv = document.getElementById('camera-feed');
// Create a new HTML <img> element to display the webcam feed
const webcamImage = document.createElement('img');
// Set attributes for the image element
webcamImage.src = webcamFeedUrl; // Set the source of the image to the webcam feed URL
webcamImage.alt = 'Webcam Feed'; // Provide an alt attribute for accessibility
// Append the image element to the webcam feed div
webcamFeedDiv.appendChild(webcamImage);
}