Extract media_content_id from one google home to another

Hello everyone,
I would like to continuously play a media content on all my google homes as I am walking in different rooms.
For instance, I am listening to a specific media content with a specific URL in room 1.
Once I go to room 2, a motion sensor triggers my other google home to cast this specific URL.
Do you know how I can pass on the media content id attribute from one google home to another?
I prototyped this code so far:

- service: media_player.play_media
      data_template: 
        entity_id: media_player.room_2
        media_content_id: >   
          {% if is_state("media_player.room_1", "playing") %}
            state_attr('media_room_1', 'media_content_id')
          {% endif %}  
        media_content_type: audio/mp4

Is this script a good start?
Thanks a lot for your help :slight_smile: