Movieplayer with animated GIF

  1. 4 days ago

    Dale A

    Mar 24 San Diego, California, USA

    I have an animated GIF that I want to use in my splash screen. So, I threw in a movieplayer and had it load and play the animated GIF. And it worked...mostly.

    The issue I see is that the movieplayer plays each frame of the GIF without clearing the previous one. Therein is my question. Is there a way to force the movieplayer to blank its display area between frames? I would really rather not have to break the animated GIF into individual images and paint them, in order, to a canvas.

    Full disclosure: Xojo 2019r3.1, Windows 10

  2. Norman P

    Mar 24 Pre-Release Testers, Xojo Pro outside drowning sorrows

    I'd try an htmlviewer with the gif embedded on it as raw data so you dont need a URL etc

  3. Dale A

    Mar 24 San Diego, California, USA

    @Norman P I'd try an htmlviewer with the gif embedded on it as raw data so you dont need a URL etc

    I've never tried that. In fact, I'm not even sure how to embed it as raw data.

  4. Norman P

    Mar 24 Pre-Release Testers, Xojo Pro outside drowning sorrows

    the src tag in an html image should do it

    https://en.wikipedia.org/wiki/Data_URI_scheme

    cant say I've done it but I know its possible

  5. Edited 4 days ago

    I did a quick test with Canvas, ImageWell, HtmlViewer, and MoviePlayer. The HtmlViewer and MoviePlayer worked perfect. The Canvas and ImageWell did not. HtmlViewer displayed it the best.

    I had this on a button to grab and display the image

    Sub Action()
      Dim fType As New FileType
      fType.Name = "image/gif"
      fType.MacType = "GIF"
      fType.Extensions = "gif"
      Dim f As FolderItem = GetOpenFolderItem(fType)
      
      If f Is Nil Then
        //user cancelled
        Return
      Else
        ImageWell1.Image = Picture.Open(f)
        
        Canvas1.Backdrop = Picture.Open(f)
        
        HTMLViewer1.LoadPage(f)
        
        MoviePlayer1.Movie = f.OpenAsMovie
      End If
      
    End Sub

    I had this on the HTMLViewer

    Sub DocumentComplete(URL as String)
      HTMLViewer1.ExecuteJavaScript("document.body.style['overflow-y'] = 'hidden';")
    End Sub

    And this on the MoviePlayer

    Sub Open()
      MoviePlayer1.AutoPlay = True
      MoviePlayer1.Looping = True
    End Sub

    None of this is truly my code. I just extracted from the following:
    http://forums.realsoftware.com/viewtopic.php?f=1&t=23968
    https://forum.xojo.com/45450-htmlviewer-disable-scrollbars/0
    https://forum.xojo.com/8053-animated-gif-support/0

  6. 3 days ago

    Dale A

    Mar 25 San Diego, California, USA

    Thanks for the suggestions. After some experimentation, I have decided that the most flexible method is to break the animated GIF into individual images and use a canvas to display the images in sequence. The speed of the animation can be controlled by a timer.

or Sign Up to reply!