Skip to content

loadUrl returns blank screen #2

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

Closed
kapilrc opened this issue Oct 8, 2020 · 2 comments
Closed

loadUrl returns blank screen #2

kapilrc opened this issue Oct 8, 2020 · 2 comments

Comments

@kapilrc
Copy link

kapilrc commented Oct 8, 2020

Hi @leolabs @NeoLegends @mraerino

I am trying to airplay secondary screen (html page) by calling method

cordova.plugins.externalScreen.createScreenListener().then(res => {
    Externalscreen = res;
   ExternalScreen.loadUrl("path/to/html/page")
});

This path is relative to the app folder, is displaying blank.

Could you please help me understand it. Below is the code

let Externalscreen = await cordova.plugins.externalScreen.createScreenListener(); //works
Externalscreen.on("disconnect", r => console.log("disconnected", r), e => console.error("unable to disconnect", e)); //works
Externalscreen.on("connect", r => console.log("connected", r), e => console.error("unable to connect", e)) ////works
var url = await Externalscreen.loadUrl(".path/to/html-page"); //returns blank screen - not working
Externalscreen.emit("title", {name: "ABC"}) // couldn't try

If I get a demo doc it will be really helpful.

@kapilrc kapilrc changed the title loadUrl return blank screen loadUrl returns blank screen Oct 8, 2020
@NeoLegends
Copy link
Member

NeoLegends commented Oct 12, 2020

I think you need to wait for the connected event to fire to be able to open a web view. That event tells you that an external screen is available / has been connected and that you can start putting data onto it. Without an externals screen, how would you show a web view? 🤷🏼‍♂️

So something like (untested, you might need to make adaptations):

externalScreen.on("connect", () => externalScreen.loadUrl("<some-url>"));

In addition, for future issues, it will be much more helpful if you give us an actual example of what you're trying to achieve and some background information, and not just dump some code snippets and expect us to make sense of them. We built this plugin in our free time, released it into the open-source domain free of charge and while we strive to make it useful to the world, it takes us time to respond to issues, too. So, the more you help us by writing better issues, the more we can help you by being able to understand your issues better.

@kapilrc
Copy link
Author

kapilrc commented Oct 15, 2020

Created a pull request #4 that resolves the blank screen issue. Tested on Cordova 9.0.0 and iOS platform 6.0.0
I would share the sample app very soon that Airplays Secondary screen on TV.

@kapilrc kapilrc closed this as completed Oct 15, 2020
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

2 participants