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

Animated GIF Notification Not Working on Samsung (Android 14) #4939

Open
Jeepmb opened this issue Dec 27, 2024 · 10 comments
Open

Animated GIF Notification Not Working on Samsung (Android 14) #4939

Jeepmb opened this issue Dec 27, 2024 · 10 comments
Labels
bug Something isn't working notifications

Comments

@Jeepmb
Copy link

Jeepmb commented Dec 27, 2024

Home Assistant Android app version(s):
24.12.1-full
Android version(s):
Android 14 / OneUI 6.1
Device model(s):
Samsung Galaxy S24 (SM-S921U1)
Home Assistant version:
2024.12.5
Last working Home Assistant release (if known):
N/A
Description of problem, include YAML if issue is related to notifications:

EDIT: Determined that animated Video type notifications are in fact working, as my initial test video was too short. GIF type notifications are the issue here. Thread title was updated to reflect this change.

I've been trying to setup an automation that sends a notification to an android device with an animated GIF or Video attachment using the Send Notfication via Mobile App method. When sent, both the GIF and MP4 formats of a file will only show the first frame, instead of playing as an animated GIF in the notification shade. Through my reading, it seems the animated GIF support is very new as of Android 14, but the video support should be well established. I've attempted to follow the Standard Attachments docs closely, and my configuration (of the GIF version) can be seen below. The video version simply replaces image: with video: and the .gif with .mp4 extension (I have both files stored locally):

action: notify.mobile_app_s24_tugg
metadata: {}
data:
  message: You've achieved your weekly eating goals! Great Job!
  title: Nutrivore
  data:
    notification_icon: mdi:party-popper
    color: "#8A2BE2"
    channel: Nutrivore
    importance: high
    image: /media/local/spongebob-dancing.gif
    clickAction: /lovelace/nutrivore
enabled: true

I've tried stripping this down to the bare essentials (removing channel, notification_icon, clickAction, ect) with no luck. I also tried using the web URL of the GIF source without success. The GIF and the video both correctly play from the "Media Player" folder in the Home Assistant frontend, so I feel the file and it's format are "correct" here. It feels like the companion app isn't even attempting to play the media, instead falling back to a thumbnail or static configuration, but I'm just guessing here.

Companion App Logs:

GIF Notification Log

12-27 08:56:34.421 13310 13310 D MessagingService: Creating notification with following data: {notification_icon=mdi:party-popper, color=#8A2BE2, image=/media/local/spongebob-dancing.gif, title=Nutrivore, webhook_id=256e4c3fb343c0644e6206dafcac6eef54653a8bf79b8741ec930ea7ca0e3367, channel=Nutrivore, clickAction=noAction, message=You've achieved your weekly eating goals! Great Job!, importance=high, server_id=2}
12-27 08:56:34.426 13310 13310 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: true, usesWifi is: true
12-27 08:56:34.426 13310 13310 D ServerConnectionInfo: Using internal URL
12-27 08:56:34.429 13310 13396 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: true, usesWifi is: true
12-27 08:56:34.429 13310 13396 D ServerConnectionInfo: Using internal URL
12-27 08:56:34.596 13310 13396 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: true, usesWifi is: true
12-27 08:56:34.596 13310 13396 D ServerConnectionInfo: Using internal URL
12-27 08:56:34.688 13310 13310 D MessagingService: Show notification with tag "null" and id "148206835"
12-27 08:56:34.689 13310 13310 I NotificationManager: io.homeassistant.companion.android: notify(148206835, null, Notification(channel=nutrivore shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0xff8a2be2 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)) as user

Video Notification Log

12-27 08:59:09.602 13310 13310 D MessagingService: Creating notification with following data: {notification_icon=mdi:party-popper, color=#8A2BE2, title=Nutrivore, video=/media/local/spongebob-dancing.mp4, webhook_id=256e4c3fb343c0644e6206dafcac6eef54653a8bf79b8741ec930ea7ca0e3367, channel=Nutrivore, clickAction=noAction, message=You've achieved your weekly eating goals! Great Job!, importance=high, server_id=2}
12-27 08:59:09.609 13310 13310 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: true, usesWifi is: true
12-27 08:59:09.609 13310 13310 D ServerConnectionInfo: Using internal URL
12-27 08:59:09.609 13310 13390 V MediaMetadataRetriever: constructor
12-27 08:59:09.616 13310 13390 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: true, usesWifi is: true
12-27 08:59:09.616 13310 13390 D ServerConnectionInfo: Using internal URL
12-27 08:59:09.674 13310 13390 V MediaMetadataRetriever: setDataSource(205, 0, 576460752303423487)
12-27 08:59:09.696 13310 13390 V MediaMetadataRetriever: setDataSource(fd) return(0)
12-27 08:59:09.697 13310 13390 V MediaMetadataRetriever: extractMetadata(9)
12-27 08:59:09.699 13310 13390 V MediaMetadataRetriever: getFrameAtTime: time(100000 us) option(3) colorFormat(4) metaOnly(0)
12-27 08:59:09.820 13310 13390 V MediaMetadataRetriever: destructor
12-27 08:59:09.820 13310 13390 V MediaMetadataRetriever: disconnect
12-27 08:59:09.821 13310 13310 D MessagingService: Found 1 frames for video notification
12-27 08:59:09.822 13310 13310 D MessagingService: Show notification with tag "null" and id "148362017"
12-27 08:59:09.823 13310 13310 I NotificationManager: io.homeassistant.companion.android: notify(148362017, null, Notification(channel=nutrivore shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0xff8a2be2 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)) as user

Screenshot or video of problem:

Notification Screenshot Minimized

Notification Screenshot Expanded

Additional information:

@Jeepmb Jeepmb added the bug Something isn't working label Dec 27, 2024
@dshokouhi
Copy link
Member

Can you share the GIF in question? Also have you tried other sources?

@dshokouhi
Copy link
Member

i am unable to reproduce using the following yaml on my pixel 9 pro xl

message: test
  data:
    image: https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExaDJjczVsZjdwZWR4Z3c5N21saDYzbHI1c3FjeXdzMzJnNWJ6dTYzYyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/l0HlSFMhjVbgyA32U/giphy.gif

gif loads and is animated

@Jeepmb
Copy link
Author

Jeepmb commented Dec 27, 2024

@dshokouhi That's interesting, copy-pasting that same config for me results in a still image (no animation).

Probably not useful at this point, but the source for my gif is here: Tenor - Spongebob Dancing.

@dshokouhi
Copy link
Member

gonna take a wild guess and say Samsung being Samsung? Wouldnt be the first nor last time.

@dshokouhi
Copy link
Member

your example also works here:

  message: test
  data:
    image: https://media1.tenor.com/m/UPYPRQDgJqoAAAAd/spongebob-dancing.gif

@Jeepmb
Copy link
Author

Jeepmb commented Dec 27, 2024

@dshokouhi It certainly may be a Samsung issue with how they handle their notifications and frontend. I too have experienced the "fun" of their haphazard enabling and disabling of android features. But without any hard evidence, it's difficult to say one way or the other. Ex. if Samsung was "blocking" the video notification from playing, I would expect the companion app to receive some kind of pushback message from the OS, but I don't really see anything here in the logs.

@Jeepmb
Copy link
Author

Jeepmb commented Dec 27, 2024

For what it's worth, I just had my brother send me a GIF to test if they work in other app notifications. GIFs are indeed animated and play within the notification window on my Galaxy S24 for the Google Messages app.

@jpelgrom
Copy link
Member

Have you tried with Home Assistant + another gif, like this? Just to rule out any issues with the file. Don't see that combination in the comments.

Ex. if Samsung was "blocking" the video notification from playing, I would expect the companion app to receive some kind of pushback message from the OS, but I don't really see anything here in the logs.

I think you've missed the following: video attachments do not play natively on Android and are converted to a very low framerate 'video', as mentioned in the docs: "Video will be shown as a series of frames captured from the video file. It will not work well with videos that are < 10s long.". Depending on the length of your video-from-gif, it could be correct that only 1 frame is shown.

Still I do agree if there is pushback from the OS there'll probably be a message, but that would not show in the app log, only in the device log which is not accessible from the app itself.

@Jeepmb
Copy link
Author

Jeepmb commented Dec 31, 2024

@jpelgrom Thanks for chiming in, and yes I tried referencing that GIF file as web URL and as a local file, but still no animation.

Also, as far as the video attachments I think you are correct. I had initially read that sentence as videos greater than 10 seconds, not less than 10 seconds. So it would make sense for the video to only play one frame in this case. I tested with a longer video, and the notification is animated, so it appears only GIFs are the issue here.

I was able to test the notification on my wife's Pixel 7, and the GIFs are animated on her phone. So I'd assume at this point my configuration for the notification on the server side is correct, and that this is just a client side issue with GIFs. My next step is going to be looking at the companion app logs on the Pixel to see if there are any noticable differences in the parameters being passed to the MessagingService or NotificationManager.

Like I mentioned previously, I get animated GIF notifications from Google Messages, so it's not like OneUI is blocking them outright. It's just the Home Assistant Companion App that doesn't.

Fun Fact: Behavior on my Galaxy Watch 5 Pro is exactly the same. Google messages will display GIFs as animated on my watch, but the same GIF sent via Home Assistant noification will appear as a still image on my watch.

@Jeepmb Jeepmb changed the title Animated GIF/Video Notification Not Working (Android 14) Animated GIF Notification Not Working (Android 14) Dec 31, 2024
@dshokouhi dshokouhi changed the title Animated GIF Notification Not Working (Android 14) Animated GIF Notification Not Working on Samsung (Android 14) Dec 31, 2024
@dshokouhi
Copy link
Member

Remember Google messages takes the file and displays it while the app downloads it and then loads it so the implementation is not the same for comparison sake but good to know it works in the other app. Also it won't work on the watch because the code does not exist there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working notifications
Projects
None yet
Development

No branches or pull requests

3 participants