Add beforeunload for updating the time (only if th video actually played)