'Wait until Video Player Rendered Completely.'

@wait_for_js
def wait_for_video_player_render(self, autoplay=False):

    self.wait_for_video_class()
    self.wait_for_element_presence(CSS_CLASS_NAMES['video_init'], 'Video    Player    Initialized')
    self.wait_for_element_presence(CSS_CLASS_NAMES['video_time'], 'Video    Player    Initialized')
    video_player_buttons = ['volume', 'fullscreen', 'speed']
    if autoplay:
        video_player_buttons.append('pause')
    else:
        video_player_buttons.append('play')
    for button in video_player_buttons:
        self.wait_for_element_visibility(VIDEO_BUTTONS[button], '{}    button    is    visible'.format(button))
    def _is_finished_loading():
        '\n                                                Check    if    video    loading    completed.\n\n                                                Returns:\n                                                                bool:    Tells    Video    Finished    Loading.\n\n                                                '
        return (not self.q(css=CSS_CLASS_NAMES['video_spinner']).visible)
    EmptyPromise(_is_finished_loading, 'Finished    loading    the    video', timeout=200).fulfill()
    self.wait_for_ajax()
