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

launch browser example #5047

Conversation

ForrestTrepte
Copy link
Contributor

@ForrestTrepte ForrestTrepte commented Jun 25, 2019

Overview

Add a button that launches the Edge browser. This demonstrates that the browser slate can be launched while your application continues running. The web page that is launched contains controls modeled after the Unity GUI controls in the examples, showing a button, checkbox, slider, dropdown, and edit box. This demonstrates the option of integrating with existing web tools or of creating simple form UI using HTML and shows what this kind of interaction would feel like.

Note that I originally implemented this by calling the UWP LaunchUriAsync API, but later found out that is unnecessary because Unity's Application.OpenURL seems to work just as well.

Changes

Verification

Note that this references a web page in order to demonstrate using web controls from within a browser. Because I didn't want to host a web site for this purpose, I am linking to a page on github. That page won't exist unless this PR is first merged to mrtk_development.

If you would like to try this change locally, you can change the URL to point to the HTML file in my fork as follows:

  • In HandInteractionExamples.unity, select the SceneContent/LaunchBrowserButton object.
  • In the inspector, scroll down to the Interactable OnClick event. Change the URL to the following: http://htmlpreview.github.io/?https://raw.githubusercontent.com/ForrestTrepte/MixedRealityToolkit-Unity/feature/launchBrowser/Assets/MixedRealityToolkit.Examples/Demos/HandTracking/WebForm/SampleWebForm.htm.

@julenka julenka self-assigned this Jun 26, 2019
@julenka
Copy link
Contributor

julenka commented Jun 27, 2019

Note that I originally implemented this by calling the UWP LaunchUriAsync API, but later found out that is unnecessary because Unity's Application.OpenURL seems to work just as well.

Could you please still include the LaunchUriAsync example as well (perhaps a button next to the webpage button that opens settings by launching ms-settings://)? That will teach people that you can actually launch any UWP as long as it implements a protocol.

Copy link
Contributor

@julenka julenka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice and simple. Thanks! Only request is that you please add an example to also still launch a Uri via LaunchUriAsync, see my comment above. I see that as teaching people they can launch any UWP, not just the browser. Otherwise people will think that they can only launch the browser and nothing else.

@julenka
Copy link
Contributor

julenka commented Jun 27, 2019

Could you also please include a screenshot of the new button you added to the scene as part of this PR, so we can find it and also visually review the code? Even better would be a gif of the new behavior, if you have time. For example, here's a really nice PR that demonstrates including screen shots and gifs: #4532. It's very useful to have that for any new user-facing features.

@ForrestTrepte
Copy link
Contributor Author

ForrestTrepte commented Jun 27, 2019

I'd be happy to capture a gif if there's an easy way to do that. Is there a tool that folks recommend for converting the .mp4 from a mixed reality capture into a gif? Would I need to make it super-short or downsample it so that the file size isn't too large for github? @Cameron-Micka, please let me know if you have any tips for doing this.

@Cameron-Micka
Copy link
Member

@ForrestTrepte I've just been using the tool @jwittner recommends called LICEcap. GitHub only accepts files up to 10Mbs, so if I find I'm over that limit I resize and/or compress my gif from LICEcap with this online tool: https://ezgif.com/resize

No actual changes. Just letting Unity make the changes that it wants to apply so that hopefully changes that I make later will be easier to understand.
@ForrestTrepte
Copy link
Contributor Author

The latest implementation includes two buttons for launching aka.ms/mrdocs and settings.
Launch

@ForrestTrepte
Copy link
Contributor Author

@julenka: Ready for re-review.

Copy link
Contributor

@julenka julenka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just one small nit.

@julenka
Copy link
Contributor

julenka commented Jun 28, 2019

/azp run mrtk_pr

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…LaunchUri.cs

Co-Authored-By: Julia Schwarz <julenka.schwarz@gmail.com>
@julenka
Copy link
Contributor

julenka commented Jun 29, 2019

/azp run mrtk_pr

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@julenka julenka merged commit cc75a89 into microsoft:mrtk_development Jul 1, 2019
@csxbwang
Copy link

How to locate the launched browser to the specified location?

@jwittner
Copy link
Member

@csxbwang - in my experience the window is spawned by the OS in a "follow" mode and stays in my view until I pin it.

@csxbwang
Copy link

@csxbwang - in my experience the window is spawned by the OS in a "follow" mode and stays in my view until I pin it.

Can I write codes to control the launched window, for example, automatically pin it and translate it to pre-defined location by attaching a world anchor?

@Wolvie9
Copy link

Wolvie9 commented Sep 22, 2020 via email

@jwittner
Copy link
Member

@csxbwang - not something I've tested, but looking at the APIs I don't believe so. You're effectively launching a URI directly into the system and then letting it do it's thing. I'm not certain there aren't APIs for controlling external applications, but due to the sandbox nature of UWP I'm not optimistic they exist.

@paulparkinson
Copy link

paulparkinson commented Jan 8, 2021

In addition to not being able to position the launched program/browser, it seems you can only launch one (at least using LaunchUri). Any thoughts on how to launch multiple?

@ForrestTrepte
Copy link
Contributor Author

Note that this is an old (merged) pull request. @paulparkinson, for posterity, if you don't receive an answer here you may want to open a feature request issue.

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

Successfully merging this pull request may close these issues.

Fature-Request: Display Browser Window in 3D space
7 participants