FireScreen V2 Docs

Welcome! This guide explains how to install, configure, and interact with FireScreen V2 in your Banter space.

1. Installation

To add a FireScreen to your space, simply add a <script> tag to your index.html file.

Basic Example

<script src="https://51.firer.at/scripts/firescreenv2.js"
        website="https://firer.at/"
        position="2 1.5 6"
        scale="2.5 2.5 1"
        hand-controls="true">
</script>

Advanced Example

<script src="https://51.firer.at/scripts/firescreenv2.js"
        position="0 2 -5"
        rotation="0 20 0"
		disable-rotation="true"
        width="1280"
        height="720"
        pixelsperunit="1400"
        button-color="0.1 0.8 0.1 1"
        custom-button01-url="https://google.com"
        custom-button01-text="Google"
        custom-button02-url="https://youtube.com"
        custom-button02-text="YouTube">
</script>

2. Configuration Parameters

You can customize each FireScreen instance using attributes on the <script> tag. The ID for each FireScreen (used for events and remote control) is determined by its order in the index.html file, starting from 1.

Core Attributes

AttributeDefault ValueDescription
websitehttps://firer.at/pages/games.htmlThe initial URL the browser will load.
position0 2 0The world position of the screen (X Y Z).
rotation0 0 0The world rotation of the screen (X Y Z).
scale1 1 1The world scale of the screen (X Y Z).

Display & Appearance

AttributeDefault ValueDescription
width1024The pixel width of the browser surface.
height576The pixel height of the browser surface.
pixelsperunit1200The resolution of the web surface (pixels-per-meter). Higher values are sharper but cost more performance.
mipmaps1The number of mipmaps for the browser texture.
backdroptrueIf true, shows a dark backdrop behind the screen.
backdrop-color0 0 0 0.9The color and alpha of the backdrop (R G B A, 0-1).
screen-position0 0 -0.02The local position of the browser surface relative to the backdrop.
screen-rotation0 0 0The local rotation of the browser surface.
screen-scale1 1 1The local scale of the browser surface.

Interaction & Controls

AttributeDefault ValueDescription
hand-controlsfalseIf true, attaches volume and home controls to the user's left hand.
disable-interactionfalseIf true, users cannot click or interact with the browser surface.
disable-rotationfalseIf true, the screen will not billboard (face) the user.
lock-positionfalseIf true, the screen cannot be grabbed and moved by users.
volumelevel0.25The initial volume level (0.0 to 1.0).
castmodefalseIf true, simplifies the UI for casting/streaming use cases. Hides most buttons.

UI Customization

AttributeDefault ValueDescription
button-color0 1 0 1The default color for UI buttons (R G B A, 0-1).
volup-color0 1 0 1The color for the volume up button.
voldown-color1 1 0 1The color for the volume down button.
mute-color1 1 1 1The color for the mute button.
icon-mute-url(default url)URL for the mute icon.
icon-volup-url(default url)URL for the volume up icon.
icon-voldown-url(default url)URL for the volume down icon.
icon-direction-url(default url)URL for the back/forward arrow icon.
custom-button01-urlfalseProvide a URL to enable custom button 1.
custom-button01-textCustom Button 1Text label for custom button 1.
... (custom buttons 2 through 5 follow the same pattern) ...

Advanced Features

AttributeDefault ValueDescription
space-syncfalseIf true, the screen will sync its URL from a space state property named fireurl.
announcefalseIf true, enables spoken welcome messages.
announce-eventsfalseIf true, enables spoken announcements for upcoming SideQuest events.
announce-420falseIf true, enables special 4:20-themed spoken announcements.

3. Advanced Usage

Listening for Events

You can create custom logic that responds to button clicks on any FireScreen. When a UI or Hand Control button is clicked, a CustomButtonClick event is dispatched. This is the safest way to listen for events.

// Wait for the manager to be available
const interval = setInterval(() => {
    if (window.fireScreenManager) {
        clearInterval(interval);

        // Add the event listener
        window.fireScreenManager.addEventListener('CustomButtonClick', (event) => {
            console.log('Button clicked on instance:', event.detail.instanceId);
            console.log('Button name:', event.detail.buttonName);
            console.log('Current URL:', event.detail.message);

            if (event.detail.buttonName === 'Home') {
                // Custom action for the home button
                console.log('The Home button was clicked!');
            }
        });
    }
}, 100);

Hand Controls

Setting hand-controls="true" attaches a control panel to your left hand for easy access to common functions. These controls are designed to affect all FireScreens in the space simultaneously.

ButtonActionEvent Dispatched
Volume UpIncreases the volume on all FireScreens.Yes (VolumeUp)
Volume DownDecreases the volume on all FireScreens.Yes (VolumeDown)
MuteToggles the mute state on all FireScreens.Yes (Mute)
HomeNavigates all FireScreens to their home page.Yes (Home)
Lock PlayerToggles the Banter "LegacyLockPlayer" state, which prevents you from moving.No

Remote Control (One-Shot Commands)

Space admins can control FireScreens using Banter's one-shot system. To control a specific screen, include a target property with the screen's ID. Omit it to control all screens.

// Change URL of screen #2
BS.BanterScene.GetInstance().OneShot(JSON.stringify({
    target: 2,
    fireurl: "https://google.com"
}));

// Send all screens home
BS.BanterScene.GetInstance().OneShot(JSON.stringify({
    gohome: true
}));
CommandValue TypeDescription
fireurlstringSets the browser URL.
firevolumenumberSets the volume directly (0.0 to 1.0).
browseractionstringExecutes a JavaScript string inside the browser (e.g., document.body.style.backgroundColor='red').
Security Note: Use with caution, as this can execute any JavaScript. Sanitize any user-provided input.
gohomebooleanNavigates the browser to its configured home page.
sethomestringSets a new home page URL for the browser.
firevolumeupbooleanIncreases the volume for all screens.
firevolumedownbooleanDecreases the volume for all screens.
firemutetogglebooleanToggles mute for all screens.

Space State Synchronization

If you set space-sync="true" on a FireScreen, it will automatically try to load its URL from a public space state property named fireurl.

You can set this property in your space settings or via a script:

// Example of setting the synced URL
BS.BanterScene.GetInstance().SetPublicSpaceProps({'fireurl': 'https://bantervr.com/'});

This is great for having a primary screen in your world that always shows a specific, easily updatable page.

Announcer Integration

The FireScreen script can provide in-world, spoken announcements for various activities. This feature works by dynamically loading an announcer.js script into your space. It is loaded only once, even if multiple screens have announcer flags enabled.

You can enable different types of announcements:

Dynamic URL and Home Page Changes

You can programmatically change the URL or set a new home page for FireScreens at runtime from your own scripts. This is done by interacting with the global fireScreenManager object.

Changing the Current URL

// Example: Change the URL for the first FireScreen instance (ID 1)
if (typeof fireScreenManager !== 'undefined' && fireScreenManager.instances[1]) {
    fireScreenManager.instances[1].handleCommand({
        fireurl: "https://threejs.org"
    });
}

// Example: Change the URL for ALL FireScreens in the space
if (typeof fireScreenManager !== 'undefined') {
    fireScreenManager.broadcastCommand({
        fireurl: "https://bantervr.com"
    });
}

Setting a New Home Page

// Example: Set a new home page for the first FireScreen instance (ID 1)
if (typeof fireScreenManager !== 'undefined' && fireScreenManager.instances[1]) {
    fireScreenManager.instances[1].handleCommand({
        sethome: "https://sidequestvr.com"
    });
}

Cleanup and Disposal

When a FireScreen is no longer needed at runtime, it's important to clean it up properly to free up resources. For compatibility with other scripts, a global cleanupFireScreenV2 function is available. Since it's a global function, you can call it directly without the window. prefix.

// Example: Clean up the first FireScreen instance
if (typeof cleanupFireScreenV2 === 'function') {
    // The cleanup function takes the instanceId of the screen to remove.
    cleanupFireScreenV2(1);
}

Calling this function will trigger the manager to safely remove the screen's 3D objects, dispose of its resources, and clean up event listeners to prevent memory leaks.

4. Performance & Troubleshooting

Performance Considerations

Common Issues

5. Community & Support

Encountered a bug or have a feature request? Please open an issue on the official GitHub repository. Your feedback is valuable!

GitHub Repository: https://github.com/FireRat666/51