By posting screenshots, instead of YAML, you’re effectively discouraging others from posting corrections to your example. Why? Because in order to reply to you, they have to re-type what is shown in your screenshots. In addition, no one can see what you entered in the sections that are not expanded.
Create the following script (using the built-in Script Editor, create a new empty script, copy-paste the YAML shown below into it, then save the script).
Additionally you might want to actually open the scene and look at it’s YAML and post it here.
That will at least tell us if it did actually snapshot the volume.
But because the media_player is called photo_display I am guessing it’s probably a Google Nest Display Gen 2, or a Lenovo Smart Display - and Chromecast devices don’t provide a volume level when they are not active, so the volume would not be part of the snapshot.
You would need to first send the power on command to the media player, then snapshot it.
A good spot to learn what attributes are available is in the Developer Tools “States” tab.
When writing my original reply I went there to see if I could do what you’re looking for myself, as I do have some automations that play with media_player volumes but only to set them, not store them. When I did look there I didn’t find a attribute for the current volume, hence I commented that you may have difficulty pulling that value from your photoframe. but thanks to @Edwin_D’s comment I now know that the attributes do exist but are only accessible when the media_player is on.
One comment I have on this snippet is the delay - whilst this will likely achieve what you’re after, one thing to consider is the intent. The intent here is to delay the rest of the script while the photo frame plays the audio.
I did this the same way with my announcements, but that involved some tweaking on the longer “briefings” to allow sufficient delay. I then had some occasions that the announcement would get cut off as there was a slight timing differences between the script triggering, the media_player turning on, then starting the audio. You could obviously resolve this with a longer delay, but again: intent.
What I ended up doing was changing the script from having a delay to having two wait_for_trigger's. One would wait for the media_player to be playing, the next would wait for the media_player to be idle. The script would then continue as normal. This meant that I could have the delay without having to fuss about with timings, and I could use the same code on any annoucement (I actually ended up moving this ‘delay’ code out to it’s own automation which triggers when media_player's start playing and waits for them to become idle; but my use case was for switching them back off when done, not fiddling with volumes)