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

loadVideo doesnt call catch on error #57

Closed
blackmambahk opened this issue Oct 2, 2016 · 5 comments
Closed

loadVideo doesnt call catch on error #57

blackmambahk opened this issue Oct 2, 2016 · 5 comments
Labels
bug Something isn't working player

Comments

@blackmambahk
Copy link

Expected Behavior

The example code in the docs for loadVideo shows catching a 'PrivacyError' when loading a password protected resource.

Actual Behavior

A catch handler never gets called

Steps to Reproduce

If you try in the demo app to load a password protected resource it loads and displays the login screen as expected but the log shows no error output, and a breakpoint on line 409 of api-demo.js also never gets hit.

Tried it in my own local code first and had same issue. Although the rather than display the login it displays 'unhandled privacy error'.

This also raises another question, there seems no way to create a player without first setting a video url and therefore loading it, as the player on instantiation checks the iframe for a valid source and blows up if it doesn't find one. So at the moment I have to initially set a url to a small dummy video to get the player instantiated and then to allow me later to then call loadVideo to load the actual video I want.

@BernsteinA
Copy link

Does it work with a div instead of an iframe? Possible overlap with #58

@Nostrabramus
Copy link

I have the same problem, I use a div not an iframe
any feedback?

@rijk
Copy link

rijk commented Sep 25, 2017

I discovered by chance, that you can get this to work by setting an error handler on the player. It doesn't matter what the handler does, it just needs to be there.

Does not work:

this.player.loadVideo( id ).catch( this.props.onError )

(this.props.onError is never called)

Does work:

this.player.loadVideo( id ).catch( this.props.onError )
this.player.on( 'error', function() {} );

Note that even though the handler is called, it still does not receive the PrivacyError. I submitted a different issue for this (#164). Gotta love this package 😅

@mirague
Copy link

mirague commented Nov 12, 2017

@rijk That's an interesting workaround you found by chance, that definitely seems like unintended behaviour for sure. One should be able to rely on .catch() being fed the exception regardless of an on('error') handler.

@rebecca-sich
Copy link
Contributor

Hi @blackmambahk, @rijk, @mirague and others- You are correct to assume that .catch() should work as indicated in our ReadMe documentation. This has been fixed in our latest release- thank you for your patience. Closing the issue.

@luwes luwes added the bug Something isn't working label Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working player
Projects
None yet
Development

No branches or pull requests

8 participants