mediaelement.js - How does Mediaelement handle missing files? -
we looking way capture when mediaelement not load file either because not exist (404 error) or request never processed (timeout situation). not appear error event called in these situations, true?
any thoughts on how handle type of recovery can made?
this doesn't answer whole question, following simple trick use test if file exists or not:
<?php $mp3_url = "http://mywebsite.com/wp-content/uploads/2013/08/mp3.mp3" /* convert lecture uri absolute path file_exists() */ $mp3_abs_url = preg_replace( "#" . wp_content_url . "#", wp_content_dir, $mp3_url ); if ( file_exists($mp3_abs_url) ) { echo do_shortcode("[audio mp3=$mp3_url][/audio]"); } else { ?> <div> <?php echo "no mp3 available."; ?> </div> <?php } ?>
otherwise mediaelements displays player 0:00 duration.
Comments
Post a Comment