Ok, here’s a slightly little less ugly hack
Override the core tiddler $:/core/modules/parsers/videoparser.js
by creating a copy
In the text field add
/*\
title: $:/core/modules/parsers/videoparser.js
type: application/javascript
module-type: parser
The video parser parses a video tiddler into an embeddable HTML element
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var VideoParser = function(type,text,options) {
var element = {
type: "element",
tag: "video",
attributes: {
autoplay: {type: "string", value: ""},
loop: {type: "string", value: ""},
style: {type: "string", value: "width: 100%; object-fit: contain"}
}
},
src;
if(options._canonical_uri) {
element.attributes.src = {type: "string", value: options._canonical_uri};
} else if(text) {
element.attributes.src = {type: "string", value: "data:" + type + ";base64," + text};
}
this.tree = [element];
this.source = text;
this.type = type;
};
exports["video/ogg"] = VideoParser;
exports["video/webm"] = VideoParser;
exports["video/mp4"] = VideoParser;
exports["video/quicktime"] = VideoParser;
})();
The key here is adding autoplay: {type: "string", value: ""},
and loop: {type: "string", value: ""},
inside the attributes:
list, and removing the default controls: {type: "string", value: "controls"},
. Adapt to your own personal requirements.
Disadvantages
- Modifying core system tiddlers
- Changes are global, all video tiddlers will behave as defined here
Advantages
- No copying of huge base64 strings
- Can still download binary data regularly
Note: For this to work you have to save your wiki and reload.