mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
...
This commit is contained in:
1 parent
37fe5146cb
commit
a5afb6651a
1 file changed
+12
-5
@@ -518,9 +518,14 @@ export class FluxerAudioBridge extends EventEmitter {
|
|||||||
(trackInfo.title || "unknown"));
|
(trackInfo.title || "unknown"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (seekMs > 0 || durationMs <= 0) {
|
if (durationMs <= 0) {
|
||||||
// Streamed route: byte-positioned for seeks; also gives an
|
/* Live stream: decode via in-process FFmpeg to seek to the live edge */
|
||||||
// end-of-stream handle when the duration is unknown.
|
logger.player("[AudioBridge] Live stream (duration <= 0) — playing via in-process ffmpeg: " + direct.url.substring(0, 80));
|
||||||
|
return await this._playViaFfmpeg(conn, direct.url, durationMs, generation);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seekMs > 0) {
|
||||||
|
/* Streamed route: byte-positioned for seeks */
|
||||||
const opened = await this._openPositionedStream(direct.url, seekMs);
|
const opened = await this._openPositionedStream(direct.url, seekMs);
|
||||||
if (stale()) {
|
if (stale()) {
|
||||||
opened.stream.destroy();
|
opened.stream.destroy();
|
||||||
@@ -732,13 +737,15 @@ export class FluxerAudioBridge extends EventEmitter {
|
|||||||
const headers = url.includes("soundcloud.cloud")
|
const headers = url.includes("soundcloud.cloud")
|
||||||
? "Origin: https://soundcloud.com\r\nReferer: https://soundcloud.com/\r\n"
|
? "Origin: https://soundcloud.com\r\nReferer: https://soundcloud.com/\r\n"
|
||||||
: "Origin: https://www.youtube.com\r\nReferer: https://www.youtube.com/\r\n";
|
: "Origin: https://www.youtube.com\r\nReferer: https://www.youtube.com/\r\n";
|
||||||
const isHls = url.includes(".m3u8") || url.includes("manifest") || url.includes("hls");
|
const isHls = url.includes(".m3u8");
|
||||||
const hlsArgs = isHls ? ["-live_start_index", "-3"] : [];
|
const hlsArgs = isHls ? ["-f", "hls", "-live_start_index", "-3"] : [];
|
||||||
|
const liveArgs = (durationMs <= 0) ? ["-sseof", "-10"] : [];
|
||||||
const ffmpegArgs = [
|
const ffmpegArgs = [
|
||||||
"-re",
|
"-re",
|
||||||
"-headers", headers,
|
"-headers", headers,
|
||||||
"-user_agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
"-user_agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
||||||
...hlsArgs,
|
...hlsArgs,
|
||||||
|
...liveArgs,
|
||||||
"-reconnect", "1",
|
"-reconnect", "1",
|
||||||
"-reconnect_streamed", "1",
|
"-reconnect_streamed", "1",
|
||||||
"-reconnect_delay_max", "5",
|
"-reconnect_delay_max", "5",
|
||||||
|
|||||||
Reference in new issue
Block a user