Add onerror handling for img/video loading.