How to use the howler.Howler.ctx function in howler

To help you get started, we’ve selected a few howler 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 google / skia-buildbot / skottie / modules / audio.js View on Github external
this.seek = function(t) {
    if (!this.playing && t >= 0) {
      // Sometimes browsers will prevent the audio from playing.
      // We need to resume the AudioContext or it will never play.
      if (Howler.ctx.state == "suspended") {
        Howler.ctx.resume().then(() => this.howl.play());
      } else {
        this.howl.play();
      }
      this.playing = true;
    }

    if (this.playing) {
      if (t < 0) {
        this.howl.stop();
        this.playing = false;
      } else {
        const playerPos = this.howl.seek();

        if (Math.abs(playerPos - t) > kTolerance) {
          this.howl.seek(t);
github google / skia-buildbot / skottie / modules / audio.js View on Github external
this.seek = function(t) {
    if (!this.playing && t >= 0) {
      // Sometimes browsers will prevent the audio from playing.
      // We need to resume the AudioContext or it will never play.
      if (Howler.ctx.state == "suspended") {
        Howler.ctx.resume().then(() => this.howl.play());
      } else {
        this.howl.play();
      }
      this.playing = true;
    }

    if (this.playing) {
      if (t < 0) {
        this.howl.stop();
        this.playing = false;
      } else {
        const playerPos = this.howl.seek();

        if (Math.abs(playerPos - t) > kTolerance) {
          this.howl.seek(t);
        }
github calebomusic / freedm / frontend / components / visualizer / visualizer.jsx View on Github external
setup() {
    const canvas = document.getElementsByTagName('canvas')[0];
    this.WIDTH = canvas.width;
    this.HEIGHT = canvas.height;

    this.analyser = Howler.ctx.createAnalyser();
    Howler.masterGain.connect(this.analyser);
    this.analyser.connect(Howler.ctx.destination);
    this.canvasCtx = canvas.getContext("2d");

    this.analyser.fftSize = 256;
    this.bufferLength = this.analyser.frequencyBinCount;
    this.dataArray = new Uint8Array(this.bufferLength);
  }
github calebomusic / freedm / frontend / components / visualizer / visualizer.jsx View on Github external
setup() {
    const canvas = document.getElementsByTagName('canvas')[0];
    this.WIDTH = canvas.width;
    this.HEIGHT = canvas.height;

    this.analyser = Howler.ctx.createAnalyser();
    Howler.masterGain.connect(this.analyser);
    this.analyser.connect(Howler.ctx.destination);
    this.canvasCtx = canvas.getContext("2d");

    this.analyser.fftSize = 256;
    this.bufferLength = this.analyser.frequencyBinCount;
    this.dataArray = new Uint8Array(this.bufferLength);
  }
github Tian-Hun / biger-music / src / app / core / player.service.ts View on Github external
private createAnalyser(): void {
        const analyser = Howler.ctx.createAnalyser();
        Howler.masterGain.connect(analyser);
        this.analyserChange.next(analyser);
    }