该微件 (vPlus) 允许作者创建与视频同步的 HTML 幻灯片组。与传统视频相比,vPlus 的优势如下:
- 幻灯片可以使用 DevSite 功能,例如: <ph type="x-smartling-placeholder">
作者可以控制视频是在幻灯片的一角显示、覆盖整个幻灯片,还是在用户与幻灯片互动时停止。
演示
以下是 vPlus 功能的示例。按 Play 按钮即可开始。
架构
使用 devsite-vplus
类标记元素即可创建 Plus 版 Video widget。此外,该元素必须包含一个 data-video-id
属性,用于指定要显示的 YouTube 视频的 ID。
如果 widget 元素还包含 data-captions-url
属性,则应指定一个 json 文件,其中包含与视频对应的字幕。此文件应与 md
或 html
文件位于同一目录中;如果此文件以“/”开头,则文件的路径应从根目录开始。如需详细了解该文件的格式和生成方式,请参阅 vPlus 视频播放器。您必须手动从视频中提取字幕文件;如需了解详情,请参阅 //engedu/common/vplus/README.md
;以及用于生成字幕文件的工具。
此外,devsite-vplus
元素应包含一个类为 devsite-vplus-content-container
的元素。而该元素应包含一个类为 devsite-vplus-slide-frame
的元素。
假定 devsite-vplus-slide-frame
元素中的每个元素都是一张幻灯片。幻灯片必须按时间顺序列出。每个幻灯片元素都必须有一个 data-start-time
属性,用于指定此幻灯片的显示时间(以秒为单位)。此外,每张幻灯片都可能具有 data-video-mode
属性。该属性有两个有效值:
- “large”:可使视频占据幻灯片的大部分空间,覆盖幻灯片。
- "stopped":当幻灯片播放到时,视频暂停。
如果未指定 data-video-mode,则视频默认为较小尺寸。
幻灯片作者可能需要为其幻灯片指定额外的 CSS。由于幻灯片包含在类为 devsite-vplus-slide-frame
的 div
中,因此特定于幻灯片的 CSS 样式可以命名空间到此类的子元素。
例如:
<style>
.devsite-vplus-slide-frame h1 {
background-color: #4285F4;
border-bottom: 1px solid #7BAAF7;
color: #fff;
margin: 0;
padding: 10px;
top: 0 !important;
}
/* More styles... */
</style>
<div class="devsite-vplus" data-video-id="PXVnv_Paexc" data-captions-url="video-plus-captions.json">
<div class="devsite-vplus-content-container">
<div class="devsite-vplus-slide-frame">
<div data-start-time=0 class="title-background">
<div class="header1 title">vPlus Demo</div>
</div>
<div data-slide-note=true>
Note for the 'title' slide.
</div>
<div data-start-time=2 data-video-mode="large">
<!-- Intentionally left blank -->
</div>
<div data-slide-note=true>
This slide was intentionally left blank.
</div>
<div data-start-time=13>
<div class="header2">Nice Informative Slide</div>
<ul>
<li>Nice, informative bullet point</li>
<li>Another nice, informative bullet point</li>
</ul>
</div>
<div data-slide-note=true>
Very meta. In this note, we could talk about several things:
<ul>
<li>What could go in the note versus in the slide itself.
<ul>
<li>Either can contain HTML or markdown</li>
<li>Whether it would be useful to display something to the viewer
or only in the notes that the presenter would presummably
see and may read out loud.</li>
</ul>
</li>
<li>Users may view notes themselves, usually offline.</li>
<li>Notes could be a way of
<a href="#demo">linking to demos</a>.
</li>
</ul>
</div>
<div data-start-time=21>
<div class="header2">Nice, informative cat picture</div>
<div>
<!-- Image CCO Public Domain at https://pixabay.com/en/kitten-cute-feline-kitty-domestic-1246693/ -->
<img class="cat-pic" src="https://cdn.pixabay.com/photo/2016/03/09/15/31/kitten-1246693_1280.jpg">
</div>
</div>
<div data-start-time=32 data-video-mode="stopped">
<div class="header2">Here's some interactive content</div>
<div>
<devsite-multiple-choice>
<div>What color is the sky?</div>
<div correct>
<div>Blue</div>
<div>But do you know <b>why</b>?</div>
</div>
<div>
<div>Purple</div>
<div>Not really</div>
</div>
<div>
<div>Indigo</div>
<div>Close but not quite</div>
</div>
<div>
<div>Green</div>
<div>What planet are you from?</div>
</div>
</devsite-multiple-choice>
</div>
</div>
<div data-slide-note="true">
Note, when an interactive slide is reached,
you have to click the 'Play' button,
or the 'Next Slide' button in order to continue.
</div>
<div data-start-time=33 data-video-mode="stopped">
<div class="header2">Here's some more interactive content - <a href="/blockly/">Blockly</a></div>
<iframe style="height: 75%; width: 90%; margin: 0 5%;" src="/blockly/blockly-demo/blockly-demo"></iframe>
</div>
<div data-start-time=34 data-video-mode="large">
<!-- Intentionally left blank -->
</div>
<div data-start-time=78>
<div>
<div class="header2">Thanks for watching!</div>
<ul>
<li>Video Plus drives video play and slides</li>
<li>Reduces need to reshoot video if slides change</li>
<li>Provides searchable transcript</li>
<li>Pauses video for user interactions</li>
<li>Video can switch between large and small</li>
</ul>
</div>
</div>
</div>
</div>
</div>
在网页上显示 vPlus 微件时,视频播放器不会自动启动,但在用户点击播放按钮后,幻灯片和字幕(如果显示)会自动推进。用户还可以使用以下鼠标和键盘操作来与微件互动。