HISE Logo Forum
    • Categories
    • Register
    • Login

    Is it possible to insert a looping video in a UI?

    Scheduled Pinned Locked Moved General Questions
    29 Posts 5 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.
    • d.healeyD
      d.healey @LozPetts
      last edited by

      @LozPetts said in Is it possible to insert a looping video in a UI?:

      The other issue with this approach seems to be that obviously the knob has a certain range, is it possible to 'loop' the knob from 1.0 back to 0 automatically so that my filmstrip appears to loop forever?

      Link Preview Image
      HISE | Docs

      favicon

      (docs.hise.dev)

      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 I've found that but it doesn't seem to work, pasting it into hise in a blank project and filling in the filmstrip name etc throws an error

        HiseSnippet 1366.3oc6W8taaaCDWJIpaw6OXEXO.D9CCxotJxaC6C0nXsw1YwsMIF0oYcXXHfQhRhnxjBjzNwqHOk6EYuAaGojrjbbBxFv91DRLDui2we2u6H4oIBd.QJ4BK6cOaYFwx9ycltjoRFjfoLqwCsr+RmiwREQfxEcvxLrTRBsrs29mzBr2cGKyye9iGfSwr.RkHKqy4z.xanynpJoSdwqoooGhCImQmUa1e+KFGvYC3o74.d11w2JCG7AbL4DrdZa4XY+nQgTEWLUgUDok8NGvCWNMgeEKe9mSkzKSI5A8rlBNJW7g7zPMh0RsFjPSCmTF2RKvKSpXgsyYgu14XZHck7J13qLJPUVTmOr2pI71tA75cWvaCPxtFj1IGRO1YZfflopznwym4LlAImHLP60gR9bs15O9DmAbXFLk2L7GHGJfAqrv8G786hfe5zueq9s1eu8PCDDM1QXDkQif+UjzkHAGhHL.cTBAG5g1a+VTVJkQPQyYAJJmgBLFdDndZl.rxkAIstnq6hV1o0GagfmTd.NEcEMLlnPOGUhKbX3DLijV2h9FCL+TNMIQG5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e1T3n3.Br5LXiM3bG6szUQ4i80i0rwTBKzL3ufmBk8zisKT1qTo0LbffeQP9tCcexepQBfIl4SDfOdAC6hySClMM0o8YPm6WDDzzaqr0w4kxj+oFAeSx+awcZg9Skd4bEeVdBwx53IiLmaXaOho+bBSIn0eCxDkER.
        
        d.healeyD ulrikU 2 Replies Last reply Reply Quote 0
        • d.healeyD
          d.healey @LozPetts
          last edited by

          @LozPetts It was made in a really old version of HISE so probably requires some clean-up to run in a recent version

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

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

            @LozPetts I looked at the code and here's the error code

                    if(event.clicked)
                    {
                        // Store the current value for reference when dragging
                        widget.data.downValue = this.getValue();
                    }
            

            replacing "widget" with "this" solves it

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

            ulrikU 1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @ulrik
              last edited by

              @ulrik tried to set it up as an animation with a very small sprite, 19 frames 50x50, and it works

              spriteanimation.gif

              here's the project:
              project

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

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

                @LozPetts i see, you dont need the whole loop, you can loop this using davinci smooth cut to around 2 seconds. Other way is to separate dark and reflections ij photoshop and play them at different filmstrip speeds so it looks like an infinite loop.

                building user interfaces in HISE :)
                web: www.vst-design.com

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

                  @ulrik Thank you! Thank works beautifully - I had a few issues but I've got it going smoothly and it looks killer. Thank you to you all.

                  RE memory usage, I cropped the dead space from the video when I converted it to a film strip, according to the image pool table it looks like it's using around 100mb RAM, much better than expected.

                  @d-healey Once again thanks for your help - is there a way we can update the documentation to reflect the fix above? Or can only Christopher do that?

                  d.healeyD ulrikU 2 Replies Last reply Reply Quote 1
                  • d.healeyD
                    d.healey @LozPetts
                    last edited by

                    @LozPetts said in Is it possible to insert a looping video in a UI?:

                    it looks like it's using around 100mb RAM

                    How are you checking that?

                    @LozPetts said in Is it possible to insert a looping video in a UI?:

                    is there a way we can update the documentation

                    Link Preview Image
                    HISE | Docs

                    favicon

                    (docs.hise.dev)

                    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 I saw in another thread you advised someone to check the pool to see how much memory the bitmaps were using (if I understood correctly at least!). Created a popup window, Image pool table, although looking at it now it might not be showing the full size as hise sees it.

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

                        @LozPetts Perfect!

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

                        1 Reply Last reply Reply Quote 1
                        • ulrikU
                          ulrik @LozPetts
                          last edited by

                          @LozPetts What software do you use to create the sprites?
                          I've searched for a simple application for Mac OS but I only found some online sites who had that service but the sprite sheet was always horizontal and I had problems using the "offset x" instead of y, I couldn't get it to work (probably some stupid writing error from my side)

                          So I tried another approach with png sequences and loaded all pngs into the panel, and used the

                          g.drawImage(images[index], [0, 0, this.getWidth(), this.getHeight()], 0, 0);
                          

                          switching pngs instead of using the offset function.

                          Here's an example using 360 png files size 1920 x 1080, weight of 71mb
                          I scaled the display inside Hise to half the size.

                          It works quite well I think

                          spriteanimation.gif

                          But I would prefer to make sprite sheets so if you have any tip of software for Mac OS, let me know.

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

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

                            @ulrik said in Is it possible to insert a looping video in a UI?:

                            But I would prefer to make sprite sheets so if you have any tip of software for Mac OS, let me know.

                            Link Preview Image
                            Strip Generator | Blog | Wavesfactory

                            Free app that creates vertical and horizontal strips from a collection of JPG - PNG images.

                            favicon

                            (www.wavesfactory.com)

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

                            ulrikU 1 Reply Last reply Reply Quote 1
                            • ulrikU
                              ulrik @d.healey
                              last edited by

                              @d-healey I had forgotten this one, thanks David!

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

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

                                @ulrik That one didn't work properly for me so I use this:

                                Link Preview Image
                                CSS Sprite Generator - CSS Portal

                                Welcome to CSS Sprite Generator, the fastest way for you to make CSS sprites.

                                favicon

                                (www.cssportal.com)

                                What I did to get this working was:

                                • Trim the empty space from the video edges.
                                • Convert the video to GIF - https://ezgif.com/video-to-gif
                                • Extract the frames from the GIF as PNG files - https://ezgif.com/split
                                • Convert all the PNGs into a filmstrip with the above CSS Sprite Generator
                                • attach filmstrip to Panel in HISE.
                                /** Looping Video Panel */
                                inline function createHeadSprite(name, x, y)
                                {
                                    local widget = Content.addPanel(name, x, y);
                                    
                                    Content.setPropertiesFromJSON(name, {
                                      "width": WIDTH OF SINGLE PNG,
                                      "height": HEIGHT OF SINGLE PNG,
                                      "saveInPreset": true,
                                      "allowCallbacks": "Clicks, Hover & Dragging"
                                    });
                                    
                                    // Asset Strip
                                    widget.loadImage("{PROJECT_FOLDER}FILMSTRIP.png", "filmstrip");
                                    
                                    widget.setPaintRoutine(function(g)
                                    {
                                        // Calculate the index (the filmstrip has 100 slices, each ???px high
                                        var index = parseInt(this.getValue()*197.0);
                                        
                                        g.drawImage("filmstrip", [0, 0, this.getWidth(), this.getHeight()], 0, index * ???);
                                    });
                                    
                                    // This is the sensitivity of the rotation
                                    widget.data.sensitivity = 300;
                                    
                                    // Save the down value as reference for all drag deltas
                                    widget.data.downValue = 0.0;
                                    
                                    widget.setMouseCallback(function(event)
                                    {
                                        if(event.clicked)
                                        {
                                            // Store the current value for reference when dragging
                                            this.data.downValue = this.getValue();
                                        }
                                        
                                        if(event.drag)
                                        {
                                            // Use both axis to allow diagonal drag behaviour
                                            var delta = event.dragX + -1.0 * event.dragY;
                                            
                                            // normalize the delta using the given sensitivity
                                            var deltaNormalized = delta / this.data.sensitivity;
                                            
                                            // Calculate the new value and truncate it to 0...1
                                            var newValue = this.data.downValue + deltaNormalized;
                                            newValue = newValue - Math.floor(newValue);
                                            
                                            // Update the panel
                                            this.setValue(newValue);
                                            this.changed();
                                            this.repaint();
                                        }
                                    });
                                    
                                    return widget;
                                };
                                
                                const sprite = createHeadSprite("LOOPPANEL", X, Y);
                                
                                //	timer for animation (FPS)
                                reg count = 0;
                                sprite.setTimerCallback(function()
                                {
                                	count = (count+1) % 24;
                                	this.setValue(count * 1/24);
                                	this.changed();
                                });
                                //Speed
                                sprite.startTimer(62); //Play with this to set speed
                                

                                Hope that helps someone out!

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

                                26

                                Online

                                1.7k

                                Users

                                11.7k

                                Topics

                                102.3k

                                Posts