Howler.js: new src?

Created on 17 Dec 2016  路  7Comments  路  Source: goldfire/howler.js

I would like to either assign a new src or create new sprites with a function - but I can't figure it out...

First I tried:
var mysound = new Howl({
src:['mysound1.ogg']
});

function changeIt(){
sound.src(['mysound2.ogg']);
};

This doesn't work. There is a comment from Jason Simpson on version 1 stating this was a bug and was fixed, but that was back when urls: was used instead of src: Regardless, there are further comments confirming it still didn't work.

So... then I tried creating a new howl within a function like:

function newSprite(){
var mysound = new Howl({
src:['mysound2.ogg']
});
};

...and this doesn't work either. I am stuck. Does anyone have any ideas?

Most helpful comment

+1 -- I think this is relevant today in light of the HTML5 Audio throttling that Safari (and soon Chrome) are doing where new Audio events can't be fired unless the user directly initiates. Presents a pretty big problem for music websites.

According to this thread: https://github.com/scottschiller/SoundManager2/issues/178 -- the issue can be avoided by simply adding songs to the Audio element rather than creating a whole new one.

Thoughts? Have you seen this issue yet?

All 7 comments

I found a workaround to what I was trying to do.

The ability to swap out sources in a specific Howl instance was remove din 2.0 because it never really worked correctly in 1.x and there didn't seem to be a good way to make it work correctly in all situations. Would you mind posting what your solution was so that others might find it useful? Thanks!

No solution. I just found another way to reach a much deeper goal, this: https://github.com/goldfire/howler.js/issues/669 I created a new thread since I didn't think it would make sense here.

I know this was closed due to the original poster, but I'd also like to see the functionality of appending sources to the existing Howler instance. Do you have any current workarounds, @goldfire?

+1 -- I think this is relevant today in light of the HTML5 Audio throttling that Safari (and soon Chrome) are doing where new Audio events can't be fired unless the user directly initiates. Presents a pretty big problem for music websites.

According to this thread: https://github.com/scottschiller/SoundManager2/issues/178 -- the issue can be avoided by simply adding songs to the Audio element rather than creating a whole new one.

Thoughts? Have you seen this issue yet?

I'm thinking #825 might be describing a similar problem.

any new updates for this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tvbird picture tvbird  路  4Comments

inglesuniversal picture inglesuniversal  路  4Comments

jmeyers91 picture jmeyers91  路  4Comments

joshbruce picture joshbruce  路  4Comments

rowild picture rowild  路  3Comments