mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
fix
This commit is contained in:
@@ -62,11 +62,30 @@ function ensureReady() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function forcePublishStreamMode(rawUrl) {
|
||||||
|
const value = String(rawUrl || '').trim();
|
||||||
|
if (!value) return '';
|
||||||
|
if (!/[?&]streamid=#!::/.test(value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/,m=publish\b/.test(value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/,m=read\b/.test(value)) {
|
||||||
|
return value.replace(/,m=read\b/, ',m=publish');
|
||||||
|
}
|
||||||
|
|
||||||
|
// If streamid exists but mode is omitted, default it to publish.
|
||||||
|
return value.replace(/([?&]streamid=#!::[^&]*)/, '$1,m=publish');
|
||||||
|
}
|
||||||
|
|
||||||
function resolveForwardUrl(roverId) {
|
function resolveForwardUrl(roverId) {
|
||||||
const record = roverManager.rovers.get(roverId);
|
const record = roverManager.rovers.get(roverId);
|
||||||
const configured = record?.meta?.media?.audioForwardUrl;
|
const configured = record?.meta?.media?.audioForwardUrl;
|
||||||
if (configured) {
|
if (configured) {
|
||||||
return configured;
|
return forcePublishStreamMode(configured);
|
||||||
}
|
}
|
||||||
const fallback = `srt://127.0.0.1:9000?streamid=#!::r=${encodeURIComponent(roverId + streamSuffix)},m=publish&latency=10&mode=caller&transtype=live&pkt_size=1316`;
|
const fallback = `srt://127.0.0.1:9000?streamid=#!::r=${encodeURIComponent(roverId + streamSuffix)},m=publish&latency=10&mode=caller&transtype=live&pkt_size=1316`;
|
||||||
return fallback;
|
return fallback;
|
||||||
|
|||||||
Reference in New Issue
Block a user