public function renderAudio(MediaInterface $audio, array $params = [])
    {
        if ($audio->getType() !== MediaTypes::AUDIO) {
            throw new \InvalidArgumentException('Expected media with "audio" type.');
        }

        $params = array_merge([
            'attr' => [
                'id' => 'media-audio-' . $audio->getId(),
            ],
        ], $params);

        return $this->elementTemplate->renderBlock('audio', [
            'src'  => $this->getDownloadUrl($audio),
            'attr' => $params['attr'],
        ]);
    }
public function renderAudio(MediaInterface $audio, array $params = [])
    {
        if ($audio->getType() !== MediaTypes::AUDIO) {
            throw new \InvalidArgumentException('Expected media with "audio" type.');
        }

        $params = array_merge([
            'attr' => [
                'id' => 'media-audio-' . $audio->getId(),
            ],
        ], $params);

        return $this->elementTemplate->renderBlock('audio', [
            'src'  => $this->getDownloadUrl($audio),
            'attr' => $params['attr'],
        ]);
    }
public function renderAudio ( MediaInterface $ audio , array $ params = [ ] ) { if ( $ audio -> getType ( ) !== MediaTypes :: AUDIO ) { throw new \ InvalidArgumentException ( 'Expected media with "audio" type.' ) ; } $ params = array_merge ( [ 'attr' => [ 'id' => 'media-audio-' . $ audio -> getId ( ) , ] , ] , $ params ) ; return $ this -> elementTemplate -> renderBlock ( 'audio' , [ 'src' => $ this -> getDownloadUrl ( $ audio ) , 'attr' => $ params [ 'attr' ] , ] ) ; }
Renders the audio.

@param MediaInterface $audio
@param array          $params
@return string
@throws \InvalidArgumentException
Renders the audio .