Hide iFrame when url is broken

I would like to hide an iframe when the URL is broken.
It is a local website that shows the current cover and song being played. (It’s from Jriver Media Center)
When the playlist is empty, the iframe displays a broken image. I’d like to hide the card completely …
The URL looks like this: http://url:port/WebRemote/musik.html
Is it possible?

Stick the iframe card inside a conditional card:

You may have to make a binary template sensor to test when the play-list is empty.

Okay, what should I put in “state”? Could you give me an example?

That’s why I said this:

You may have to make a binary template sensor to test when the play-list is empty.

Do you have a sensor for your playlist?

No, I don’t know how… I only have an iFrame-card with the URL in the first post.

You need to work out a way to tell if the playlist is empty. It’s a basic requirement to do anything if it’s empty.

I dont think there is a way, it is just a webpage… Can I use some other component? Like the camera component?

There’s a whole restful api you can use to control and interrogate the media player. However the documentation is only available here: http://[library server address]/MCWS/v1/doc if you have the media server installed. Which I do not. Looks like you have some reading to do.

Oh, yes, a lot of information but I don’t know what to do with it… This is what is says about playlist:

         Get the current playlist.
            Action: The action to perform with the files (MPL: return MPL playlist; Play: plays files; Save: saves the files (as a playlist in the library, etc.); Serialize: return serialized file array (basically a list of file keys); M3U: saves the list as an m3u). (default: mpl)
            Shuffle: Set to 1 to shuffle the files. (default: )
            ActiveFile: A file key to set as active (used as the file that playback starts with, etc.). (default: -1)
            ActiveFileOnly: Set to 1 to trim the returned files to only contain the active file. (default: )
            PlayMode: Play mode flags delimited by commas (Add: adds to end of playlist; NextToPlay: adds files in the next to play position). (default: )
            Fields: The fields to include in an MPL (use empty to include all fields) (set to Calculated to include calculated fields). (default: )
            NoLocalFilenames: Set to 1 to filter out local filenames from MPL output (since they might be meaningless to a server). (default: )
            PlayDoctor: Set to 1 to change the files to a Play Doctor generated playlist using these files as a seed. (default: )
            SaveMode: Playlist: playlist (overwrites existing; returns ID) (default: )
            SaveName: A backslash delimited path used with the action 'Save'. (default: )
            NoUI: Set to one to put the player in no UI mode. (default: )
            Zone: The zone the command is targetted for. (default: -1)
            ZoneType: The type of value provided in 'Zone' (ID: zone id; Index: zone index; Name: zone name). (default: ID)

You cut off the important bit. Response.

Also what is the format of the rest command it expects?

It dosen’t say much more to me, here are the whole page:

In the example of the playlist the url looks like this:

I can’t find anything about which format it is…
I’m sorry but i’m a total noob of this… :expressionless:

This is the “Info” bit:

         Get information about the current playback.
            Zone: The zone the command is targetted for. (default: -1)
            ZoneType: The type of value provided in 'Zone' (ID: zone id; Index: zone index; Name: zone name). (default: ID)
            ZoneID: The zone ID of this zone.
            ZoneName: The display name of this zone.
            State: The playback state of the player.
            FileKey: The database key of the playing file.
            NextFileKey: The database key of the next file to play.
            PositionMS: The position of the playback in milliseconds.
            DurationMS: The duration of the playing file in milliseconds.
            ElapsedTimeDisplay: The elapsed playback time as a display friendly string.
            RemainingTimeDisplay: The remaining playback time as a display friendly string.
            TotalTimeDisplay: The total playback time as a display friendly string.
            PositionDisplay: The playback position as a display friendly string.
            PlayingNowPosition: The index of the current track in Playing Now.
            PlayingNowTracks: The number of files in Playing Now.
            PlayingNowPositionDisplay: The current Playing Now position formatted for display.
            PlayingNowChangeCounter: A counter that increments any time the playlist is changed.
            Bitrate: The current bitrate, in kbps.
            Bitdepth: The current bitdepth.
            SampleRate: The current sample rate in Hz.
            Channels: The number of audio channels in the current output.
            Chapter: The current playback chapter.
            Volume: The current volume.
            VolumeDisplay: A display friendly string version of the current volume.
            ImageURL: An image URL for the current file.
            Artist: Artist of current file.
            Album: Album of current file.
            Name: Name of current file.
            Rating: Rating of current file.
            Status: Playback status as a displayable string.
            LinkedZones: Semicolon delimited list of zone names in the link (only provided if this zone is part of a link).
            Get information

And when I click on the Examples I get this:

Denna XML-fil verkar inte ha någon associerad stilinformation. Dokumentträdet visas nedan.
<Response Status="OK">
<Item Name="ZoneID">0</Item>
<Item Name="State">2</Item>
<Item Name="FileKey">7038070</Item>
<Item Name="NextFileKey">7038072</Item>
<Item Name="PositionMS">32514</Item>
<Item Name="DurationMS">249991</Item>
<Item Name="ElapsedTimeDisplay">0:32</Item>
<Item Name="RemainingTimeDisplay">-3:37</Item>
<Item Name="TotalTimeDisplay">4:09</Item>
<Item Name="PositionDisplay">0:32 / 4:09</Item>
<Item Name="PlayingNowPosition">3</Item>
<Item Name="PlayingNowTracks">12</Item>
<Item Name="PlayingNowPositionDisplay">4 of 12</Item>
<Item Name="PlayingNowChangeCounter">16</Item>
<Item Name="Bitrate">320</Item>
<Item Name="Bitdepth">64</Item>
<Item Name="SampleRate">44100</Item>
<Item Name="Channels">2</Item>
<Item Name="Chapter">0</Item>
<Item Name="Volume">0.06</Item>
<Item Name="VolumeDisplay">6%</Item>
<Item Name="ImageURL">MCWS/v1/File/GetImage?File=7038070</Item>
<Item Name="Artist">The Goo Goo Dolls</Item>
<Item Name="Album">Something For The Rest of Us</Item>
<Item Name="Name">Notbroken</Item>
<Item Name="Rating">3</Item>
<Item Name="Status">Playing</Item>

So this is XML, and what you see above is the current playing song.
And just for a sensor that tells if something is playing, I guess, I should be able to use this:

<Item Name = "Status"> Playing </Item> 

But I still don’t know where to start… :slightly_smiling_face: