In what sense is it not working? What happens?
Try this:
if (get_post_meta($post->ID, 'media', true) == '' )
insteaf of:
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 🙂