lbry-desktop/ui/util/lbrytv.js
2020-01-24 11:26:19 -05:00

18 lines
657 B
JavaScript

const { URL, LBRY_TV_STREAMING_API } = require('../../config');
function generateStreamUrl(claimName, claimId, apiUrl) {
const prefix = LBRY_TV_STREAMING_API || apiUrl;
return `${prefix}/content/claims/${claimName}/${claimId}/stream`;
}
function generateEmbedUrl(claimName, claimId) {
return `${URL}/$/embed/${claimName}/${claimId}`;
}
function generateDownloadUrl(claimName, claimId, apiUrl) {
const streamUrl = generateStreamUrl(claimName, claimId, apiUrl);
return `${streamUrl}?download=1`;
}
// module.exports needed since the web server imports this function
module.exports = { generateStreamUrl, generateEmbedUrl, generateDownloadUrl };