All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.devtools.webaudio.WebAudio Maven / Gradle / Ivy

Go to download

Selenium automates browsers. That's it! What you do with that power is entirely up to you.

There is a newer version: 4.0.0-rc-1
Show newest version
package org.openqa.selenium.devtools.webaudio;

import org.openqa.selenium.Beta;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.ConverterFunctions;
import com.google.common.collect.ImmutableMap;
import org.openqa.selenium.json.JsonInput;

/**
 * This domain allows inspection of Web Audio API.
 * https://webaudio.github.io/web-audio-api/
 */
@Beta()
public class WebAudio {

    /**
     * Enables the WebAudio domain and starts sending context lifetime events.
     */
    public static Command enable() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("WebAudio.enable", params.build());
    }

    /**
     * Disables the WebAudio domain.
     */
    public static Command disable() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("WebAudio.disable", params.build());
    }

    /**
     * Fetch the realtime data from the registered contexts.
     */
    public static Command getRealtimeData(org.openqa.selenium.devtools.webaudio.model.GraphObjectId contextId) {
        java.util.Objects.requireNonNull(contextId, "contextId is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("contextId", contextId);
        return new Command<>("WebAudio.getRealtimeData", params.build(), ConverterFunctions.map("realtimeData", org.openqa.selenium.devtools.webaudio.model.ContextRealtimeData.class));
    }

    public static Event contextCreated() {
        return new Event<>("WebAudio.contextCreated", ConverterFunctions.map("context", org.openqa.selenium.devtools.webaudio.model.BaseAudioContext.class));
    }

    public static Event contextWillBeDestroyed() {
        return new Event<>("WebAudio.contextWillBeDestroyed", ConverterFunctions.map("contextId", org.openqa.selenium.devtools.webaudio.model.GraphObjectId.class));
    }

    public static Event contextChanged() {
        return new Event<>("WebAudio.contextChanged", ConverterFunctions.map("context", org.openqa.selenium.devtools.webaudio.model.BaseAudioContext.class));
    }

    public static Event audioListenerCreated() {
        return new Event<>("WebAudio.audioListenerCreated", ConverterFunctions.map("listener", org.openqa.selenium.devtools.webaudio.model.AudioListener.class));
    }

    public static Event audioListenerWillBeDestroyed() {
        return new Event<>("WebAudio.audioListenerWillBeDestroyed", input -> input.read(org.openqa.selenium.devtools.webaudio.model.AudioListenerWillBeDestroyed.class));
    }

    public static Event audioNodeCreated() {
        return new Event<>("WebAudio.audioNodeCreated", ConverterFunctions.map("node", org.openqa.selenium.devtools.webaudio.model.AudioNode.class));
    }

    public static Event audioNodeWillBeDestroyed() {
        return new Event<>("WebAudio.audioNodeWillBeDestroyed", input -> input.read(org.openqa.selenium.devtools.webaudio.model.AudioNodeWillBeDestroyed.class));
    }

    public static Event audioParamCreated() {
        return new Event<>("WebAudio.audioParamCreated", ConverterFunctions.map("param", org.openqa.selenium.devtools.webaudio.model.AudioParam.class));
    }

    public static Event audioParamWillBeDestroyed() {
        return new Event<>("WebAudio.audioParamWillBeDestroyed", input -> input.read(org.openqa.selenium.devtools.webaudio.model.AudioParamWillBeDestroyed.class));
    }

    public static Event nodesConnected() {
        return new Event<>("WebAudio.nodesConnected", input -> input.read(org.openqa.selenium.devtools.webaudio.model.NodesConnected.class));
    }

    public static Event nodesDisconnected() {
        return new Event<>("WebAudio.nodesDisconnected", input -> input.read(org.openqa.selenium.devtools.webaudio.model.NodesDisconnected.class));
    }

    public static Event nodeParamConnected() {
        return new Event<>("WebAudio.nodeParamConnected", input -> input.read(org.openqa.selenium.devtools.webaudio.model.NodeParamConnected.class));
    }

    public static Event nodeParamDisconnected() {
        return new Event<>("WebAudio.nodeParamDisconnected", input -> input.read(org.openqa.selenium.devtools.webaudio.model.NodeParamDisconnected.class));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy