Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream periodically stops at client after track ends #320

Open
klen-list opened this issue Apr 3, 2022 · 7 comments
Open

Stream periodically stops at client after track ends #320

klen-list opened this issue Apr 3, 2022 · 7 comments
Labels
invalid This doesn't seem right question Further information is requested

Comments

@klen-list
Copy link

This happens randomly between different tracks. After reloading page stream continues.
I see the same problem when using BASS: http://www.bass.radio42.com/help/html/322b7ddc-a9f5-21eb-c78a-f5937cd0d2f2.htm

Failed to decode media resource http://localhost:8000/stream. x27 [stream]
Failed to decode media resource http://localhost:8000/stream, error: Error Code: NS_ERROR_DOM_MEDIA_DECODE_ERR (0x806e0004)
Details: virtual mozilla::MediaResult __cdecl mozilla::FFmpegAudioDecoder<46465650>::DoDecode(mozilla::MediaRawData *, uint8_t *, int, bool *, mozilla::MediaDataDecoder::DecodedData &): FFmpeg audio error:-1094995529

Sometimes after page load the stream gives out the full length of the track instead of a per-second download:
firefox_rizz3kMOgm
And stops stream after finishing with the above error.

I even tried to export all the tracks to the same bitrate, but it didn't help.

const { PUBLIC_EVENTS, SHUFFLE_METHODS, Station } = require("@fridgefm/radio-core")
const http = require("http")

const station = new Station()
station.addFolder("./stream")

const reqListener = (req, res) => station.connectListener(req, res)
const radio = http.createServer(reqListener)

station.reorderPlaylist(SHUFFLE_METHODS.randomShuffle())

station.on(PUBLIC_EVENTS.NEXT_TRACK, async (track) => {
    const result = await track.getMetaAsync()
    console.log(result.title)
})

station.start()
radio.listen(8000)

It doesn't seem to be happening with your radio in the example. Maybe I'm setting something up wrong?

@ch1ller0
Copy link
Owner

Hey, what are the contents of the stream folder? I assume there might be some issue considering synchronous folder walking

@ch1ller0 ch1ller0 added invalid This doesn't seem right question Further information is requested labels Apr 11, 2022
@klen-list
Copy link
Author

stream folder just contains bunch of .mp3 files without any subfolders

@ch1ller0
Copy link
Owner

ch1ller0 commented Apr 11, 2022

Could you try to use another folder with just 2-3 mp3 files in it and see if the problem reproduces? And also, are there any helpful logs from the server/client? And also, which version are you using? I had similar issue but it was fixed in #34

@LaganYT
Copy link

LaganYT commented Sep 5, 2022

this is happening to apple devices listening to my streams too.

@ppalone
Copy link

ppalone commented Mar 9, 2023

Wondering if this issue still exists, I'm too writing my own radio but in Go. I'm using ffmpeg for doing most of the heavy lifting like encoding, removing metadata (like idv3 tags etc). Occasionally, my client (<audio> tag) also disconnects while listening. It mostly occurs when the server is changing songs (like for example one song has ended and its trying to load the next song). @ch1ller0 did you encounter such issues after the idv3 removal fix? Let me know. Thanks.

@ppalone
Copy link

ppalone commented Mar 11, 2023

A hacky solution that I use is reconnect to stream when error occurs.

// audio -> audio element
audio.onerror = function (err) {
    console.error(err)

    audio.setAttribute('src', '/stream')
    audio.play().catch(console.error)
}

@Sinkcat113
Copy link

Sinkcat113 commented Jul 22, 2024

I'm receiving this error and encountering the same issue.

(node:1066) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added to [Transform]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit (Use node --trace-warnings ... to show where the warning was created) (node:1066) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [Transform]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit (node:1066) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [EventEmitter]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit

This is on the server.
It's happened both on 3.2.6 and 3.2.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants