At any hearing, including, but not limited to, a scheduled trial date, involving a proceeding described in Section 6150, upon a showing of need, the court shall order as a condition of granting a continuance that the testimony of a witness then present in court be taken and preserved for subsequent use at a trial or any other stage of the proceeding.