Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications: GIFs only rendering the first frame #1270

Closed
SeraphimSerapis opened this issue Jan 1, 2021 · 15 comments · Fixed by #4284
Closed

Notifications: GIFs only rendering the first frame #1270

SeraphimSerapis opened this issue Jan 1, 2021 · 15 comments · Fixed by #4284
Labels
enhancement New feature or request notifications

Comments

@SeraphimSerapis
Copy link

Home Assistant Android version:
3.0.2-full

Android version:
11

Phone model:
Pixel 5

Home Assistant version:
2020.12.2

Last working Home Assistant release (if known):

Description of problem:
When using the mobile notification feature with a GIF instead of a PNG or JPEG, it seems like only a single frame of the received GIF is rendered.

Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):


Screenshot of problem:
signal-2021-01-01-212035

Additional information:
Example code to trigger the push notificiation:

message: "Test GIF"
data:
  image: "https://media1.tenor.com/images/aba522811b497086c5d35757d6cfb269/tenor.gif"
@SeraphimSerapis SeraphimSerapis added the bug Something isn't working label Jan 1, 2021
@dshokouhi
Copy link
Member

android notifications do not support GIF https://stackoverflow.com/a/58482901 so this would not be a bug but maybe an enhancement request (if at all possible)

@SeraphimSerapis
Copy link
Author

Got it. Thanks!

@dshokouhi
Copy link
Member

they only take bitmap which is what the app provides

https://developer.android.com/reference/android/app/Notification.BigPictureStyle

@dshokouhi dshokouhi added enhancement New feature or request notifications and removed bug Something isn't working labels Jan 1, 2021
@SeraphimSerapis
Copy link
Author

Reopening for a potential feature request.

I know the Nest app shows a brief animation for camera notifications. Is that a custom implementation?

@dshokouhi
Copy link
Member

yes those are all custom implementations and override the default android notifications, they need to be built from the ground up, even then I am not sure if a URL gif will work I believe the app has to create it and store it locally in order to display it instead of real time rendering like we do today

@dshokouhi
Copy link
Member

Found something that might be usable however it has serious limitations such as the user will need to supply the list of image URLs to flip through so a GIF wont work here. This might be how the other camera apps do it.

https://nishi-emedstore.medium.com/notification-with-image-slider-example-in-android-2758b6d43d38

@dshokouhi
Copy link
Member

if you have updated to Android 12 it seems they now natively supported animated images. Curious to see if this just "works" now?

https://developer.android.com/about/versions/12/features#enriched_image_support_for_notifications

@SeraphimSerapis
Copy link
Author

I gave this a try and it doesn't seem to just work automatically (that would've been too nice ;-)):

service: notify.notify_tim
data:
  message: Test GIF
  title: Test GIF
  data:
    image: "https://media1.tenor.com/images/aba522811b497086c5d35757d6cfb269/tenor.gif"

Same result as in the initial post.

@dshokouhi
Copy link
Member

Thanks for running that quick test :) Seems now they want us to convert the animated picture to an Icon in order to support this

https://developer.android.com/reference/android/app/Notification.BigPictureStyle#bigPicture(android.graphics.drawable.Icon)

@jpelgrom
Copy link
Member

Just putting the existing Bitmap in the Icon won't work, looks like this will require the app to temporarily download and store the image (because only content:// and file:// uri's are supported) and creating an Icon from that local Uri, which will then provide the system with the required AnimatedImageDrawable.

However, before all that NotificationCompat actually needs to catch up and support the new function with Icon as a parameter. Google issue for status: https://issuetracker.google.com/issues/215583339

@Minglarn
Copy link

Hi folks!
So if I understand this correct... Sending a GIF wont show all the frames, just the first one?
Because im trying to send GIF and only the first frame is shown.

service: notify.mobile_app_sm_g998b
data:
  message: TESTING
  title: GIF TEST
  data:
    icon_url: /local/img/frigate/gif/1650374131.922721-o98gqz.mp4.gif
    image: /local/img/frigate/gif/1650374131.922721-o98gqz.mp4.gif
    tag: '919191'

@dshokouhi
Copy link
Member

So if I understand this correct... Sending a GIF wont show all the frames, just the first one?

correct, if you are trying to send a video you can have the app create a GIF for you though.

just use the video parameter detailed here: https://companion.home-assistant.io/docs/notifications/notification-attachments

@Minglarn
Copy link

Ok, thanks for clearing that out... :)
Been using the mp4->GIF function, but I wanted a lite more control over the produced GIF.
The generated GIF is a lite to low on frames. Wanted more. :P

@Rogue136198
Copy link
Contributor

The generated GIF is a lite to low on frames. Wanted more. :P

Exactly this. I came across this while looking for a way to increase the FPS of GIFs. The ideal option would be a parameter to set the FPS as part of the notify service.

@dshokouhi
Copy link
Member

The generated GIF is a lite to low on frames. Wanted more. :P

Exactly this. I came across this while looking for a way to increase the FPS of GIFs. The ideal option would be a parameter to set the FPS as part of the notify service.

That would be a separate request from this feature request. This feature request is to display a gif by URL.

If you want to control the amount of frames for the video parameter that creates it's own gif, please open a new request to enhance that feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request notifications
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants