Yii 1.1: mediaelement

HTML5 audio & video player using mediaElement JS library

This ext allow you to add HTML5 audio and video player using mediaElement JS library to you Yii project.

Its using latest code from http://mediaelementjs.com/.


Yii 1.1 or above


Just use the widget anywhere in your view code.

$this->widget ( 'ext.mediaElement.MediaElementPortlet',
    array ( 
    'url' => 'http://www.toxsl.com/test/bunny.mp4',
// or you can set the model and attributes
    //'model' => $model,
    //'attribute' => 'url'
// its required and so you have to set correctly
    // 'mimeType' =>'audio/mp3',

Total 13 comments

#20127 report it
shiv at 2017/09/14 09:30am
Removed demo link as it was obsolete

Removed demo link as it was obsolete

#15679 report it
shiv at 2013/12/06 05:29am

Thanks for moving to github. I would love me part of dev . Please add me as : spanjeta

#15639 report it
acorncom at 2013/12/02 08:10pm
Just added support for multiple media files

And fixed the autoplay issue found by @blammo. Added in a few other tweaks as well. All changes are on Github

#15638 report it
acorncom at 2013/12/02 04:10pm
Git repository setup here


I'm planning on adding Composer/Packagist support, etc to this. @shiv, happy to move this to your ownership on Github if you want, just contact me ...

#14761 report it
blammo at 2013/09/07 06:58pm
modifications - autoplay off

Autoplay fix : To avoid activating the autoplay I make some changes in the code. In the line of code 115 make some changes and add the following. change

if ( $this->autoplay == true ) $this->autoplay = "autoplay";


if ( $this->autoplay == false ) $this->autoplay = "";

In the line of code 133 make some changes

<<?php echo $this->mediaType;?>
     id="player2" src="<?php echo $this->url; ?>"
    type="<?php echo $this->mimeType; ?>" controls="controls" <?php echo $this->autoplay; ?>>

Now we can pass the parameter autoplay => false in the widget. Example :

$this->widget ( 'ext.mediaElement.MediaElementPortlet',
    array ( 
    'url' => $model->stream,
    'mimeType' =>$formato,
#12699 report it
shiv at 2013/04/06 07:26am

Yes, Its a sample use case where your just want to play a single file. If you need more advance options then I think you should directly integrate the media element JS code. It allow adding multiple tracks formats.


Thanks, Shiv

#12695 report it
yiijco at 2013/04/06 12:23am
excelent shiv

it's only for one file audio..it wont work more than two files audio..how can make it? thanks in advance

#12646 report it
shiv at 2013/04/03 08:35am

it seems you are new to html5 player. Is this url link working on internet? Could you please share?


#12643 report it
karmraj at 2013/04/03 07:12am

I have pass complete path to access this file. Now i error will remove but video or audio file does not played. The only loading image appear in window.

#12642 report it
shiv at 2013/04/03 06:28am

Is the file accessible from web browser? You should pass absolute url not just filename. It tried to get mime type based on filename and if you already know then you should set that in options.

'mimeType' =>'video/mp4',
#12640 report it
karmraj at 2013/04/03 05:15am
Getting following error.

I am getting an error like this When i trying to play video file from my local machine.

mime_content_type(filename.mp4): failed to open stream: No such file or directory.

#12619 report it
Nur Rochim at 2013/04/02 12:56am

wow... thanks ^_^

#12618 report it
rajesh chaurasia at 2013/04/02 12:22am

thanks for this extension its working great for me, its very useful extension for mp4 media files....)

Leave a comment

Please to leave your comment.

Create extension