defmodule AugieWeb.CameraLive do
use Phoenix.LiveView
@moduledoc """
A Liveview which streams images from the raspberry pi camera.
"""
def render(assigns) do
~L"""
Camera
"""
end
def mount(_params, _context, socket) do
socket =
if connected?(socket) do
assign(socket, img_src: "/camera/stream")
else
assign(socket, img_src: "/camera/static")
end
{:ok, socket}
end
end