private function get_downloads() { $player_media_files = new PlayerMediaFiles($this->episode); $media_files = $player_media_files->get(); $downloads = []; foreach ($media_files as $file) { $downloads[] = ['assetTitle' => $file['assetTitle'], 'size' => $file['size'], 'downloadUrl' => $file['publicUrl'], 'directAccess' => $file['url'], 'url' => $file['url']]; } return $downloads; }
public function render($context = NULL) { $player_media_files = new PlayerMediaFiles($this->episode); $media_files = $player_media_files->get($context); // build main audio/video tag $xml = new \SimpleXMLElement('<' . $player_media_files->media_xml_tag . '/>'); $xml->addAttribute('controls', 'controls'); $xml->addAttribute('preload', 'none'); if (count($this->attributes) > 0) { foreach ($this->attributes as $key => $value) { $xml->addAttribute($key, $value); } } // add all sources $xml = $this->add_sources($xml, $media_files); // prettify and prepare to render $xml_string = $xml->asXML(); // TODO: use DomDocumentFragment $xml_string = $this->format_xml($xml_string); $xml_string = $this->remove_xml_header($xml_string); return '<div class="podlove-player-wrapper">' . $xml_string . '</div>'; }