mirror of https://github.com/calzoneman/sync.git
Support custom embeds (no UI for it yet)
This commit is contained in:
parent
1aeec527f6
commit
fe2ec2c8d2
|
@ -56,6 +56,7 @@ var Channel = function(name, Server) {
|
||||||
playlistdelete: 2,
|
playlistdelete: 2,
|
||||||
playlistjump: 1.5,
|
playlistjump: 1.5,
|
||||||
playlistaddlist: 1.5,
|
playlistaddlist: 1.5,
|
||||||
|
playlistaddcustom: 3,
|
||||||
playlistaddlive: 1.5,
|
playlistaddlive: 1.5,
|
||||||
exceedmaxlength: 2,
|
exceedmaxlength: 2,
|
||||||
addnontemp: 2,
|
addnontemp: 2,
|
||||||
|
@ -1026,7 +1027,8 @@ function isLive(type) {
|
||||||
|| type == "rt" // RTMP
|
|| type == "rt" // RTMP
|
||||||
|| type == "jw" // JWPlayer
|
|| type == "jw" // JWPlayer
|
||||||
|| type == "us" // Ustream.tv
|
|| type == "us" // Ustream.tv
|
||||||
|| type == "im";// Imgur album
|
|| type == "im" // Imgur album
|
||||||
|
|| type == "cu";// Custom Embed
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel.prototype.queueAdd = function(item, after) {
|
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");
|
user.socket.emit("queueFail", "You don't have permission to add playlists");
|
||||||
return;
|
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.temp = isLive(data.type) || !this.hasPermission(user, "addnontemp");
|
||||||
data.maxlength = this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength;
|
data.maxlength = this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength;
|
||||||
var chan = this;
|
var chan = this;
|
||||||
|
|
|
@ -13,6 +13,7 @@ var http = require("http");
|
||||||
var https = require("https");
|
var https = require("https");
|
||||||
var Logger = require("./logger.js");
|
var Logger = require("./logger.js");
|
||||||
var Media = require("./media.js").Media;
|
var Media = require("./media.js").Media;
|
||||||
|
var CustomEmbedFilter = require("./customembed").filter;
|
||||||
|
|
||||||
module.exports = function (Server) {
|
module.exports = function (Server) {
|
||||||
function urlRetrieve(transport, options, callback) {
|
function urlRetrieve(transport, options, callback) {
|
||||||
|
@ -457,6 +458,13 @@ module.exports = function (Server) {
|
||||||
var title = "Imgur Album - " + id;
|
var title = "Imgur Album - " + id;
|
||||||
var media = new Media(id, title, "--:--", "im");
|
var media = new Media(id, title, "--:--", "im");
|
||||||
callback(false, media);
|
callback(false, media);
|
||||||
|
},
|
||||||
|
|
||||||
|
/* custom embed */
|
||||||
|
cu: function (id, callback) {
|
||||||
|
id = CustomEmbedFilter(id);
|
||||||
|
var media = new Media(id, "Custom Media", "--:--", "cu");
|
||||||
|
callback(false, media);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,8 @@ function isLive(type) {
|
||||||
|| type == "rt" // RTMP
|
|| type == "rt" // RTMP
|
||||||
|| type == "jw" // JWPlayer
|
|| type == "jw" // JWPlayer
|
||||||
|| type == "us" // Ustream.tv
|
|| type == "us" // Ustream.tv
|
||||||
|| type == "im";// Imgur album
|
|| type == "im" // Imgur album
|
||||||
|
|| type == "cu";// Custom embed
|
||||||
}
|
}
|
||||||
|
|
||||||
const UPDATE_INTERVAL = 5;
|
const UPDATE_INTERVAL = 5;
|
||||||
|
|
|
@ -66,6 +66,9 @@ var Player = function(data) {
|
||||||
case "im":
|
case "im":
|
||||||
this.initImgur();
|
this.initImgur();
|
||||||
break;
|
break;
|
||||||
|
case "cu":
|
||||||
|
this.initCustom();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.nullPlayer();
|
this.nullPlayer();
|
||||||
break;
|
break;
|
||||||
|
@ -627,6 +630,33 @@ Player.prototype.initImgur = function() {
|
||||||
this.seek = function() { }
|
this.seek = function() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player.prototype.initCustom = function() {
|
||||||
|
var div = $("<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) {
|
Player.prototype.update = function(data) {
|
||||||
this.currentTime = data.currentTime;
|
this.currentTime = data.currentTime;
|
||||||
if(data.id && data.id != this.id) {
|
if(data.id && data.id != this.id) {
|
||||||
|
|
Loading…
Reference in New Issue