mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
simplification
This commit is contained in:
@@ -13,7 +13,6 @@ function normalizeEntry(entry) {
|
||||
if (typeof entry === 'object') {
|
||||
if (entry.type && entry.id) {
|
||||
const id = String(entry.id);
|
||||
const audioId = entry.audioId ? String(entry.audioId) : null;
|
||||
let key = entry.key;
|
||||
if (!key) {
|
||||
key = entry.type === 'room' ? `room:${id}` : id;
|
||||
@@ -22,7 +21,6 @@ function normalizeEntry(entry) {
|
||||
type: entry.type,
|
||||
id,
|
||||
key,
|
||||
audioId,
|
||||
};
|
||||
}
|
||||
if (entry.roverId) {
|
||||
@@ -111,17 +109,7 @@ export function useVideoRequests(sourceList = []) {
|
||||
return;
|
||||
}
|
||||
clearRetry(entry.key);
|
||||
setSources((prev) => {
|
||||
const next = { ...prev, [entry.key]: resp };
|
||||
if (entry.audioId && resp.url && resp.token) {
|
||||
const audioUrl = resp.url.replace(
|
||||
`/${encodeURIComponent(entry.id)}/whep`,
|
||||
`/${encodeURIComponent(entry.audioId)}/whep`,
|
||||
);
|
||||
next[entry.audioId] = { url: audioUrl, token: resp.token };
|
||||
}
|
||||
return next;
|
||||
});
|
||||
setSources((prev) => ({ ...prev, [entry.key]: resp }));
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('video:request ok', { entry, url: resp.url });
|
||||
});
|
||||
@@ -146,9 +134,6 @@ export function useVideoRequests(sourceList = []) {
|
||||
if (sources[entry.key]) {
|
||||
next[entry.key] = sources[entry.key];
|
||||
}
|
||||
if (entry.audioId && sources[entry.audioId]) {
|
||||
next[entry.audioId] = sources[entry.audioId];
|
||||
}
|
||||
});
|
||||
return next;
|
||||
}, [normalizedKey, sources, normalizedEntries]);
|
||||
|
||||
Reference in New Issue
Block a user