Capturing video from before trigger

I have an automation which takes a snapshot when a motion or vehicle is detected, then kicks a notification with that image out to my partner and I, then creates a recording that is a similar filename (Ex: person.jpg and person.mp4). Currently, it is always using the same file name when sending out a link to the image, then records for 10 seconds and overwrites the video file.

I’m running into two one problem:

1. My partners phone is loading a cached video at the browser link that the notification provides for some reason (even a day after). I’m hoping to fix this via having a timestamped file at the time the event was triggered, then feeding that image out into the link. This would also allow for the review of multiple notifications at a later time, instead of only the latest triggers recording.
2. The recording is generated using the camera app, which appears to only captures the live stream from the camera after the trigger. Is there a way to have a sort of buffer always going so I can capture the 5 seconds or so before trigger?

The Camera providing the footage is a Ubiquiti doorbell, and I’m trying to not have multiple apps sitting on phones so it’s a unified interface, etc.

Existing Yaml for the automation:

description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.g4_doorbell_pro_poe_person_detected
    from: "off"
    to: "on"
conditions: []
actions:
  - action: camera.snapshot
    metadata: {}
    data:
      filename: /config/www/pics/person.jpg
    target:
      entity_id: camera.g4_doorbell_pro_poe_high_resolution_channel
  - action: notify.mobile_app_pixel_8
    metadata: {}
    data:
      message: Person detected at the front door
      data:
        image: >-
          https://my_url.ui.nabu.casa/local/pics/person.jpg
        entity_id: camera.g4_doorbell_pro_poe_high_resolution_channel
        actions:
          - action: URI
            title: Open Recording
            uri: >-
              https://my_url.ui.nabu.casa/local/pics/person.mp4
  - action: notify.mobile_app_pixel_7
    metadata: {}
    data:
      message: Person detected at the front door
      data:
        image: >-
          https://my_url.ui.nabu.casa/local/pics/person.jpg
        entity_id: camera.g4_doorbell_pro_poe_high_resolution_channel
        actions:
          - action: URI
            title: Open recording
            uri: >-
              https://my_url.ui.nabu.casa/local/pics/person.mp4
  - action: camera.record
    metadata: {}
    data:
      duration: 15
      filename: /config/www/pics/person.mp4
      lookback: 15
    target:
      entity_id: camera.g4_doorbell_pro_poe_high_resolution_channel
mode: single