Example #1
0
    public function embed($urls, $name, $width, $height, $options)
    {
        // Build array of source tags.
        $sources = array();
        foreach ($urls as $url) {
            $mimetype = core_media::get_mimetype($url);
            $sources[] = html_writer::tag('source', '', array('src' => $url, 'type' => $mimetype));
        }
        $sources = implode("\n", $sources);
        $title = s($this->get_name($name, $urls));
        // Default to not specify size (so it can be changed in css).
        $size = '';
        if ($width) {
            $size = 'width="' . $width . '"';
        }
        $fallback = core_media_player::PLACEHOLDER;
        return <<<OET
<audio controls="true" {$size} class="mediaplugin mediaplugin_html5audio" preload="none" title="{$title}">
{$sources}
{$fallback}
</audio>
OET;
    }