扩展:EmbedVideo(视频嵌入器分叉版)
发行状态: 稳定版 |
|
|---|---|
| 实现 | 解析器函数 |
| 描述 | 添加了一个解析器函数,支持从多种流行视频站点嵌入视频 |
| 作者 | Octfx, Alistair3149, Alexia E. Smith, Andrew Whitworth, Jim R. Wilson |
| 维护者 | Octfx |
| 最新版本 | 4.0.0 (Continuous updates) |
| 兼容性政策 | master分支维持向后兼容。 |
| MediaWiki | 1.43+ |
| PHP | >=8.0 |
| Composer | starcitizenwiki/embedvideo |
| 许可协议 | MIT授權條款 |
| 下載 | |
| 翻译EmbedVideo (fork)扩展 | |
EmbedVideo 扩展添加了一个名为 #ev 的解析器函数和多个解析器标签(例如 <youtube>),进而支持从多个视频平台嵌入视频片段。
它还添加了视频和音频媒体处理器,以支持将标准 [[File:Example.mp4]] 文件链接转换为嵌入式 HTML5 <video> 和 <audio> 标签。
这个分叉版本增强了隐私性,添加了一个可切换的设置选项,只有在用户通过点击视频并明确同意后,才会加载外部内容。
请注意,缩略图仍然是从相应的视频平台中获取的,这会导致连接到外部网址。
This behaviour can be disabled by setting $wgEmbedVideoFetchExternalThumbnails to false.
安裝
- 下载文件,并将其放置在您
extensions/文件夹中的EmbedVideo目录内。 - 請新增下列代码到您的LocalSettings.php文件的底部:
wfLoadExtension( 'EmbedVideo' );
完成 – 請导航至您的wiki上的Special:Version,以验证此扩展已成功安装。
用法
媒体处理程序
对于本地上传的内容,在页面上显示它的过程与图像相同。 See the image syntax documentation on MediaWiki.org for complete reference on this feature.
This example would display a video in page using a HTML5 <video> tag.
[[File:Example.mp4]]
如需指定视频开始和视频结束的时间戳,请使用 start 和 end 这两个参数。 The timestamp can be formatted as one of: ss, :ss, mm:ss, hh:mm:ss, or dd:hh:mm:ss.
[[File:Example.mp4|start=2|end=6]]
Additionally, a cover image can be set for video files by specifying a cover= key.
[[File:Example.mp4|start=2|end=6|poster=File:LocalFile.png]]
可用选项
在使用媒体处理程序处理本地文件时,以下选项可用。
Options are added to the wikitext like |poster=File:... or |start=2.
- loop
- Loops the audio / video
- autoplay
- Automatically plays the file
- nocontrols
- Disables the control elements
Options only available for video files:
- poster / cover
- Sets a local image file as the cover of the video
- muted
- Mutes the audio track of the video (required for autoplay)
- gif
- Special option that sets autoplay, muted, loop and nocontrols e.g. makes the video behave like a gif
When $wgEmbedVideoUseEmbedStyleForLocalVideos is enabled two additional options are available
- title
- Title of the video
- description
- Description shown below the video
Parser function #ev
The EmbedVideo parser function expects to be called in any of the following ways:
{{#ev:service|id}}{{#ev:service|id|dimensions}}{{#ev:service|id|dimensions|alignment}}{{#ev:service|id|dimensions|alignment|description}}{{#ev:service|id|dimensions|alignment|description|container}}{{#ev:service|id|dimensions|alignment|description|container|urlargs}}{{#ev:service|id|dimensions|alignment|description|container|urlargs|autoresize}}
However, if needed optional arguments may be left blank by not putting anything between the pipes:
{{#ev:service|id|||description}}
Alternatively each parameter can be used in any order as a named parameter. The following parameter are available:
iddimensionsalignmentdescriptioncontainerurlArgsautoResizevAlignmentwidthheightposter/cover- This only has an effect if
$wgEmbedVideoRequireConsentis set to true
- This only has an effect if
title- This only has an effect if
$wgEmbedVideoRequireConsentis set to true
- This only has an effect if
Do note mixing named and unnamed parameters will require you to add all unnamed parameters (and blanks) in the previously mentioned order.
E.g. using named id and unnamed description {{#ev:service||||This is the Description|id=abc}}/ {{#ev:service|id=abc|||This is the Description}}
支持的视频平台
As of version 3.x, EmbedVideo supports embedding video content from the following services:
- New Services
New services can be requested by using the following link or clicking New Issue.
配置
| Variable | Default Value | Description |
|---|---|---|
$wgEmbedVideoAddFileExtensions
|
true
|
Boolean - Enable or disable adding video/audio file extensions to the list of allowable files to be uploaded. |
$wgEmbedVideoEnableVideoHandler
|
true
|
Boolean - Enable or disable the video media handlers for displaying embedded video in articles. |
$wgEmbedVideoEnableAudioHandler
|
true
|
Boolean - Enable or disable the audio media handlers for displaying embedded audio in articles. |
$wgEmbedVideoLazyLoadLocalVideos
|
false
|
Boolean - Sets 'preload="none"' on every |
$wgEmbedVideoUseEmbedStyleForLocalVideos
|
false
|
Boolean - Styles local videos like they are embedded content. DO NOTE: When changing this, every page with a local video needs to be updated in the parser cache! |
$wgEmbedVideoDefaultWidth
|
640
|
Integer - Globally override the default width of video players. When not set this uses the video service's default width which is typically 640 pixels. |
$wgEmbedVideoMinWidth
|
null
|
Integer - Minimum width of video players. Widths specified below this value will be automatically bounded to it. |
$wgEmbedVideoMaxWidth
|
null
|
Integer - Maximum width of video players. Widths specified above this value will be automatically bounded to it. |
$wgFFprobeLocation
|
/usr/bin/ffprobe
|
String - Set the location of the ffprobe binary. |
$wgEmbedVideoEnabledServices
|
null
|
Array - Array of service names that are allowed, if empty all services are available. |
$wgEmbedVideoRequireConsent
|
true
|
Boolean - Set to true to only load the iframe if the user clicks it. |
$wgEmbedVideoFetchExternalThumbnails
|
true
|
Boolean - Set to false to disable fetching video thumbnails from the external video provider. Currently only works for YouTube and Vimeo. |
另请参阅
| 此扩展在以下wiki农场/托管网站和/或软件包中提供: 這不是一份權威名單。 即使某些wiki农场/托管网站和/或软件包未在这里列出,它们也可能提供此扩展。 请检查你的wiki农场/托管网站或软件包以确认提供情况。 |
- Stable extensions/zh
- Parser function extensions/zh
- Extensions supporting Composer/zh
- MIT licensed extensions/zh
- Extensions in GitHub version control/zh
- ParserFirstCallInit extensions/zh
- BeforePageDisplay extensions/zh
- ArticlePurge extensions/zh
- All extensions/zh
- Extensions included in BlueSpice/zh
- Extensions included in Canasta/zh
- Extensions included in Miraheze/zh
- Extensions included in ProWiki/zh
- Extensions included in wiki.gg/zh
- Extensions included in WikiForge/zh
