This package contains a replacement class for the file attachments.
Also, a backend form widget is included, as are some console commands.
For some functions to work you must have ffmpeg installed and the path added to our config file.
- Either override
ffmpegPathin the plugin config file inconfig/sewa/mediafile/config.php - Or call
MediaFileManager::instance()->setFfmpegPath( 'C:\\ffmpeg.exe' )
public $attachOne = [
'audio_file' => ['Sewa\Mediafile\Models\MediaFile']
];
public $attachMany = [
'video_files' => ['Sewa\Mediafile\Models\MediaFile']
];
fields:
video_files:
label: Video
type: mediafileupload
mode: video-multi
conversionTypes: ['mp4','webm','ogg']
imageWidth: 200
imageHeight: 200
audio_file:
label: Audio
type: mediafileupload
mode: audio-single
conversionTypes: ['mp3']
imageWidth: 200
imageHeight: 200
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
RewriteCond %{REQUEST_URI} !\.xap
RewriteCond %{REQUEST_URI} !\.ogv
<video width="100%" height="auto" controls="controls" preload="auto">
<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
<?php if($file->hasConvertedFile('mp4')): ?><source type="video/mp4" src="<?= $file->getConvertedPath('mp4') ?>" /><?php endif ?>
<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
<?php if($file->hasConvertedFile('webm')): ?><source type="video/webm" src="<?= $file->getConvertedPath('webm') ?>" /><?php endif ?>
<!-- Ogg/Vorbis for older Firefox and Opera versions -->
<?php if($file->hasConvertedFile('ogg')): ?><source type="video/ogg" src="<?= $file->getConvertedPath('ogg') ?>" /><?php endif ?>
<!-- Flash fallback for non-HTML5 browsers without JavaScript -->
<object width="320" height="240" type="application/x-shockwave-flash" data="plugins/sewa/mediafile/assets/mediaelement-js/flashmediaelement.swf">
<?php if($file->hasConvertedFile('mp4')): ?>
<param name="movie" value="plugins/sewa/mediafile/assets/mediaelement-js/flashmediaelement.swf" />
<param name="flashvars" value="controls=true&file=<?= $file->getConvertedPath('mp4') ?>" />
<?php endif ?>
</object>
</video>