Browse NVR videos mounted as a media folder in home assistant

I am running Home Assistant in Docker on a linux machine.
I have 2 Xiaomi 360 Camera backing up footage to a local SMB share.
It stores the footage in following order in a folder
YYYYMMDDHH → .mp4 files (1 for each minute)

I have mounted that folder in my home assistant as a media directory and can successfully play any video in it via the media browser on the side.

What i want to achieve is,
A entity on my dashboard, playing the latest video from the latest folder in that media directory.
Any way to achieve that?

nvm, I found my solution.
I used the Gallery Card GitHub - TarheelGrad1998/gallery-card: A custom card for Home Assistant that will display images and/or videos from a folder in the style of a gallery.
Like so,

type: custom:gallery-card
title: Camera
entities:
  - path: media-source://media_source/xyz
    caption_format: DD MMM YYYY HH:mm
include_images: false
include_videos: true
menu_alignment: Bottom
maximum_files: 5
video_preload: false
file_name_format: X
file_name_date_begins: 8
folder_format: YYYYMMDDHH
reverse_sort: true
show_reload: true
show_duration: true

My file names contain MMMSSS_X.mp4
first 2 M and S are minutes and seconds
the third M is just the character M
the third S is also just the character S
X is the unix timestamp.

2 Likes