livestream api constant rename

This commit is contained in:
zeppi 2021-07-27 16:35:22 -04:00 committed by jessopb
parent 6cc3216d62
commit 9889c258e3
8 changed files with 22 additions and 19 deletions

View file

@ -1,5 +1,5 @@
// @flow // @flow
import { BITWAVE_EMBED_URL } from 'constants/livestream'; import { LIVESTREAM_EMBED_URL } from 'constants/livestream';
import React from 'react'; import React from 'react';
import FileTitleSection from 'component/fileTitleSection'; import FileTitleSection from 'component/fileTitleSection';
import LivestreamComments from 'component/livestreamComments'; import LivestreamComments from 'component/livestreamComments';
@ -29,7 +29,7 @@ export default function LivestreamLayout(props: Props) {
<div className="file-render file-render--video livestream"> <div className="file-render file-render--video livestream">
<div className="file-viewer"> <div className="file-viewer">
<iframe <iframe
src={`${BITWAVE_EMBED_URL}/${channelClaimId}?skin=odysee&autoplay=1`} src={`${LIVESTREAM_EMBED_URL}/${channelClaimId}?skin=odysee&autoplay=1`}
scrolling="no" scrolling="no"
allowFullScreen allowFullScreen
/> />

View file

@ -1,5 +1,5 @@
// @flow // @flow
import { BITWAVE_LIVE_API } from 'constants/livestream'; import { LIVESTREAM_LIVE_API } from 'constants/livestream';
import * as CS from 'constants/claim_search'; import * as CS from 'constants/claim_search';
import React from 'react'; import React from 'react';
import Card from 'component/common/card'; import Card from 'component/common/card';
@ -39,8 +39,8 @@ export default function LivestreamLink(props: Props) {
React.useEffect(() => { React.useEffect(() => {
function fetchIsStreaming() { function fetchIsStreaming() {
// $FlowFixMe Bitwave's API can handle garbage // $FlowFixMe livestream API can handle garbage
fetch(`${BITWAVE_LIVE_API}/${livestreamChannelId}`) fetch(`${LIVESTREAM_LIVE_API}/${livestreamChannelId}`)
.then((res) => res.json()) .then((res) => res.json())
.then((res) => { .then((res) => {
if (res && res.success && res.data && res.data.live) { if (res && res.success && res.data && res.data.live) {

View file

@ -1,6 +1,6 @@
// @flow // @flow
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import { BITWAVE_LIVE_API } from 'constants/livestream'; import { LIVESTREAM_LIVE_API } from 'constants/livestream';
import React from 'react'; import React from 'react';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
@ -14,7 +14,7 @@ export default function LivestreamList() {
React.useEffect(() => { React.useEffect(() => {
function checkCurrentLivestreams() { function checkCurrentLivestreams() {
fetch(BITWAVE_LIVE_API) fetch(LIVESTREAM_LIVE_API)
.then((res) => res.json()) .then((res) => res.json())
.then((res) => { .then((res) => {
setLoading(false); setLoading(false);

View file

@ -28,7 +28,7 @@ import * as PUBLISH_MODES from 'constants/publish_types';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
import { toHex } from 'util/hex'; import { toHex } from 'util/hex';
import { BITWAVE_REPLAY_API } from 'constants/livestream'; import { LIVESTREAM_REPLAY_API } from 'constants/livestream';
// @if TARGET='app' // @if TARGET='app'
import fs from 'fs'; import fs from 'fs';
@ -274,7 +274,7 @@ function PublishForm(props: Props) {
// move this to lbryinc OR to a file under ui, and/or provide a standardized livestreaming config. // move this to lbryinc OR to a file under ui, and/or provide a standardized livestreaming config.
function fetchLivestreams(channelId, signature, timestamp) { function fetchLivestreams(channelId, signature, timestamp) {
setCheckingLivestreams(true); setCheckingLivestreams(true);
fetch(`${BITWAVE_REPLAY_API}/${channelId}?signature=${signature || ''}&signing_ts=${timestamp || ''}`) // claimChannelId fetch(`${LIVESTREAM_REPLAY_API}/${channelId}?signature=${signature || ''}&signing_ts=${timestamp || ''}`) // claimChannelId
.then((res) => res.json()) .then((res) => res.json())
.then((res) => { .then((res) => {
if (!res || !res.data) { if (!res || !res.data) {

View file

@ -1,3 +1,4 @@
export const BITWAVE_EMBED_URL = 'https://player.live.odysee.com/odysee'; export const LIVESTREAM_EMBED_URL = 'https://player.live.odysee.com/odysee';
export const BITWAVE_LIVE_API = 'https://api.live.odysee.com/v1/odysee/live'; export const LIVESTREAM_LIVE_API = 'https://api.live.odysee.com/v1/odysee/live';
export const BITWAVE_REPLAY_API = 'https://api.live.odysee.com/v1/replays/odysee'; export const LIVESTREAM_REPLAY_API = 'https://api.live.odysee.com/v1/replays/odysee';
export const LIVESTREAM_RTMP_URL = 'rtmp://stream.odysee.com/live';

View file

@ -1,6 +1,6 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { BITWAVE_LIVE_API } from 'constants/livestream'; import { LIVESTREAM_LIVE_API } from 'constants/livestream';
/** /**
* Gets latest livestream info list. Returns null (instead of a blank object) * Gets latest livestream info list. Returns null (instead of a blank object)
@ -16,7 +16,7 @@ export default function useGetLivestreams(minViewers: number = 0, refreshMs: num
React.useEffect(() => { React.useEffect(() => {
function checkCurrentLivestreams() { function checkCurrentLivestreams() {
fetch(BITWAVE_LIVE_API) fetch(LIVESTREAM_LIVE_API)
.then((res) => res.json()) .then((res) => res.json())
.then((res) => { .then((res) => {
setLoading(false); setLoading(false);

View file

@ -1,5 +1,5 @@
// @flow // @flow
import { BITWAVE_LIVE_API } from 'constants/livestream'; import { LIVESTREAM_LIVE_API } from 'constants/livestream';
import React from 'react'; import React from 'react';
import Page from 'component/page'; import Page from 'component/page';
import LivestreamLayout from 'component/livestreamLayout'; import LivestreamLayout from 'component/livestreamLayout';
@ -56,8 +56,9 @@ export default function LivestreamPage(props: Props) {
React.useEffect(() => { React.useEffect(() => {
let interval; let interval;
function checkIsLive() { function checkIsLive() {
// $FlowFixMe Bitwave's API can handle garbage // TODO: duplicate code below
fetch(`${BITWAVE_LIVE_API}/${livestreamChannelId}`) // $FlowFixMe livestream API can handle garbage
fetch(`${LIVESTREAM_LIVE_API}/${livestreamChannelId}`)
.then((res) => res.json()) .then((res) => res.json())
.then((res) => { .then((res) => {
if (!res || !res.data) { if (!res || !res.data) {
@ -105,7 +106,7 @@ export default function LivestreamPage(props: Props) {
React.useEffect(() => { React.useEffect(() => {
// Set playing uri to null so the popout player doesnt start playing the dummy claim if a user navigates back // Set playing uri to null so the popout player doesnt start playing the dummy claim if a user navigates back
// This can be removed when we start using the app video player, not a bitwave iframe // This can be removed when we start using the app video player, not a LIVESTREAM iframe
doSetPlayingUri({ uri: null }); doSetPlayingUri({ uri: null });
}, [doSetPlayingUri]); }, [doSetPlayingUri]);

View file

@ -16,6 +16,7 @@ import CopyableText from 'component/copyableText';
import Card from 'component/common/card'; import Card from 'component/common/card';
import ClaimList from 'component/claimList'; import ClaimList from 'component/claimList';
import usePersistedState from 'effects/use-persisted-state'; import usePersistedState from 'effects/use-persisted-state';
import { LIVESTREAM_RTMP_URL } from 'constants/livestream';
type Props = { type Props = {
channels: Array<ChannelClaim>, channels: Array<ChannelClaim>,
@ -182,7 +183,7 @@ export default function LivestreamSetupPage(props: Props) {
primaryButton primaryButton
name="stream-server" name="stream-server"
label={__('Stream server')} label={__('Stream server')}
copyable="rtmp://stream.odysee.com/live" copyable={LIVESTREAM_RTMP_URL}
snackMessage={__('Copied')} snackMessage={__('Copied')}
/> />
<CopyableText <CopyableText