Video/mp4 in IJulia

I can embed a gif in an IJulia notebook with display(MIME"image/png"(), read(open(filename))). Is there a reason why display(MIME"video/mp4"(), read(open(filename))) does not work? It simply does nothing.

Ijulia seems to have a list of available MIME types for display, mp4 is not on it
https://github.com/JuliaLang/IJulia.jl/blob/master/src/execute_request.jl#L9#L18

You could create your own display method that launches vlc media player or another media player. I think they also have web-browser plugins, so maybe that can be used.

I used this once in some old code:

function display_mp4(filename)
    display("text/html", string("""<video autoplay controls><source src="data:video/x-m4v;base64,""",
    base64encode(open(read,filename)),"""" type="video/mp4"></video>"""))
end

Googling part of the code leads me to https://github.com/JuliaLang/IJulia.jl/issues/107, which is probably where I got it from.

5 Likes