HISE Logo Forum
    • Categories
    • Register
    • Login

    WebView Not Scaling With Zoom Factor

    Scheduled Pinned Locked Moved Bug Reports
    16 Posts 6 Posters 1.1k 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.
    • Casey KolbC
      Casey Kolb
      last edited by

      We're trying to get the WebView component to scale automatically with the plugin zoom factor but we're not sure how. Is this something we need to handle or is this a bug with the component?

      Casey Kolb
      Founder & CEO of Lunacy Audio
      Composer | Producer | Software Developer

      1 Reply Last reply Reply Quote 2
      • Dan KorneffD
        Dan Korneff
        last edited by

        Is WebView like an embedded web browser?

        Dan Korneff - Producer / Mixer / Audio Nerd

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

          @Dan-Korneff https://forum.hise.audio/topic/7629/choc/7?_=1689121523376

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

          Christoph HartC 1 Reply Last reply Reply Quote 1
          • Christoph HartC
            Christoph Hart @d.healey
            last edited by

            This was rather complicated but I have put in some extra effort to support the scale factor (in fact 50% of the implementation time went into this issue).

            What OS? And check the compiled plugin, the interface designer does not use the plugin scale factor so zooming in there might not work.

            Do the webview examples scale correctly?

            ulrikU Casey KolbC 3 Replies Last reply Reply Quote 2
            • ulrikU
              ulrik @Christoph Hart
              last edited by

              @Christoph-Hart said in WebView Not Scaling With Zoom Factor:

              Do the webview examples scale correctly?

              Compiled as stand alones (Mac), yes.

              zoom.gif

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              1 Reply Last reply Reply Quote 1
              • Casey KolbC
                Casey Kolb @Christoph Hart
                last edited by Casey Kolb

                @Christoph-Hart On Mac for me, but I'll do some additional testing.
                On startup, I think the issue was when you load the standalone at 125% from your saved settings the WebView wouldn't automatically scale.

                Casey Kolb
                Founder & CEO of Lunacy Audio
                Composer | Producer | Software Developer

                1 Reply Last reply Reply Quote 0
                • Casey KolbC
                  Casey Kolb @Christoph Hart
                  last edited by

                  @Christoph-Hart Here's an example of what happens when we load CUBE standalone at 125% with our login view:

                  WebView Not Scaling on Startup (720p).gif

                  The WebView doesn't scale to the 125% setting like the rest of the interface. Maybe there just needs to be a check on startup?

                  Casey Kolb
                  Founder & CEO of Lunacy Audio
                  Composer | Producer | Software Developer

                  Christoph HartC 1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart @Casey Kolb
                    last edited by

                    @Casey-Kolb no the webview examples in the tutorial scale correctly when restarted. I noticed that there is a small delay in the login popup. Maybe it happens only if the visibility is changed after startup, I'll check that.

                    Christoph HartC 1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart @Christoph Hart
                      last edited by

                      Actually the preset browser example had the same issue. I've fixed it by introducing a small delay for the scale factor update - it seems that if the webview isn't loaded, then the scaling update will be ignored.

                      Let me know if that helped.

                      Casey KolbC 1 Reply Last reply Reply Quote 1
                      • Casey KolbC
                        Casey Kolb @Christoph Hart
                        last edited by

                        @Christoph-Hart Excellent! I'll try it out.

                        Casey Kolb
                        Founder & CEO of Lunacy Audio
                        Composer | Producer | Software Developer

                        Christoph HartC 1 Reply Last reply Reply Quote 0
                        • Christoph HartC
                          Christoph Hart @Casey Kolb
                          last edited by

                          @Casey-Kolb Actually I found a better fix - the previous one was relying on a timer delay which might work, but now it's much more reliable because it executes the scale factor update when the DOM is loaded.

                          Let me know if that's better. I need to test this on Windows tomorrow, but on macOS it's much more stable IMHO.

                          Casey KolbC 1 Reply Last reply Reply Quote 1
                          • Casey KolbC
                            Casey Kolb @Christoph Hart
                            last edited by

                            @Christoph-Hart Yep, this worked like a charm on Mac.

                            Casey Kolb
                            Founder & CEO of Lunacy Audio
                            Composer | Producer | Software Developer

                            Christoph HartC 1 Reply Last reply Reply Quote 0
                            • Christoph HartC
                              Christoph Hart @Casey Kolb
                              last edited by

                              One thing I noticed is that now you cannot use window.innerWidth / window.innerHeight in your JS code anymore as this will be initialized correctly once but will not be updated correctly when the scale factor changes. Instead, just use the actual size of the webview as fixed pixel value, then it works.

                              BrianB 1 Reply Last reply Reply Quote 1
                              • BrianB
                                Brian @Christoph Hart
                                last edited by

                                @Christoph-Hart quick side question , if we have audio being streamed via the browser from a web url source ( context being able to preview a demo of a sound etc.) I am assuming that this will not play through HISE. Might there be a way to be able to set this via scripting ? :)

                                Christoph HartC 1 Reply Last reply Reply Quote 0
                                • Christoph HartC
                                  Christoph Hart @Brian
                                  last edited by

                                  @Brian Getting access to the webviews audio output is not possible but if it's just for streaming a demo track you could just call a HISE function from your JS that will download the particular file and start previewing it.

                                  Webview code:

                                  <button onclick='onPreview("beat.wav")'>Preview</button>
                                  
                                  <div id="valueDisplay">This will show the preview progress</div>
                                  
                                  <script>
                                  window.onFileLoad = function(message)
                                  {
                                    document.getElementById("valueDisplay").innerHTML = message;
                                  }
                                  </script>
                                  

                                  HISE:

                                  inline function playFile(f)
                                  {
                                  	local channels = f.loadAsAudioFile();
                                  				
                                  	for(c in channels)
                                  		c *= 0.125; // apply -12dB gain
                                  		
                                  	Engine.playBuffer(channels, function(args, obj){
                                  		wv.callFunction("onFileLoad", "Position: " + obj);
                                  	}, f.loadAudioMetadata().SampleRate);
                                  }
                                  
                                  function onPreview(args)
                                  {
                                  	Server.setBaseURL("https://hise.audio");
                                  	
                                  	var f = FileSystem.getFolder(FileSystem.Desktop).getChildFile(args[0]);
                                  	
                                  	if(f.isFile())
                                  	{
                                  		playFile(f);
                                  	}
                                  	else
                                  	{
                                  		Server.downloadFile(args[0], {}, f, function [f]()
                                  		{
                                  			var message = "Downloading ";
                                  			
                                  			message += Engine.doubleToString(this.data.numDownloaded / 1024.0 / 1024.0, 1);
                                  		    message += "MB / " + Engine.doubleToString(this.data.numTotal / 1024.0 / 1024.0, 1) + "MB";
                                  		    
                                  		    wv.callFunction("onFileLoad", message);
                                  		     
                                  		    if(this.data.finished && this.data.success)
                                  				playFile(f);
                                  		});
                                  	}
                                  }
                                  
                                  wv.bindCallback("previewFile", onPreview);
                                  
                                  BrianB 1 Reply Last reply Reply Quote 1
                                  • BrianB
                                    Brian @Christoph Hart
                                    last edited by

                                    @Christoph-Hart thank you! That should do the job just perfectly! We'll report back on how this goes :)

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

                                    17

                                    Online

                                    1.7k

                                    Users

                                    11.9k

                                    Topics

                                    103.4k

                                    Posts