HTML5 Video Plugin

Adds support for embedding video
This commit is contained in:
Jiiks 2016-03-29 02:34:46 +03:00
parent 35ff38638c
commit 31fc14aa5c
1 changed files with 49 additions and 0 deletions

49
Plugins/videoSupport.js Normal file
View File

@ -0,0 +1,49 @@
//META{"name":"videoSupport"}*//
var videoSupport = function () {};
videoSupport.prototype.convert = function () {
$(".message-group a").each(function() {
var t = $(this);
var href = t.attr("href");
if(href == undefined) return true;
if(!href.endsWith(".mp4") && !href.endsWith(".webm")) return true;
var type = "webm";
if(href.endsWith(".mp4")) type = "mp4";
if(href.endsWith(".ogg")) type = "ogg";
t.replaceWith( '<video width="480" height="320" controls>' +
'<source src="'+href+'" type="video/'+type+'">' +
'</video>');
});
};
videoSupport.prototype.onMessage = function () {
this.convert();
};
videoSupport.prototype.onSwitch = function () {
this.convert();
};
videoSupport.prototype.start = function () {
this.convert();
};
videoSupport.prototype.load = function () {};
videoSupport.prototype.unload = function () {};
videoSupport.prototype.stop = function () {};
videoSupport.prototype.getSettingsPanel = function () {
return "";
};
videoSupport.prototype.getName = function () {
return "Video Support";
};
videoSupport.prototype.getDescription = function () {
return "Add support for html5 video";
};
videoSupport.prototype.getVersion = function () {
return "0.1.0";
};
videoSupport.prototype.getAuthor = function () {
return "Jiiks";
};