mirror of
https://github.com/linsa-io/linsa.git
synced 2026-04-22 16:28:36 +02:00
Add debug logs for stream status and HLS fetch process
This commit is contained in:
@@ -138,6 +138,7 @@ function StreamPage() {
|
|||||||
|
|
||||||
const fetchStatus = async () => {
|
const fetchStatus = async () => {
|
||||||
const status = await getStreamStatus()
|
const status = await getStreamStatus()
|
||||||
|
console.log("[Stream Status] nikiv.dev/api/stream-status:", status)
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
setStreamLive(status.isLive)
|
setStreamLive(status.isLive)
|
||||||
}
|
}
|
||||||
@@ -209,9 +210,11 @@ function StreamPage() {
|
|||||||
|
|
||||||
setStreamReady(false)
|
setStreamReady(false)
|
||||||
setHlsLive(null)
|
setHlsLive(null)
|
||||||
|
console.log("[HLS Check] Fetching manifest:", activePlayback.url)
|
||||||
fetch(activePlayback.url)
|
fetch(activePlayback.url)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
|
console.log("[HLS Check] Response status:", res.status, res.ok)
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
setStreamReady(false)
|
setStreamReady(false)
|
||||||
setHlsLive(false)
|
setHlsLive(false)
|
||||||
@@ -220,11 +223,13 @@ function StreamPage() {
|
|||||||
const manifest = await res.text()
|
const manifest = await res.text()
|
||||||
if (!isActive) return
|
if (!isActive) return
|
||||||
const live = isHlsPlaylistLive(manifest)
|
const live = isHlsPlaylistLive(manifest)
|
||||||
|
console.log("[HLS Check] Manifest live check:", { live, manifestLength: manifest.length, first200: manifest.slice(0, 200) })
|
||||||
setStreamReady(live)
|
setStreamReady(live)
|
||||||
setHlsLive(live)
|
setHlsLive(live)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err) => {
|
||||||
|
console.error("[HLS Check] Fetch error:", err)
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
setStreamReady(false)
|
setStreamReady(false)
|
||||||
setHlsLive(false)
|
setHlsLive(false)
|
||||||
@@ -277,6 +282,22 @@ function StreamPage() {
|
|||||||
isLiveStatus && (activePlayback?.type !== "hls" || hlsLive !== false)
|
isLiveStatus && (activePlayback?.type !== "hls" || hlsLive !== false)
|
||||||
const shouldFetchSpotify = username === "nikiv" && !isActuallyLive
|
const shouldFetchSpotify = username === "nikiv" && !isActuallyLive
|
||||||
|
|
||||||
|
// Debug logging for stream status
|
||||||
|
useEffect(() => {
|
||||||
|
if (username === "nikiv") {
|
||||||
|
console.log("[Stream Debug]", {
|
||||||
|
streamLive,
|
||||||
|
hlsLive,
|
||||||
|
isLiveStatus,
|
||||||
|
isActuallyLive,
|
||||||
|
streamReady,
|
||||||
|
activePlaybackType: activePlayback?.type,
|
||||||
|
webRtcFailed,
|
||||||
|
hlsUrl: stream?.hls_url,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [username, streamLive, hlsLive, isLiveStatus, isActuallyLive, streamReady, activePlayback?.type, webRtcFailed, stream?.hls_url])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!shouldFetchSpotify) {
|
if (!shouldFetchSpotify) {
|
||||||
setNowPlaying(null)
|
setNowPlaying(null)
|
||||||
|
|||||||
Reference in New Issue
Block a user