diff --git a/boot/boot.js b/boot/boot.js index 69901df5b..acdfa0327 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1835,6 +1835,7 @@ $tw.boot.startup = function(options) { $tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]}); $tw.utils.registerFileType("application/font-woff","base64",".woff"); $tw.utils.registerFileType("audio/ogg","base64",".ogg"); + $tw.utils.registerFileType("video/mp4","base64",".mp4"); $tw.utils.registerFileType("audio/mp3","base64",".mp3"); $tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]); $tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]); diff --git a/core/modules/parsers/videoparser.js b/core/modules/parsers/videoparser.js new file mode 100644 index 000000000..aaf3170c2 --- /dev/null +++ b/core/modules/parsers/videoparser.js @@ -0,0 +1,35 @@ +/*\ +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 AudioParser = function(type,text,options) { + var element = { + type: "element", + tag: "video", + attributes: { + controls: {type: "string", value: "controls"} + } + }, + 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]; +}; + +exports["video/mp4"] = AudioParser; + +})(); +