In what sense is it not working? What happens?
if (get_post_meta($post->ID, 'media', true) == '' )
if($type = ('null'))
Remove this, it’s not needed for the new condition above:
$type = the_field('media');
Don’t know if it makes a difference, but it’s worth the try 🙂