Flowplayer-Subtitle
SOURCE URL: https://flowplayer.org/docs/subtitles.html
Setting up
Subtitles are loaded with a <track> element as follows
<div class="flowplayer">
<video>
<source type="video/webm" src="http://mydomain.com/my-video.webm">
<source type="video/mp4" src="http://mydomain.com/my-video.mp4">
<source type="video/ogg" src="http://mydomain.com/my-video.ogv">
<!-- the track element -->
<track src="/path/to/my-subtitles-en.vtt">
</video>
</div>
The WEBVTT file of the track element has the following structure:
WEBVTT FILE
1
00:00:01.000 --> 00:00:04.000
The first subtitle from 1 seconds to 4 seconds
This is a second line
And a third one
2
00:00:05.000 --> 00:00:06.000
<b>Bold</b>, <i>italic</i> and <u>underlines</u> are supported
...
A sample file. Understanding the VTT file format.
Note: Subtitles must be loaded from a local path - unless they are served with a loose cross-origin policy with an appropriate Access-Control-Allow-Origin header. For instance, in an Apache configuration:
Header set Access-Control-Allow-Origin "*"
For more details look up cross-orgin resource sharing.
Custom looks
The first subtitle above would be rendered on the player as follows
<div class='fp-subtitle'>
<p>The first subtitle from 1 seconds to 4 seconds</p><br>
<p>This is a second line</p><br>
<p>And a third one</p><br>
</div>
Flowplayer comes with a default look for the subtitles but here is how you can alter the looks with CSS
/ override default looks /
.flowplayer .fp-subtitle {
font-size: 18px;
}
/ visible subtitle looks (.fp-active class) /
.flowplayer .fp-subtitle.fp-active {
opacity: 0.8;
}
/ custom looks for 7:th subtitle /
.flowplayer.cue6 .fp-subtitle p {
font-size: 40px;
}
Native subtitles
Currently the <track> element is supported natively in following browsers
- IE 10 (since November 2011)
- Google Chrome 18 (since November 2011)
- Safari 6 (July 2012)
- Opera 12.5 (August 2012)
You can enable native support with nativesubtitles configuration variable and by adding default attribute to your track element. For example
<div class="flowplayer" data-nativesubtitles="true">
<video>
<source type="video/webm" src="http://mydomain.com/my-video.webm">
<source type="video/mp4" src="http://mydomain.com/my-video.mp4">
<track src="/path/to/my-subtitles-en.vtt" default>
</video>
</div>
After this subtitle looks are browser dependent and you lose the CSS customization possibilities. Native support is present when flowplayer.support.subtitles is true. For example
if (flowplayer.support.subtitles) {
// do your thing
}
JavaScript API
Internally flowplayer uses cuepoints to notify when subtitle starts and ends. Here is an example of how to capture subtitle events
player.bind("cuepoint", function(e, api, cuepoint) {
var subtitle = cue.subtitle;
// start a subtitle
if (subtitle) {
}
// end the subtitle
if (cuepoint.subtitleEnd) {
}
});
The subtitle object has following properties title, startTime, endTime and text. An API property subtitles is an array of all subtitles. For example
console.info(flowplayer().subtitles);
Known issues and limitations
Flowplayer does not add any UI element for controlling subtitles. If the <track> element is provided subtitles are enabled and cannot be removed by the user. You also need to control the language of the subtitles on your web application. User cannot switch the language from the player.
Flowplayer does not support VTT extra definitions such as text alignment and line position. Style is completely controlled with CSS for full cross browser support.
When using the default attribute on the track element some browsers may show their native controlbar for a short glimpse of time.
Currently subtitles are not supported in playlists and are omitted when the player is embedded.
Flowplayer-Subtitle的更多相关文章
- HTML5播放器FlowPlayer的极简风格效果
在线演示 本地下载 使用Flowplayer生成的极简风格的播放器效果.
- [开发笔记]-flowplayer视频播放插件
最近项目中需要添加播放视频的功能,视频文件是flv格式的.在网上找了一些jQuery视频播放插件,还是觉得“flowplayer”要好一些.特将使用方法记录一下. flowplayer也有html5版 ...
- 根据body的内容 查找h2标签的@class="subtitle"的值
<pre name="code" class="html"><body class="api jquery listing" ...
- flowplayer+flashhls使用过程中发现的一些小问题
flashls里边有好几套代码,主要看生成路径,其中flowplayer用了flashls.swc,flashls.swc使用的代码在这里:/src/org/mangui/hls,所以要注意,当搜索代 ...
- FlowPlayer 参数说明
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> & ...
- 兼容各个浏览器的H.264播放: H.264+HTML5+FLOWPLAYER+WOWZA+RMTP
一.方案确定 计划做视频播放,要求可以播放H264编码的mp4文件,各个浏览器,各种终端都能播放. 首先查找可行性方案, http://www.cnblogs.com/sink_cup/archive ...
- flowplayer视频播放插件
flowplayer视频播放插件 最近项目中需要添加播放视频的功能,视频文件是flv格式的.在网上找了一些jQuery视频播放插件,还是觉得“flowplayer”要好一些.特将使用方法记录一下. f ...
- E/MediaPlayer: Should have subtitle controller already set
原文链接:http://stackoverflow.com/questions/20087804/should-have-subtitle-controller-already-set-mediapl ...
- FFmpeg中subtitle demuxer实现
[时间:2019-01] [状态:Open] [关键词:字幕,ffmpeg,subtitle,demuxer,源码] 0 引言 本文重心在于FFmpeg中subtitle demuxer的实现逻辑. ...
- 谷歌机翻英文字幕输出(Subtitle Edit)
Subtitle Edit 下载地址(https://github.com/SubtitleEdit/subtitleedit/releases/tag/3.5.0) 添加字幕文件后,点下图的Auto ...
随机推荐
- A trip through the Graphics Pipeline 2011_09_Pixel processing – “join phase”
Welcome back! This post deals with the second half of pixel processing, the “join phase”. The pre ...
- Ueditor 1.4.3.1 使用 ThinkPHP 3.2.3 的上传类进行图片上传
在 ThinkPHP 3.2.3 中集成百度编辑器最新版 Ueditor 1.4.3.1,同时将编辑器自带的上传类替换成 ThinkPHP 3.2.3 中的上传类. ① 下载编辑器(下载地址:http ...
- 预防 Session 劫持与 Session 固定攻击
一.预防 Session 劫持 要求: ① 只允许通过 Cookie 来传递 SessionID ② 生成一个由 URL 传递的唯一标识作为 Session 的标记(token) 当请求同时包含有效的 ...
- ArcGIS Server 增加缓存路径
Server缓存服务,由于缓存文件经常比较大,默认放在C盘下容易导致磁盘空间不够,因此Server提供了增加缓存路径的方法来解决该问题. 增加的路径有两种,一种是Server所在服务器增加一个和原缓存 ...
- C#编程利器之二:结构与枚举(Structure and enumeration)【转】
C#编程利器之二:结构与枚举(Structure and enumeration) 在上一篇文章中,介绍了类如何封装程序中的对象.而实际中,出了类可以封装对象外,结构和枚举也可以封装一些对象,本文将着 ...
- BUG级别(优先级、严重级)定义
一.主要分类 BUG类型标准主要分两类: Ø 依据优先级分类. Ø 依据严重程度分类. 二.主要内容 依据优先级分类标准 定义 优先级:指一个BUG相对于其他BUG对于公司的影响,解决的及时性. 分类 ...
- Display Voxel Gird and PCA
https://github.com/yhexie/NDTEX 最近科研没有思路,写点代码加强基础知识的学习吧. 下面写了一个点云体素分割,PCA计算体素内点云的特征值和特征向量.
- echarts入门基础,画柱型图
注意:一定要自己引入echarts库 <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...
- LuaXMLRPC笔记
XMLRPC XMLRPC 为以http为传输协议,使用xml格式化数据来执行远程过程调用, 区别于本地过程调用, 即发生在不同主机之间. 属于分布式计算的一种简单实现,比web service简单易 ...
- luaprofiler探索
什么是luaprofiler? http://luaprofiler.luaforge.net/manual.html LuaProfiler is a time profiler designed ...