HISE Logo Forum
    • Categories
    • Register
    • Login

    Stumped by displaying webpage in WebView

    Scheduled Pinned Locked Moved Scripting
    12 Posts 2 Posters 267 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      LozPetts
      last edited by

      Hi everyone!
      I'm trying to display a live webpage in HISE (50% just as a learning exercise but I have an idea for a potential updater/downloader app down the line that would 100% require this).

      I've looked through the docs, I've got the example projects (I'm building off of this at the mo) and I have this so far:

      HiseSnippet 2332.3oc4ZrsbaabcAoVYcwR9RTp6LsOfwSePdrKuH4nX2NcLkDkhTstvgjV1uoYEvRwMBbWDfERhMSm1GyCcl9I0L8WH+.8SH+AsmcA.wBQJUJFmTkovdjwdNm8baOmCNmUtQfvgFFJBPVy1tuOEYcebq9bY2M6RXbzt0QVKfaPjc25RROeOJZi99jvPpKxxp3WnHwZ1oP5mu+MaP7HbGZFHD5HAygtGqGSlAsQs2x771l3Ray5YP8KqsqifuovSDApSQbEjOw4LxozCHJxJfQVSukKSJBZIIRZHxZpMDt8a0UbAOl9iXgrS.kDVTE0BXTL3sEdtJMVAEsYWlmaiTyNDgrvMxbBEicBKg2m4xF.OyY7PMB6rcX5OrJjW8JlS8pZpdULTuQnRELToohUoGga4Dv7kYXT5y73c4RZPGhS9ilXZQEbKf2T.Tvkk5QNitc.rXvNVtZkJUdg8ZeVkm86matxks2LfBZtsrK098zSNhQuvlw0KE7c4LocmHtijI3yk9RBhkel8WOmM7jwDRJKzvOmDXeQBK+C1NZRRvu7SSd4oJsHgIsnRsbCY+IfUbWaeQHSKYEAIbpTHUtgHh6FtLXFveek1bp.lihGq69kQgxDVDZyoTHJXfD1SPb0hXm16umcGlGMGq8.zuq4dK+TEleW4xO0941mRUd+uj5HqyBfeJB5CF9yse5t8fnzvx9PdxukFmnTlwcoWVpqrmmocstqaN2qTnWxRORzzQbcUGZABukSTGfC+YSe9ABI8P9xOat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uZ.e9luq1NrgfhpW6Jcfzl1yWjukAHpp3Omtikw969foaem9xKeBFZBbEacFl8+aRw9o3.6mBYzi3DHNN4ZbTIuyng.1MW++kjYw6qVaWc3aCuGzr5wNN4Y0PabkIciqNoa7kS5F+rIciqMoa7ymzM9p+6aTMKQx8enxMfYpZrU732Vo2jCjlf9OZVv6XB
      

      My HTML file is under Images/path-example/index.html and looks like this, I'm trying to redirect to my website just to see if it works.

      <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Redirecting...</title>
          <script>
              function redirectToNevermoreAudio() {
                  window.location.href = "https://www.nevermoreaudio.co.uk";
              }
              window.onload = redirectToNevermoreAudio;
          </script>
      </head>
      <body>
          <p>Redirecting to Nevermore Audio...</p>
      </body>
      </html>
      

      Fully admit to borrowing from ChatGPT here, I learn best when I'm reverse engineering a working example rather than reading through docs etc, just how my brain works unfortunately! First time using ChatGPT for HISE and it's gotten a lot of stuff wrong, no surprise there.

      I know this is possible as I can see people on the forum have it working but I can't see a working snippet I can take apart/play with to understand how it's all fitting together.

      Can anyone point me in the right direction?

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @LozPetts
        last edited by

        @LozPetts said in Stumped by displaying webpage in WebView:

        I learn best when I'm reverse engineering a working example

        That GPT example is garbage, you won't learn anything from it.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        L 1 Reply Last reply Reply Quote 0
        • L
          LozPetts @d.healey
          last edited by

          @d-healey Yeah I thought as much when I had to go in and start correcting syntax. I suck at HTML and it made mistakes even I could spot.

          I can't see an example that shows a redirecting to a webpage within the UI in HISE, do you know of one? I can see people have it working on the forum but explanations as to how seem thin on the ground.

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @LozPetts
            last edited by

            @LozPetts said in Stumped by displaying webpage in WebView:

            do you know of one?

            The webview doesn't work on Linux so I haven't taken much interest in it. I know some other people are using it successfully though so maybe you'll get some responses.

            In the meantime you should go through the scripting basics so you can see how dreadful that GPT output is.

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            L 1 Reply Last reply Reply Quote 0
            • L
              LozPetts @d.healey
              last edited by

              @d-healey Yeah it's terrible, I just thought I'd try it, it's helped me with some CSS stuff recently and it did 'okay'

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @LozPetts
                last edited by

                @LozPetts It's pretty good with css, javascript, c++, python, etc. All the major languages, because there is loads of data that it's trained on. But that data doesn't exist for HISE and it doesn't understand HISE scripting at all. It will just return some unhinged Javascript.

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                L 1 Reply Last reply Reply Quote 0
                • L
                  LozPetts @d.healey
                  last edited by

                  @d-healey Figured as much, just thought I'd give it a go! Hopefully someone with WebView experience chimes in

                  L 1 Reply Last reply Reply Quote 0
                  • L
                    LozPetts @LozPetts
                    last edited by

                    @LozPetts So I started again based on a recent thread from Clevername27 - I'm now here -

                    Content.makeFrontInterface(1000, 650);
                    
                    const var web_DOCS_CoreHTML_GUI = Content.getComponent("web_DOCS_CoreHTML_GUI");
                    
                    // WebView
                    
                    // HTML file points redirects to internet
                    var startingPage = FileSystem.getFolder(FileSystem.AudioFiles).getParentDirectory().getChildFile("Images/path-example/index.html");
                    
                    web_DOCS_CoreHTML_GUI.set("enableCache", true);
                    web_DOCS_CoreHTML_GUI.reset();
                    web_DOCS_CoreHTML_GUI.setIndexFile(startingPage);
                    
                    

                    With the suggested HTML test file below located at the path detailed in the code above:

                    <!doctype html>
                    <html>
                    <head>
                    <meta charset="UTF-8">
                    <title></title>
                    <meta http-equiv="refresh" content="0; URL=https://www.ferretsfightingllamas.com" />
                    </head>
                    <body>
                    </body>
                    </html>
                    

                    I have no idea what Ferretsfightingllamas.com is but I'm excited to find out when this gets working haha.

                    I currently get a white webview window with my HTML file displayed on a dark background.

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @LozPetts
                      last edited by

                      @LozPetts said in Stumped by displaying webpage in WebView:

                      var startingPage

                      This should probably be a const, it definitely shouldn't be a var. That whole file path seems weird, why is the html going in the project's Images folder?

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      L 1 Reply Last reply Reply Quote 0
                      • L
                        LozPetts @d.healey
                        last edited by

                        @d-healey Because that's where they are in the example projects on GitHub, to do with making sure they get embedded correctly perhaps?

                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @LozPetts
                          last edited by

                          @LozPetts said in Stumped by displaying webpage in WebView:

                          Because that's where they are in the example projects on GitHub

                          Oh, seems strange but I guess that's where they are meant to be then

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          L 1 Reply Last reply Reply Quote 0
                          • L
                            LozPetts @d.healey
                            last edited by

                            Bump - anyone with web view experience able to weigh in? I've done some more playing around and can't get any further with it.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            31

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            102.3k

                            Posts