I am trying to configure a pop up on a webmap in ArcGIS Online (Organisation). I want the pop up to show a small audio player pointing to an mp3 file. I want the mp3 file to change depending on what feature is selected on the map by the user.
I have a single point dataset with a single field "Species". I have a value list assigned to this field of around 40 different species. I also have an mp3 file for each of the 40 species.
My thinking was that I could use an if/else statement to select which mp3 file should be displayed in the pop up.
To create the pop up, I am creating a Custom Attribute Display.
{Species} was heard here
<br />
<br />
<audio controls=""> <source src="https://www.xeno-canto.org/sounds/uploaded/XTVEPHMPPJ/Haematopus_leucopodus_1984_02_04e.mp3" type="audio/mpeg"></source> </audio>
The above code works to bring up a player
I can also add a second player to the pop up as per below
{Species} was heard here
<br />
<br />
<audio controls=""> <source src="https://downloads.esri.com/agol/labs/maptour/horse.mp3" type="audio/mpeg"></source> </audio>
<br />
<br />
<audio controls=""> <source src="https://www.xeno-canto.org/sounds/uploaded/XTVEPHMPPJ/Haematopus_leucopodus_1984_02_04e.mp3" type="audio/mpeg"></source> </audio>
This brings up 2 audio players within the pop up window.
But I am unable to choose the file based on the {Species} variable.
Attempting to do an if/else statement
{Species} was heard here
<br />
<br />
IIf($feature.Species=="Egret". "<audio controls=""> <source src="https://downloads.esri.com/agol/labs/maptour/horse.mp3" type="audio/mpeg"></source> </audio>", "<audio controls=""> <source src="https://www.xeno-canto.org/sounds/uploaded/XTVEPHMPPJ/Haematopus_leucopodus_1984_02_04e.mp3" type="audio/mpeg"></source> </audio>
Brings back this pop up:
I've also tried using this code in an Arcade expression, but I can't even get a single audio player to show.
Something like:
If {Species} = Crow Play crow MP3 URL Else if {Species} = Egret Play Egret MP3 URL Else if {Species} = Robin Play Robin MP3 URL
Is anybody able to advise how I can show a single audio player depending on what {Species} value is assigned to the point the user has clicked on?