use new player api for streaming

This commit is contained in:
Sean Yesmunt 2020-01-24 11:25:31 -05:00
parent c711e26a44
commit e1dd28fff6
4 changed files with 7 additions and 7 deletions

View file

@ -6,6 +6,7 @@ const config = {
URL: 'https://lbry.tv', URL: 'https://lbry.tv',
SITE_TITLE: 'lbry.tv', SITE_TITLE: 'lbry.tv',
LBRY_TV_API: 'https://api.lbry.tv', LBRY_TV_API: 'https://api.lbry.tv',
LBRY_TV_STREAMING_API: 'https://player.lbry.tv',
}; };
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`; config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;

View file

@ -1,6 +1,5 @@
const { getHtml } = require('./html'); const { getHtml } = require('./html');
const { generateStreamUrl, generateDownloadUrl } = require('../../ui/util/lbrytv'); const { generateStreamUrl, generateDownloadUrl } = require('../../ui/util/lbrytv');
const { LBRY_TV_API } = require('../../config');
const Router = require('@koa/router'); const Router = require('@koa/router');
const send = require('koa-send'); const send = require('koa-send');
@ -8,13 +7,13 @@ const router = new Router();
router.get(`/$/embed/:claimName/:claimId`, async ctx => { router.get(`/$/embed/:claimName/:claimId`, async ctx => {
const { claimName, claimId } = ctx.params; const { claimName, claimId } = ctx.params;
const streamUrl = generateStreamUrl(claimName, claimId, LBRY_TV_API); const streamUrl = generateStreamUrl(claimName, claimId);
ctx.redirect(streamUrl); ctx.redirect(streamUrl);
}); });
router.get(`/$/download/:claimName/:claimId`, async ctx => { router.get(`/$/download/:claimName/:claimId`, async ctx => {
const { claimName, claimId } = ctx.params; const { claimName, claimId } = ctx.params;
const downloadUrl = generateDownloadUrl(claimName, claimId, LBRY_TV_API); const downloadUrl = generateDownloadUrl(claimName, claimId);
ctx.redirect(downloadUrl); ctx.redirect(downloadUrl);
}); });

View file

@ -9,7 +9,7 @@ export default function useGetThumbnail(
getFile: string => void, getFile: string => void,
shouldHide: boolean shouldHide: boolean
) { ) {
const hasClaim = claim !== undefined; // const hasClaim = claim !== undefined;
// $FlowFixMe // $FlowFixMe
const isImage = claim && claim.value && claim.value.stream_type === 'image'; const isImage = claim && claim.value && claim.value.stream_type === 'image';
@ -19,7 +19,7 @@ export default function useGetThumbnail(
// @if TARGET='web' // @if TARGET='web'
if (claim && isImage && isFree) { if (claim && isImage && isFree) {
thumbnailToUse = generateStreamUrl(claim.name, claim.claim_id, 'https://api.lbry.tv'); thumbnailToUse = generateStreamUrl(claim.name, claim.claim_id);
} }
// @endif // @endif

View file

@ -1,7 +1,7 @@
const { URL } = require('../../config'); const { URL, LBRY_TV_STREAMING_API } = require('../../config');
function generateStreamUrl(claimName, claimId, apiUrl) { function generateStreamUrl(claimName, claimId, apiUrl) {
const prefix = process.env.SDK_API_URL || apiUrl; const prefix = LBRY_TV_STREAMING_API || apiUrl;
return `${prefix}/content/claims/${claimName}/${claimId}/stream`; return `${prefix}/content/claims/${claimName}/${claimId}/stream`;
} }