我有一些内部制作的MP4视频,我想在我们的内部MediaWiki(1.26.3)上托管。我似乎无法找到与此版本兼容的扩展程序。我是通过寻找合适的扩展(这意味着,是否存在显示视频的本地方式)做错了,或者我只是运气不好,直到其中一个扩展更新?
答案 0 :(得分:1)
使用VideoPlayer扩展程序(与v1.26.3兼容)和html5作为提供程序。
要安装VideoPlayer扩展程序,请按照https://www.mediawiki.org/wiki/Extension:VideoPlayer中的说明进行操作:
1)在你的wiki文件夹中,将以下php代码复制到extensions / VideoPlayer / VideoPlayer.php(如果还不存在则创建文件):
<?php
// See http://www.mediawiki.org/wiki/Extension:VideoPlayer for more information.
$wgExtensionFunctions[] = 'VideoPlayer';
$wgExtensionCredits['parserhook'][] = array(
'name' => 'VideoPlayer',
'description' => 'Display video players for youtube, dailymotion, vimeo, google, etc...',
'author' => 'Joachim Chauveheid',
'version' => 1.0
);
function VideoPlayer() {
global $wgParser;
$wgParser->setHook('video', 'renderVideoPlayer');
}
function renderVideoPlayer($input, $args) {
$url = array();
$url['allocine'] = 'http://www.allocine.fr/blogvision/%1$s';
$url['blip'] = 'http://blip.tv/play/%1$s';
$url['dailymotion'] = 'http://www.dailymotion.com/swf/%1$s?syndication=112040';
$url['facebook'] = 'http://www.facebook.com/v/%1$';
$url['gametrailers']= 'http://www.gametrailers.com/remote_wrap.php?mid=%$1s';
$url['googlevideo'] = 'http://video.google.com/googleplayer.swf?docId=%1$d';
$url['html5' ] = '%1$s';
$url['metacafe'] = 'http://www.metacafe.com/fplayer/%1$d/' . (isset($args['vid']) ? $args['vid'] : '') . '.swf';
$url['myspace'] = 'http://mediaservices.myspace.com/services/media/embed.aspx/m=%1$s';
$url['revver'] = 'http://flash.revver.com/player/1.0/player.swf?mediaId=%1$u';
$url['sevenload'] = 'http://en.sevenload.com/pl/%1$s/%2$ux%3$u/swf';
$url['viddler'] = 'http://www.viddler.com/player/%1$s';
$url['vimeo'] = 'http://www.vimeo.com/moogaloop.swf?clip_id=%1$d&server=www.vimeo.com&fullscreen=1&show_title=1&show_byline=0&show_portrait=0';
$url['youku'] = 'http://player.youku.com/player.php/sid/%1$s/.swf';
$url['youtube'] = 'http://www.youtube.com/v/%1$s?fs=%5$u';
$flashvars = array();
$flashvars['revver'] = 'mediaId=%1$u&affiliateId=0';
$type = isset($args['type'],$url[$args['type']]) ? $args['type'] : 'youtube';
$media_url = isset($url[$type]) ? $url[$type] : $url['youtube'];
$flash_vars = isset($flashvars[$type]) ? $flashvars[$type] : '';
$input_array = explode('|', htmlspecialchars($input));
$id = current($input_array);
$width = (count($input_array) > 1 && is_numeric($input_array[1])) ? $input_array[1] : 425;
$height = (count($input_array) > 2 && is_numeric($input_array[2])) ? $input_array[2] : 350;
$fullscreen = (isset($args['fullscreen']) ? $args['fullscreen'] : 'true') === 'false' ? false : true;
if(strtolower($type) == 'html5')
{
$output = '<video src="'.$id.'" controls style="width:'.$width.'px;height:'.$height.'px"></video><p style="font-size:80%;padding:0;margin:0;">(Right click to control movie)</p>';
return $output;
}
else
{
$output = '<object width="%2$u" height="%3$u">'
.' <param name="movie" value="'.$url[$type].'" />'
.' <param name="allowFullScreen" value="%4$s" />'
.' <param name="wmode" value="transparent" />'
.' <embed src="'.$url[$type] . '" type="application/x-shockwave-flash" wmode="transparent"'
.' width="%2$u" height="%3$u" allowfullscreen="%4$s"'
. ' flashvars="' . $flash_vars . '"></embed></object>';
return sprintf($output,$id,$width,$height,$fullscreen ? 'true' : 'false', (integer)$fullscreen);
}
}
?>
2)将以下内容添加到wiki的LocalSettings.php中:
require_once("$IP/extensions/VideoPlayer/VideoPlayer.php");
现在可以通过Special:Version(https://www.mediawiki.org/wiki/Special:Version)
验证安装安装VideoPlayer后,将视频复制到/ resources / assets mediawiki项目根目录中的文件夹,然后将视频标记代码写入mediawiki页面编辑器,使用&#39; html5&#39;作为提供者:
<video type="html5">/myWiki/resources/assets/my-video.mp4</video>
干杯!