1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-04-22 14:51:31 +00:00
Files
TiddlyWiki5/core/modules/parsers/videoparser.js
Jeremy Ruston d8b0e041b6 Initial commit
2026-02-19 12:45:27 +00:00

33 lines
812 B
JavaScript

/*\
title: $:/core/modules/parsers/videoparser.js
type: application/javascript
module-type: parser
\*/
"use strict";
var VideoParser = function(type,text,options) {
var element = {
type: "element",
tag: "video",
attributes: {
controls: {type: "string", value: "controls"},
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;