Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
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;
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) {
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;
};
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: [