If statement for disappearing entity

I’m trying to create something that will displaying either one ‘camera’ if it is there, and if not try another ‘camera. These camera are really entity pictures and the plex entity only shows up when it is playing. I have the cameras working fine but I’m not sure how I can do an if statement for something that may not be there?

For the cameras I grab the token attribute and append that to my url… it would be awesome if I could find a way to say if entity media_player.plex_livingroom playing use that, if not use this, if niether use this…Im just getting started with if statements and have a few basic ones i have just copied from the great minds here. Here is where I am at:

camera:
  - platform: generic
    name: Living Room Plex
    still_image_url: 'https://xxx.xxx.xxx/api/media_player_proxy/media_player.plex_living_room?{{ states.media_player.plex_living_room.attributes.token }}'

  - platform: generic
    name: Basement Plex
    still_image_url: 'https://xxx.xxx.xxx/api/media_player_proxy/media_player.plex_basement?{{ states.media_player.plex_basement.attributes.token }}'

That works perfect, I actually use those on my dashboard to keep the song artwork refreshing fine with my sonos entities.

Now the trouble is here, I want to display the plex artwork if Im watching that. And the sonos artwork if Im playing music. I am able to get the if statement to work if I use just names…example:

- platform: template
  sensors:
    basementartwork:
      value_template: >
        {% if is_state('media_player.plex_basement', 'playing') %}
          Plex
        {% elif is_state('media_player.basement', 'playing') %}
          Music
        {% else %}
          Off
        {% endif %}
This works correctly, I get Plex as the state when watching plex and I get Music as the state if listening to music.  

If I use a template I get no value returned at all.  Example:

- platform: template
  sensors:
    basementartwork:
      value_template: >
        {% if is_state('media_player.plex_basement', 'playing') %}
          {{ states.media_player.plex_basement.attributes.token }}
        {% elif is_state('media_player.basement', 'playing') %}
          {{ states.media_player.basement.attributes.token }}
        {% else %}
          Off
        {% endif %}

also:
- platform: template
  sensors:
    basementartwork:
      value_template: >
        {% if is_state('media_player.plex_basement', 'playing') %}
          https://xxx.xxx.xxx/api/media_player_proxy/media_player.plex_basement?{{ states.media_player.plex_basement.attributes.token }}
        {% elif is_state('media_player.basement', 'playing') %}
          https://xxx.xxx.xxx/api/media_player_proxy/media_player.basement?{{ states.media_player.basement.attributes.token }}
        {% else %}
          Off
        {% endif %}

So that is where I am stuck, I either need to figure out how to use a template like that, or create another automation based on if Plex or Music is the outcome.