Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Online & Offline Images


Hello,

I am needing a solution that will allow me to show different a image whether the stream is online or offline.

I am using JW5 and Wowza server and Wowza produces a thumbnail of the live stream. So if the stream is active I need to plugin that URL to that JPG and if it is offline just use the normal jpg that I use now that shows before hitting play to show when/if the stream is offline. I know this is possible but I cannot locate the code for this.

-Thanks!

6 Community Answers

n...

User  
0 rated :

Sorry, meant JW7

George

JW Player Support Agent  
0 rated :

Hi,

This isn’t something entirely related to JW Player, but this should work:

var xhttp = new XMLHttpRequest();

xhttp.open(“GET”, “YOUR_STREAM_URL”, true);
xhttp.send();

// When the xhttp request gets a status OK parse the XML
xhttp.onreadystatechange = function() {

if (xhttp.readyState == 4 && xhttp.status == 200) {
// if it’s successful setup your player

}
else if (xhttp.readyState == 4 && xhttp.status == 404) {
// if it’s unsuccessful setup your alternate player

}
};

n...

User  
0 rated :

Thanks, I don't think that is what I am looking for though. Something more along the lines of how you can set separate file sources for streams I.E. RTMP, HLS. Something similar for images though where you can load two static images and if one is available show it and if not fallback to the other. .

George

JW Player Support Agent  
0 rated :

Hi,

There is no fallback mechanism for images. The above code could check if the images are present though…

n...

User  
0 rated :

Could you give me an example where the players should go? I tried this and the player doesn't load at all. I noticed it is checking and XML file. Is that correct? I am not using any XML files as these are live streams.

George

JW Player Support Agent  
0 rated :

Here’s a test page that will load a different player depending on the availability of the stream you provide it:
http://qa.jwplayer.com.s3.amazonaws.com/~george/check_if_exists.html

This question has received the maximum number of answers.