Now manage to replace the Foundry native AV dock
CI / ci (push) Failing after 16s

This commit is contained in:
2026-05-24 09:39:53 +02:00
parent c4a375f4e3
commit 6d7a0b5fd7
94 changed files with 6027 additions and 20 deletions
+25 -1
View File
@@ -344,7 +344,7 @@ export class FoundryAdapter {
* 2. Create our own video elements using getMediaStreamForUser()
* 3. Display actual video feeds in our ScryingPoolStrip
*
* @param {{ client: object, settings: object }} gameWebrtc - The game.webrtc (AVMaster) instance
* @param {{ client: object }} gameWebrtc - The game.webrtc (AVMaster) instance
* @returns {object} WebRTC surface with stream access methods
* @throws {TypeError} if gameWebrtc or gameWebrtc.client is invalid
*/
@@ -363,6 +363,10 @@ export class FoundryAdapter {
*/
getMediaStreamForUser: (userId) => {
try {
if (typeof userId !== 'string' || userId.trim() === '') {
console.warn('[ScryingPool] getMediaStreamForUser: invalid userId:', userId);
return null;
}
return client.getMediaStreamForUser?.(userId) ?? null;
} catch (err) {
console.error('[ScryingPool] getMediaStreamForUser failed:', err);
@@ -390,6 +394,10 @@ export class FoundryAdapter {
*/
getLevelsStreamForUser: (userId) => {
try {
if (typeof userId !== 'string' || userId.trim() === '') {
console.warn('[ScryingPool] getLevelsStreamForUser: invalid userId:', userId);
return null;
}
return client.getLevelsStreamForUser?.(userId) ?? null;
} catch (err) {
console.error('[ScryingPool] getLevelsStreamForUser failed:', err);
@@ -473,6 +481,14 @@ export class FoundryAdapter {
*/
setUserVideo: async (userId, videoElement) => {
try {
if (typeof userId !== 'string' || userId.trim() === '') {
console.warn('[ScryingPool] setUserVideo: invalid userId:', userId);
return;
}
if (!(videoElement instanceof HTMLVideoElement)) {
console.warn('[ScryingPool] setUserVideo: videoElement is not a HTMLVideoElement');
return;
}
if (typeof client.setUserVideo === 'function') {
await client.setUserVideo(userId, videoElement);
}
@@ -484,6 +500,10 @@ export class FoundryAdapter {
// Legacy: disable video track (cosmetic only, doesn't reduce bandwidth)
disableTrack: (userId) => {
try {
if (typeof userId !== 'string' || userId.trim() === '') {
console.warn('[ScryingPool] disableTrack: invalid userId:', userId);
return;
}
const stream = client.getMediaStreamForUser?.(userId);
const tracks = stream?.getVideoTracks() ?? [];
for (const track of tracks) track.enabled = false;
@@ -498,6 +518,10 @@ export class FoundryAdapter {
// Legacy: enable video track
enableTrack: (userId) => {
try {
if (typeof userId !== 'string' || userId.trim() === '') {
console.warn('[ScryingPool] enableTrack: invalid userId:', userId);
return;
}
const stream = client.getMediaStreamForUser?.(userId);
const tracks = stream?.getVideoTracks() ?? [];
for (const track of tracks) track.enabled = true;