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/.
Requirements ¶
Yii 1.1 or above
Usage ¶
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',
));
Media
thanks for this extension its working great for me,
its very useful extension for mp4 media files....)
ext
wow... thanks ^_^
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.
@karmraj
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',
@shiv
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.
@karmraj
it seems you are new to html5 player. Is this url link working on internet?
Could you please share?
-Shiv
excelent shiv
it's only for one file audio..it wont work more than two files audio..how can make it? thanks in advance
@yiijco
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.
http://mediaelementjs.com/
Thanks,
Shiv
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";
add
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 :
<?php $this->widget ( 'ext.mediaElement.MediaElementPortlet', array ( 'url' => $model->stream, 'mimeType' =>$formato, 'autoplay'=>false, )); ?>
Git repository setup here
https://github.com/acorncom/yii-mediaelement
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 ...
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
@acorncom
Thanks for moving to github. I would love me part of dev . Please add me as : spanjeta
Removed demo link as it was obsolete
Removed demo link as it was obsolete
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.