Cant get video from Makie in Pluto

Hi. I was just messing around with makie in Pluto cause I’m trying to get familiar with the language and Pluto notebooks for a project I’m planning on doing on differential equations(namely the heat equation) and I was trying to run this code for the Makie website but i couldnt figure out how to get the video to actually run in Pluto. Any help for a noob like me would be much appreciated.

using GLMakie

Base.@kwdef mutable struct Lorenz
    dt::Float64 = 0.01
    σ::Float64 = 10
    ρ::Float64 = 28
    β::Float64 = 8/3
    x::Float64 = 1
    y::Float64 = 1
    z::Float64 = 1
end

function step!(l::Lorenz)
    dx = l.σ * (l.y - l.x)
    dy = l.x * (l.ρ - l.z) - l.y
    dz = l.x * l.y - l.β * l.z
    l.x += l.dt * dx
    l.y += l.dt * dy
    l.z += l.dt * dz
    Point3f(l.x, l.y, l.z)
end

attractor = Lorenz()

points = Observable(Point3f[])
colors = Observable(Int[])

set_theme!(theme_black())

fig, ax, l = lines(points, color = colors,
    colormap = :inferno, transparency = true,
    axis = (; type = Axis3, protrusions = (0, 0, 0, 0),
              viewmode = :fit, limits = (-30, 30, -30, 30, 0, 50)))

record(fig, "lorenz.mp4", 1:120) do frame
    for i in 1:50
        push!(points[], step!(attractor))
        push!(colors[], frame)
    end
    ax.azimuth[] = 1.7pi + 0.3 * sin(2pi * frame / 120)
    notify(points)
    notify(colors)
    l.colorrange = (0, frame)
end

Probably by using a <video> tag in some html code to include the locally saved file. Google should show some ways to output html in Pluto

Oh ok. What folder does pluto save the file in?

It’s Makie that saves it, not Pluto, and it’s relative to your current working directory. You can find that with pwd()

You should be able to use PlutoUI.LocalResource to view the .mp4 file inside the notebook.

For the path, it might help to first create a temporary path and store it:

path = tempname() * "_lorentz.mp4"
record(f, fig, path, 1:120)
PlutoUI.LocalResource(path)