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

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?

3 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

onAdError() – http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference

matthew

User  
0 rated :

This isn't an advert though...

Ethan Feldman

JW Player Support Agent  
0 rated :

Sorry, onError()

This question has received the maximum number of answers.