Closed lightnin closed 1 year ago
It looks like the following bit of code could be used to give the video the proper video tag, instead of tagging it as an image which is what happens now, causing the video to fail to load.
import magic
mime = magic.Magic(mime=True)
filename = mime.from_file(path_to_video)
if filename.find('video') != -1:
print('it is video')
From: https://stackoverflow.com/questions/14919609/how-to-check-if-a-file-is-a-video
I ain't rich but I'd be happy to pay a 50 Euro bounty for a fix for this and #101, which would allow me to make the archive I need so badly for my PhD thesis. :)
Try 1deb199 and let me know if it works for you? I personally don't archive media so I had to fiddle with my test JSON file by hand.
Fantastic! Yes that works for the video. :) The other issue with the images is still there of course. This is outside of the scope of the bounty I offered, but I'm wondering if the browser will lazy load the videos automatically? The reason is that I'd like to host this as a static webpage on my site, but if it has to load 3 GB worth of video before the page is ready, it's gonna be rather slooow. Perhaps I'll test this tomorrow by putting up the html page on a test site. But either way - thanks! It's looking much better now.
I don't see anything I could add for lazy loading, based on https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video … but if you know what to do, leave a comment and we'll figure it out.
Hm, maybe try adding preload="none"
to the video_template
on https://github.com/kensanata/mastodon-archive/blob/main/mastodon_archive/html.py#L223 ? I'm not quite sure. If you have a lot of videos, you're in a better position to test this.
When videos are included in posts they appear with a broken image icon in HTML exports.
Clicking the icon loads the video correctly - but no preview is shown (as it is when viewing a normal mastodon timeline.)
The generated HTML appears to link the video with an img tag instead of a video tag.
Here's a link to the same post live on my Pleroma instance: https://masto.amosamos.net/notice/AUs5GPCBAvYeZdrS8u
In my view videos in the exported HTML archive should look about like they do there, or on a normal Mastodon timeline - a preview with a play button.
(I made my export from Pleroma, but I'm assuming that this issue would affect Mastodon exports as well.)