Fixed broken audio/video elements - iameven.com
I discovered that the media elements on this site wasn't working and fixed that.
At some point I broke the markdown parsing for image files (probably changed parser?). To fix that I needed to
escape underscores (ie. sed 's/_/\\_/'
) as underscores are used to italicize
text in markdown. So I did a search and replace Sun Jan 20 17:44:05 2019 +0100
and
saved my changes. The problem with that was that I didn't need to escape the strings inside HTML, like
URI's to audio and video files. In fact I shouldn't have, because now my links there contained the
escape characters, linking to non-existent files. I just discovered that.
Posters
While I was doing that I also added posters to the video elements.
Poster being a place
holder image the browser can load inside the player while waiting for the download. To get a poster I found a
nifty ffmpeg command to grab the first frame from an mp4 file. The loop
will run through every path
find locates using the glob
*.mp4
.
#!/bin/bash
for file in $(find '_/' -name "*.mp4")
do
echo $file
ffmpeg -i $file -vf "scale=iw*sar:ih,setsar=1" -vframes 1 ${file%%.mp4}.png
done
Preload metadata
I had to look up the attribute for poster and discovered at the same time that
preload should be
changed as well. I had it set to none
but think
metadata
might be better as that does give some indication on load state as well as
how long the clip is.
The default value is different for each browser. The spec advises it to be set to
metadata
. ― mdn, <video>
Audio posts
Video posts
Auto formatting
I'm still having some trouble with this since prettier will sometimes
try to escape for me. Wondering if the overall solution is to not use any of markdown's special characters
in my filenames. I do however like using underscores to substitute space in links as the space escape character
looks horrible in URI's, like%20this
.