我正在尝试使用 SRT 文件向 JWplayer 添加字幕。
我能够让 JWplayer 列出多个字幕选项供观众选择,并且能够设置默认选项,这很有效。但是字幕不会出现在视频中。
我首先尝试在使用播放列表和列表栏的设置中应用字幕。
我还尝试在只有一个视频文件的设置上使用字幕(一个基本设置,以确保其他东西不会干扰它)。
我已确保我的文件名和位置正确。
Bellow 是我的两种 JWplayer 设置的 javascript。
主要设置
<script type="text/javascript">
jwplayer("player").setup({
playlist:
[
{
/* Learning video */
image: "Images/WallWoman.jpg",
sources:
[
{ file: "rtmp://--The URL--", label: "Low Quality" },
{ file: "rtmp://--The URL--", label: "High Quality" }
],
title: "Learning Video",
tracks:
[
{
file: "Subtitles/WallWomanvid.srt",
label: "English",
kind: "captions",
"default": true
},
{
file: "Subtitles/WallWomanvid.srt",
label: "French",
kind: "captions"
}
]
},
{
/* Wildlife video */
image: "Images/Wildlife.jpg",
sources:
[
{ file: "rtmp://--The URL--", label: "Low Quality" },
{ file: "rtmp://--The URL--4", label: "High Quality" }
],
title: "Wildlife Video",
tracks:
[
{ file: "/Subtitles/WallWomanvid.srt" }
]
},
{
/* Mitosis Lecture */
image: "Images/MitosisLecture.jpg",
sources:
[
{ file: "rtmp://--The URL--", label: "Low Quality" },
{ file: "rtmp://--The URL--", label: "High Quality" }
],
title: "Mitosis Lecture",
tracks:
[
{ file: "/Subtitles/WallWomanvid.srt" }
]
},
{
/* Learning video - non streamed version */
image: "Images/WallWoman.jpg",
sources:
[
{ file: "--Local File--", label: "High Quality" }
],
title: "Learning Video Static version",
tracks:
[
{ file: "/Subtitles/WallWomanvid.srt" }
]
}
],
listbar:
{
position: 'right',
size: 320
},
width: 1300
});
</script>
基本设置
<script type="text/javascript">
jwplayer("player").setup({
file: "rtmp:// -- THE URL --",
image: "Images/WallWoman.jpg",
tracks:
[
{ file: "Subtitles/WallWoman.srt" }
]
});
</script>