How to enqueue scripts depending on post formats?

Inside the Loop, try something like the following:

<?php
if ( get_post_format() && in_array( get_post_format(), array( 'audio', 'video' ) ) ) {
    // The current post has either the
    // audio or video post format;
    // enqueue a script
    wp_enqueue_script( $handle, $src );
}
?>

Now that WordPress can handle inline script-enqueueing, this should work fine.