Code Monkey home page Code Monkey logo

Comments (14)

zohararad avatar zohararad commented on September 25, 2024

@xxneon I'm afraid I cannot reproduce this on my local machine using IE11 on Windows 7. It seems like play/pause events are fired properly.

Did you check that you're using the on keyword rather than the one keyword to bind event listeners?

from audio5js.

xxneon avatar xxneon commented on September 25, 2024

I am using on. (via Angular) Also, I see the bug when viewing your demo page as well. http://zohararad.github.io/audio5js/

You have the audio set to loop and after it plays through once it won't pause. On my machine I traced the error back to when the listeners are added to the audio element itself.

from audio5js.

zohararad avatar zohararad commented on September 25, 2024

The play event is fired correctly when pausing and playing the audio, as per the HTML5 audio spec. Looping doesn't mean the audio needs to pause.

I'm can add the playing event support to the HTML5 player if you need to hook into that event specifically, although I'm a bit reluctant to do so as mirroring this behaviour in the Flash version might be a bit of a stretch.

If you need to hook into a loop behaviour, perhaps you can use the ended event?

from audio5js.

xxneon avatar xxneon commented on September 25, 2024

So you can't reproduce this odd behavior when you try to play an audio file more than once on IE11? (or if it loops automatically)

from audio5js.

zohararad avatar zohararad commented on September 25, 2024

It's not that I can't reproduce it, it's that checking a simple use case of play/pause fires the events correctly when playing / pausing multiple times.

Are you playing audio in a loop? What exactly are you trying to accomplish / build?

from audio5js.

xxneon avatar xxneon commented on September 25, 2024

Simple play/pause works fine form e as well. It's only when the audio finishes and you try to play the audio a 2nd time. The play/pause is broken if you replay the audio. It also breaks when the audio is set to loop. Your example page loops the audio and when it starts to loop the audio play/pause is broken.

All I'm trying to do is all the user to replay the audio. And forcing my code to destroy and recreate the audio just so i can play/pause when replaying the audio seems silly.

IE11 appears to only effectively dispatch the play event the 1st time through. After it reaches the end and you replay the audio it doesn't dispatch play events anymore. It only dispatches playing events.

Sorry if that doesn't make sense.

from audio5js.

zohararad avatar zohararad commented on September 25, 2024

Ok... got it - So, would it be possible for you to post a simple example of your code that I can play with? I'll try to re-create the problem in IE11 and find a work-around / fix

from audio5js.

belldandu avatar belldandu commented on September 25, 2024

@xxneon So 8 months with no reply on whether you fixed the issue (with a code example of how to fix) or whether the issue was a false alarm.

@zohararad can you close this if xxneon does not respond within 24-48 hours?

from audio5js.

zohararad avatar zohararad commented on September 25, 2024

@KamijouTouma sure things, thanks for the reminder. @xxneon please let me know where this stands.

from audio5js.

xxneon avatar xxneon commented on September 25, 2024

To fix my issue I changed the following lines..
https://github.com/zohararad/audio5js/blob/master/audio5.js#L552
https://github.com/zohararad/audio5js/blob/master/audio5.js#L567

New Line 552: this.audio.addEventListener('playing', this.listeners.play, false);
New Line 567: this.audio.removeEventListener('playing', this.listeners.play);

All browsers that I tested dispatch play & playing events. Like I mentioned previously, IE11 correctly dispatches 'play' events during the 1st play of the audio. But when you replay the audio IE11 stops dispatching 'play'. IE does dispatch 'playing' all the time.

I propose changing the event listener to 'playing' since all browsers dispatch play and then playing afterwards.

Hope this helps.

from audio5js.

belldandu avatar belldandu commented on September 25, 2024

@xxneon So are you saying that when you click play after its done playing the browser sends 'playing' instead?

http://caniuse.com/#feat=audio-api

IE doesnt even officially support the web audio api anyway which is probably why the 'ended' event isn't even being fired in the browser (which is why IE always says 'playing'). Edge however (IE's replacement) Does officially support the web audio api. So in this case a fallback is required but in all honestly we need something other then flash for a fallback.

Even on this page https://dev.windows.com/en-us/microsoft-edge/platform/status/webaudioapi , IE clearly says its not supported and is even whited out in between firefox and opera.

@zohararad
What I'm wondering is why you don't have an event listener for 'playing' already anyway e.e?

Did you not care about the event or just forgot or didn't know about it?

Also flash needs to be fallen back upon if the browser is IE and not EDGE regardless if the user specifies a swf_path or not. (if its not already doing so.)
Or you can alternatively use the real audio element (not the API) http://caniuse.com/#feat=audio for IE 9 -11 only.

from audio5js.

zohararad avatar zohararad commented on September 25, 2024

@KamijouTouma the "playing" event must've slipped my mind. I wasn't trying to replicated the entire event spec, only the useful bits. I'm happy to add it though i need to see how to add it in the Flash version (maybe "play" followed by "playing" immediately)

from audio5js.

belldandu avatar belldandu commented on September 25, 2024

Yeah. The playing event is always fired immediately after play.
Also this issue should be closed based on the fact that the web audio api is not supported by IE at all. But only after an alternative has been chosen (either using real audio tag in IE 9-11 only or falling back on flash in all IE regardless of whether the user specifies an swf path or not).
@zohararad

from audio5js.

zohararad avatar zohararad commented on September 25, 2024

added support for "playing" event firing natively in HTML5 or after "play" event in Flash player. This should allow for selective implementation on annoying browsers. Hope this helps @xxneon

from audio5js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.