Play media and random image not working?

Hi all.
I thought something like:

service: media_player.play_media
data:
  media_content_type: image/jpeg
media_content_id: {{ [ \"http://192.168.50.148:8123/local/snapshots/1.jpg",\"http://192.168.50.148:8123/local/snapshots/2.jpg" ] | random }}
target:
  entity_id: media_player.first_bathroom_tv

would work, but instead it keeps putting the media_content_id back to one single url. I based this on a previous automation where i randomised youtube video’s hoping this would work, but unfortunately not. I guess it’s possible it doesn’t support it, but i doubt that as below solution works fine.

service: media_player.play_media
data:
  media_content_id: " { \"app_name\": \"youtube\", \"media_id\": \"{{ [\"J_4leOeH9Lc\",\"MxcJtLbIhvs\",\"yvZox35ures\",\"kVxTrhojpFI\",\"bJsaR9-h26Y\",\"T7SIxJOoQd8\",\"i33Hy6u2cic\",\"nFNB9OTKq90\",\"QlgRNWhrpLk\",\"rlJGj2NwmSw\",\"0yi1AbDQ9nk\",\"ycDLfQ1Cv_Y\",\"ym_eXrQxvbw\",\"o13vvkrAiu8\",\"IvGU0GunOL8\",\"ohQgazuJbh8\",\"ngyraivSH0\",\"jOmPBbn_4mA\",\"cK0SKezwBYQ\",\"DESJJehud7M\",\"ZmRVXiUUjto\",\"AqUVHINxBZo\",\"QjisC1Aj-rA\",\"o13vvkrAiu8\",\"x5BDvVMcpjo\",\"jNvhNINOPOg\",\"hjKO0d_umLc\",\"xpWYJIC-Z9c\",\"eoTpdTU8nTA\",\"8OvfmZ_TTkM\"] | random }}\" }"
  media_content_type: cast
target:
  entity_id: media_player.first_bathroom_tv

Thanks all.

random will deliver one of the list, randomly.

In that case it works as it should i suppose :-). But why does the above one work fine whereas the new automation doesn’t ?

Is your media player the same platform? Does the original solution work on your system?

Sorry for the late reply. Yes both on chromecast google TTS. And yes the original solution works fine.