How to use the howler.Howl.prototype 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 ksandin / darkestdungeon / src / polyfills / howlerVolumePatch.ts View on Github external
import {Howl} from 'howler';

(global as any).Howl = Howl;

const originalFade = Howl.prototype.fade;
const originalVolume = Howl.prototype.volume;

Howl.prototype.fade = function (from: number, to: number) {
  this.__monkeyPatchVolume = to;
  return originalFade.apply(this, arguments);
};

Howl.prototype.volume = function (volume: number) {
  // Setting volume
  if (arguments.length > 0) {
    this.__monkeyPatchVolume = volume;
    return originalVolume.apply(this, arguments);
  }

  // Getting volume
  if (this.__monkeyPatchVolume === undefined) {
    return originalVolume.apply(this, arguments);
github ksandin / darkestdungeon / src / polyfills / howlerVolumePatch.ts View on Github external
import {Howl} from 'howler';

(global as any).Howl = Howl;

const originalFade = Howl.prototype.fade;
const originalVolume = Howl.prototype.volume;

Howl.prototype.fade = function (from: number, to: number) {
  this.__monkeyPatchVolume = to;
  return originalFade.apply(this, arguments);
};

Howl.prototype.volume = function (volume: number) {
  // Setting volume
  if (arguments.length > 0) {
    this.__monkeyPatchVolume = volume;
    return originalVolume.apply(this, arguments);
  }

  // Getting volume
  if (this.__monkeyPatchVolume === undefined) {
    return originalVolume.apply(this, arguments);
  }
  return this.__monkeyPatchVolume;
github ksandin / darkestdungeon / src / polyfills / howlerVolumePatch.ts View on Github external
import {Howl} from 'howler';

(global as any).Howl = Howl;

const originalFade = Howl.prototype.fade;
const originalVolume = Howl.prototype.volume;

Howl.prototype.fade = function (from: number, to: number) {
  this.__monkeyPatchVolume = to;
  return originalFade.apply(this, arguments);
};

Howl.prototype.volume = function (volume: number) {
  // Setting volume
  if (arguments.length > 0) {
    this.__monkeyPatchVolume = volume;
    return originalVolume.apply(this, arguments);
  }

  // Getting volume
  if (this.__monkeyPatchVolume === undefined) {
github ksandin / darkestdungeon / src / polyfills / howlerVolumePatch.ts View on Github external
import {Howl} from 'howler';

(global as any).Howl = Howl;

const originalFade = Howl.prototype.fade;
const originalVolume = Howl.prototype.volume;

Howl.prototype.fade = function (from: number, to: number) {
  this.__monkeyPatchVolume = to;
  return originalFade.apply(this, arguments);
};

Howl.prototype.volume = function (volume: number) {
  // Setting volume
  if (arguments.length > 0) {
    this.__monkeyPatchVolume = volume;
    return originalVolume.apply(this, arguments);
  }

  // Getting volume
  if (this.__monkeyPatchVolume === undefined) {
    return originalVolume.apply(this, arguments);
  }
  return this.__monkeyPatchVolume;
};
github volumio / Volumio2-UI / src / app / services / browser-playback.service.js View on Github external
import ObserverService from './utils/observer-service';


const exampleTrack = 'http://techslides.com/demos/samples/sample.flac';


const hasTrackChanged = (a, b) => a.uri !== b.uri;
const hasPlayPauseChanged = (a, b) => a.status !== b.status;
const isPlaying = (a) => a.status === 'play';
const hasSeekChanged = (a, b) => a.seek !== b.seek;
const ensureURI = (uri, host) => uri.includes('://') ? uri : `${host}/api/streaming/native?uri=${encodeURIComponent(uri)}`;

/**
 * https://github.com/goldfire/howler.js/issues/825#issuecomment-446322017
 */
Howl.prototype.changeSrc = function (newSrc) {
  var self = this;
  self.unload(true);
  self._src = newSrc;
  self.load();
};

class BrowserPlaybackService extends ObserverService {
  constructor(socketService, $log) {
    'ngInject';
    super();
    this.socketService = socketService;
    this.$log = $log;
    this.howlerSoundID = undefined;
    this.prevServerState = {};
    this.sound = new Howl({
      src: [