make player url dynamic
This commit is contained in:
parent
5dc6e60107
commit
167b591d21
1 changed files with 12 additions and 2 deletions
|
@ -1,7 +1,17 @@
|
||||||
|
const { Lbryio } = require('lbryinc');
|
||||||
const { URL, LBRY_TV_STREAMING_API } = require('../../config');
|
const { URL, LBRY_TV_STREAMING_API } = require('../../config');
|
||||||
|
|
||||||
function generateStreamUrl(claimName, claimId, apiUrl) {
|
async function generateStreamUrl(claimName, claimId, apiUrl) {
|
||||||
const prefix = LBRY_TV_STREAMING_API || apiUrl;
|
let prefix = LBRY_TV_STREAMING_API || apiUrl;
|
||||||
|
try {
|
||||||
|
let localeResponse = await Lbryio.call('locale', 'get', {}, 'post');
|
||||||
|
if (prefix.split('//').length > 1) {
|
||||||
|
prefix = prefix.replace('//', '//' + localeResponse.continent + '.');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err.stack || err);
|
||||||
|
}
|
||||||
|
console.log(`${prefix}/content/claims/${claimName}/${claimId}/stream`);
|
||||||
return `${prefix}/content/claims/${claimName}/${claimId}/stream`;
|
return `${prefix}/content/claims/${claimName}/${claimId}/stream`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue