diff --git a/channel.js b/channel.js index 14a52098..90f886f6 100644 --- a/channel.js +++ b/channel.js @@ -56,6 +56,7 @@ var Channel = function(name, Server) { playlistdelete: 2, playlistjump: 1.5, playlistaddlist: 1.5, + playlistaddcustom: 3, playlistaddlive: 1.5, exceedmaxlength: 2, addnontemp: 2, @@ -1026,7 +1027,8 @@ function isLive(type) { || type == "rt" // RTMP || type == "jw" // JWPlayer || type == "us" // Ustream.tv - || type == "im";// Imgur album + || type == "im" // Imgur album + || type == "cu";// Custom Embed } Channel.prototype.queueAdd = function(item, after) { @@ -1092,6 +1094,10 @@ Channel.prototype.addMedia = function(data, user) { user.socket.emit("queueFail", "You don't have permission to add playlists"); return; } + if(data.type === "cu" && !this.hasPermission(user, "playlistaddcustom")) { + user.socket.emit("queueFail", "You don't have permission to add cusstom embeds"); + return; + } data.temp = isLive(data.type) || !this.hasPermission(user, "addnontemp"); data.maxlength = this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength; var chan = this; diff --git a/get-info.js b/get-info.js index 8e914a8b..4d6f5bbd 100644 --- a/get-info.js +++ b/get-info.js @@ -13,6 +13,7 @@ var http = require("http"); var https = require("https"); var Logger = require("./logger.js"); var Media = require("./media.js").Media; +var CustomEmbedFilter = require("./customembed").filter; module.exports = function (Server) { function urlRetrieve(transport, options, callback) { @@ -457,6 +458,13 @@ module.exports = function (Server) { var title = "Imgur Album - " + id; var media = new Media(id, title, "--:--", "im"); callback(false, media); + }, + + /* custom embed */ + cu: function (id, callback) { + id = CustomEmbedFilter(id); + var media = new Media(id, "Custom Media", "--:--", "cu"); + callback(false, media); } }; diff --git a/playlist.js b/playlist.js index 4fd97f57..07e3995b 100644 --- a/playlist.js +++ b/playlist.js @@ -497,7 +497,8 @@ function isLive(type) { || type == "rt" // RTMP || type == "jw" // JWPlayer || type == "us" // Ustream.tv - || type == "im";// Imgur album + || type == "im" // Imgur album + || type == "cu";// Custom embed } const UPDATE_INTERVAL = 5; diff --git a/www/assets/js/player.js b/www/assets/js/player.js index bb1d35af..83a45ba4 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -66,6 +66,9 @@ var Player = function(data) { case "im": this.initImgur(); break; + case "cu": + this.initCustom(); + break; default: this.nullPlayer(); break; @@ -627,6 +630,33 @@ Player.prototype.initImgur = function() { this.seek = function() { } } +Player.prototype.initCustom = function() { + var div = $("
").insertBefore($("#ytapiplayer")); + $("#ytapiplayer").remove(); + div.append(this.id); + + this.player = div.find("iframe") || div.find("object") + || div.find("embed") || div; + this.player.attr("id", "ytapiplayer"); + this.player.attr("width", VWIDTH); + this.player.attr("height", VHEIGHT); + + this.load = function(data) { + this.id = data.id; + this.initCustom() + } + + this.pause = function() { } + + this.play = function() { } + + this.isPaused = function() { } + + this.getTime = function() { } + + this.seek = function() { } +} + Player.prototype.update = function(data) { this.currentTime = data.currentTime; if(data.id && data.id != this.id) {