I need to know if an Internet connection is available before playing a video. How can I get it?
var url = 'http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4';
//url not found (no Internet)
player.Play(url);
Now this code working wrong. Player start play but we have not internet. How can I be sure that I have a connection to the internet?
//pseudo code
if (player.checkInternet){
player.Play(url);
}else{
alert('Error');
}
You can check the connection status with:
However, this method may have compatibility issues with some browsers. See: Browser compatibility