Android Question SimpleMediaManager (SMM) .avif

Almora

Well-Known Member
Licensed User
Longtime User
Hello.
SMM does not open images with the .avif extension. Is there a way to handle this?

I'm using this for now

Code: Copy
Sub imageurl(url As String) As String
    If url = "" Then Return ""
    
    Dim lower As String = url.ToLowerCase
    If lower.Contains(".avif") Then
        Dim su As StringUtils
        Return "https://wsrv.nl/?url=" & su.EncodeUrl(url, "UTF8") & "&output=jpg&w=800&q=80"
    End If
    
    Return url
End Sub
 
Last edited:
This works, but there's no animation.
Code: Copy
    MediaManager.SetMediaWithExtra(Panel1, "https://convertico.com/samples/avif/animated-avif-lossless.avif", "image/avif", CreateMap())
 
Upvote 0
More information please. Is this an online image? What is the mime type?
Yes Online url.

Log("MIME: " & mimeType) >>>> MIME: image/avif
Code: Copy
If cd.thumi <> "" Then

    Dim mimeType As String = "image/*"

    If cd.thumi.ToLowerCase.Contains(".avif") Then
        mimeType = "image/avif"
    Else If cd.thumi.ToLowerCase.Contains(".png") Then
        mimeType = "image/png"
    Else If cd.thumi.ToLowerCase.Contains(".jpg") Or _
           cd.thumi.ToLowerCase.Contains(".jpeg") Then
        mimeType = "image/jpeg"
    End If

    Log("URL: " & cd.thumi)
    Log("MIME: " & mimeType)

    MediaManager.SetMediaWithExtra(Panel1x, cd.thumi, mimeType, _
        CreateMap( _
            MediaManager.REQUEST_CORNERS_RADIUS: 11dip, _
            MediaManager.REQUEST_RESIZE_MODE: "FIT", _
            MediaManager.REQUEST_BACKGROUND: xui.Color_Transparent))

Else
    MediaManager.ClearMedia(Panel1x)
End If
 
Last edited:
Upvote 0
This works, but there's no animation.
Code: Copy
    MediaManager.SetMediaWithExtra(Panel1, "https://convertico.com/samples/avif/animated-avif-lossless.avif", "image/avif", CreateMap())
As @teddybear wrote, it does work. It will show a static image.

Supported by Android 12+.
 
Upvote 0
Back
Top