2015-10-01 11:13:38 +00:00
|
|
|
/*\
|
|
|
|
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";
|
|
|
|
|
2016-12-22 22:07:28 +00:00
|
|
|
var VideoParser = function(type,text,options) {
|
2015-10-01 11:13:38 +00:00
|
|
|
var element = {
|
|
|
|
type: "element",
|
|
|
|
tag: "video",
|
|
|
|
attributes: {
|
2019-10-19 10:44:18 +00:00
|
|
|
controls: {type: "string", value: "controls"},
|
|
|
|
style: {type: "string", value: "width: 100%; object-fit: contain"}
|
2015-10-01 11:13:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
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];
|
|
|
|
};
|
|
|
|
|
2020-01-04 11:27:13 +00:00
|
|
|
exports["video/ogg"] = VideoParser;
|
|
|
|
exports["video/webm"] = VideoParser;
|
2016-12-22 22:07:28 +00:00
|
|
|
exports["video/mp4"] = VideoParser;
|
2016-12-23 08:34:07 +00:00
|
|
|
exports["video/quicktime"] = VideoParser;
|
2015-10-01 11:13:38 +00:00
|
|
|
|
|
|
|
})();
|