alpha icon indicating copy to clipboard operation
alpha copied to clipboard

Position of audiohandle doesn't work on web

Open ghost opened this issue 9 years ago • 3 comments

There is example:

var handle = Luxe.audio.play(source, volume);

override function update (dt:Float){
     trace(Luxe.audio.position_of(handle)); // so, it always outputs: 0
}

And what it must output?

ghost avatar Aug 16 '16 11:08 ghost

What are you testing on? How long is the sound?

I put this in tests/features/audio:

    override function update(dt:Float) {

        if(Luxe.audio.state_of(last_played) == luxe.Audio.AudioState.as_playing) {
            trace(Luxe.audio.position_of(last_played));
        }

    }

And it works as expected on native. On web it will return 0

The reason is largely because web audio api doesn't support this concept (yet, maybe). I was intending to look into implementing the work arounds but I've been focused elsewhere.

ruby0x1 avatar Aug 16 '16 22:08 ruby0x1

Yes, I worked on Web target. It's not very good news for me, but I'll wait for changes.

ghost avatar Aug 17 '16 02:08 ghost

Not much I can do about browsers not supporting these basic features I'm afraid! I'll see if we can work around it but it's probably not going to be a best fit until the browsers finish the API. For streaming sounds I think the position is knowable already, which I'll add soon.

ruby0x1 avatar Aug 17 '16 02:08 ruby0x1