![](https://secure.gravatar.com/avatar/035ef1e23c6a71df4bf021322b13af59?rating=PG&size=50&default=https%3A%2F%2Fcdn.desk.com%2Fassets%2Funknown_user_50-8ad5644bbe6b1bd7454f2ea465f782bd.png)
Error handling for if a source doesn't exist?
Code:
$sources = '
[{
file: "'.$mp4SD.'",
},{
file: "'.$mp4HD.'",
},{
file: "'.$webmSD.'",
},{
file: "'.$webmHD.'",
},{
file: "'.$flv.'",
}]
';
?>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
jwplayer("myElement").setup
({
height: <?php echo $this->height; ?>,
width:<?php echo $this->width; ?>,
flashplayer: "<?php echo ($this->assetsUrl.'/jwplayer.flash.swf');?>",
sources: <?php echo $sources; ?>
});
</script>
In some cases there won't always be a HD file, and possibly a file might be missing.
I've noticed the player will simply break if a video file doesn't exist.
So is it a case of doing PHP checks, or is there some functionality in the player to handle missing files?