<video id='bvid' src='ph/vid.mp4' poster='ph/vposter.jpg' controls></video>
$(bvid).on('error', function(){
$(this).attr('src', 'ph/vid.mp4');
$(this).attr('poster', 'ph/vposter.jpg');
});
the above code works, i.e. if any of src or poster attribute is in error - the both are replaced by given values
problem - in case problem is only about poster - src is also replaced - and vice versa
so I want to split this errors, like this
$(bvid).on('error', function(){
if(error is about src){$(this).attr('src', 'ph/vid.mp4');}
if(error is about poster){$(this).attr('poster', 'ph/vposter.jpg');}
});
any help?