Media_player entity_picture few seconds

Hi friends. I am trying to show the image of what is being played in a media_player object.
But I would like the image of each media_player to be displayed every two seconds. I wanted to show an image every two seconds and I am doing something wrong. Something is wrong, I don’t know if it’s my code or that the old_time variable is actually being updated as well.
If anyone sees what I did wrong I would appreciate your help.
Thank you

 reproducciones:
  name: Reproduccion Actual
  variables:
    old_time:  Date.now();
  styles:
    custom_fields:
      media_image:
        - background-position: center center
        - background-image: >
            [[[                  
              let time = Date.now() - variables.old_time;
              if (time > 4000) 
                return "url('/local/img/1.png')";
              else if (time > 2000) 
                return "url('/local/img/2.png')";
              else
                return "url('/local/img/3.pgn')";
            ]]] 

that looks like a custom button card? Assuming it is, you’d need a triggers_update entity that updates every 2 seconds. Date.now() doesn’t update ever.

If I am using a button card. It is what it seemed to me. I’m going to try it, I tell you. Thank you so much

well, that’s definitely not entity_picture and it seems like incomplete yaml.

I understood what trigger update does but I don’t realize how I should work it

Here is this part of the yaml

                      type: custom:button-card
                      entity: media_player.google_mini
                      tap_action:
                        action: none
                      template:
                        - reproducciones

Template

reproducciones:
  name: Reproduccion Actual
  variables:
    old_time:  Date.now();
  styles:
    custom_fields:
      media_image:
        - background-position: center center
        - background-image: >
            [[[                  
              let time = Date.now() - variables.old_time;
              if (time > 4000) 
                return "url('/local/img/1.png')";
              else if (time > 2000) 
                return "url('/local/img/2.png')";
              else
                return "url('/local/img/3.pgn')";
            ]]]