Hookup new live detection API

This commit is contained in:
DispatchCommit 2021-03-21 21:16:39 -07:00
parent ca569dc4a7
commit 76ac4c19b9
2 changed files with 4 additions and 4 deletions

View file

@ -23,7 +23,7 @@ export default function LivestreamLink(props: Props) {
}) })
.then((res) => { .then((res) => {
if (res && res.items && res.items.length > 0) { if (res && res.items && res.items.length > 0) {
const claim = res.items[0]; const claim = res.items[res.items.length - 1];
setLivestreamClaim(claim); setLivestreamClaim(claim);
} }
}) })
@ -32,10 +32,10 @@ export default function LivestreamLink(props: Props) {
React.useEffect(() => { React.useEffect(() => {
function fetchIsStreaming() { function fetchIsStreaming() {
fetch(`${BITWAVE_API}/MarkPugner`) fetch(`${BITWAVE_API}/${livestreamChannelId}`)
.then((res) => res.json()) .then((res) => res.json())
.then((res) => { .then((res) => {
if (res && res.data && res.data.live) { if (res && res.data && res.data.success && res.data.data && res.data.data.live) {
setIsLivestreaming(true); setIsLivestreaming(true);
} else { } else {
setIsLivestreaming(false); setIsLivestreaming(false);

View file

@ -1,2 +1,2 @@
export const BITWAVE_EMBED_URL = 'https://bitwave.tv/embed'; export const BITWAVE_EMBED_URL = 'https://bitwave.tv/embed';
export const BITWAVE_API = 'https://api.bitwave.tv/v1/channels'; export const BITWAVE_API = 'https://api.bitwave.tv/v1/odysee/live';