How to use the guacamole-common-js.AudioPlayer function in guacamole-common-js

To help you get started, we’ve selected a few guacamole-common-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paidem / guacozy / frontend / src / Components / GuacViewer / GuacViewer.js View on Github external
guacRef.current.onstatechange = (newState) => {
            setClientState(newState);
        };

        // Setup connection parameters, like resolution and supported audio types
        let connectionParams = {
            audio: []
        };

        // if current instance is allowed to control remote display size - include window size in connection info
        if (controlSize) {
            connectionParams.width = displayRef.current.clientWidth;
            connectionParams.height = displayRef.current.clientHeight;
        }

        let supportedAudioTypes = Guacamole.AudioPlayer.getSupportedTypes();
        if (supportedAudioTypes.length > 0) {
            connectionParams.audio = supportedAudioTypes.map(item => item + ";rate=44100,channels=2")
        }

        // Set connection parameters as we will use them later to reconnect
        connectParamsRef.current = connectionParams;

        // Everything has been setup - we can initiate connection
        guacRef.current.connect(getConnectionString());

        // Specify how to clean up after this effect:
        return function cleanup() {
            // Disconnect Guacamole Client, so server know'w we don't need any updates and teminates connection
            // to server
            guacRef.current.disconnect();
        };