Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Uncaught TypeError: Cannot read property 'play' of undefined" #85

Closed
tobilg opened this issue Jun 29, 2015 · 8 comments
Closed

Comments

@tobilg
Copy link

tobilg commented Jun 29, 2015

When using the ngAudio.play() method with a remote resource, I receive the above error on my console (version is 1.7.0 on the latest Chrome).

It fails at audio.play();, what leads me to the assumption that audio has not yet been initialized upon calling.

if (ngAudioGlobals.unlock) {

            window.addEventListener("click",function twiddle(){
                audio.play();
                audio.pause();
                window.removeEventListener("click",twiddle);
            });

        }
}

Furthermore, I think I'm unable to set ngAudio.unlock = false as outlined at http://danielstern.github.io/ngAudio/#/docs

@lbyers
Copy link
Collaborator

lbyers commented Jul 30, 2015

Hard to reliably reproduce (it is a race condition) but I have noted this behavior as well. I submitted a PR which moves that call into the closure that assigns the audio property.

@tsareg
Copy link

tsareg commented Sep 8, 2015

+1

@danielstern
Copy link
Owner

Fixed in PR

@danielcrisp
Copy link
Collaborator

Is the fixed version available through bower? I don't see it

@danielstern danielstern reopened this Sep 8, 2015
@danielstern
Copy link
Owner

Fix should be somewhere here:

https://github.com/danielstern/ngAudio/pulls?q=is%3Apr+is%3Aclosed

If not, please take a look and see if you can implement a fix / update the necessary bower versioning to make the fix available.

@danielcrisp
Copy link
Collaborator

I think you just need to push a new version / tag

I still see the old code here for v1.7.0

https://github.com/danielstern/ngAudio/blob/1.7.0/app/angular.audio.js#L145-L153

@danielstern
Copy link
Owner

Hey @danielcrisp,

I added you as a collaborator, so please feel free to push the new tag.

Cheers,
DS

@danielcrisp
Copy link
Collaborator

Thanks, done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants