Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Farirai's avatar

issue using feed from my esp32 cam in my laravel Controller and vew

so iwant to display real time video feed in my view but i see a photo and when i refresh see another photo but i want to see a video my controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use GuzzleHttp\Client;

class TrackingController extends Controller
{
    public function index()
    {
        $client = new Client();
        $url = 'http://192.168.137.204/cam-hi.jpg';

        $response = $client->request('GET', $url);
        $videoFeed = $response->getBody()->getContents();

        return view('tracking.index',
        [
            'videoFeed' => $videoFeed
        ]);
    }
}


my view

<x-layout>
    <div class="mt-5 grid grid-cols-3 gap-1">
        @for ($i = 1; $i <= 6; $i++)
            <div class="p-2 w-9/12 h-5/6">
                <h2 class="text-center font-bold text-lg">Camera {{ $i }}</h2>
                <img src="data:image/jpeg;base64,{{ base64_encode($videoFeed) }}" alt="Live Video Feed" class="rounded-lg mx-auto mt-2 max-w-full max-h-full">
            </div>
        @endfor
    </div>
</x-layout>



0 likes
2 replies
gych's avatar

Not that easy to achieve, search via google how to stream esp32 video to web server this will give you a lot of information.

I've seen someone store the images on an ftp server and then refresh it based on the amount of frames per second.

1 like
Snapey's avatar

You need to understand the basics of Http.

The client sends a request, the server prepares and sends back a response.

Thats it, the request is over.

What you need is the client to connect to a stream of data either direct from the camera or proxied through the server. Either way, delete the code you have, and start again.

1 like

Please or to participate in this conversation.