/** * Renders videofile video. * * @param videofile $videofile * @return string HTML */ public function video(videofile $videofile) { $output = ''; $contextid = $videofile->get_context()->id; // Open videofile div. $vclass = $videofile->get_instance()->responsive ? 'videofile videofile-responsive' : 'videofile'; $output .= $this->output->container_start($vclass); // Open video tag. $posterurl = $this->get_poster_image($contextid); $output .= $this->get_video_element_html($videofile, $posterurl); // Elements for video sources. $output .= $this->get_video_source_elements_html($contextid); // Elements for caption tracks. $output .= $this->get_video_caption_track_elements_html($contextid); // Close video tag. $output .= html_writer::end_tag('video'); // Alternative video links in case video isn't showing/playing properly. $output .= $this->get_alternative_video_links_html($contextid); // Close videofile div. $output .= $this->output->container_end(); return $output; }