我正在尝试使用SRT文件为JWplayer添加字幕。
我能够让JWplayer列出多个字幕选项供观众选择,并且能够设置默认选项,这是有效的。但是,字幕不会出现在视频中。
我首先尝试在使用播放列表和列表栏的设置中应用字幕。
我还尝试在只有一个视频文件的设置上使用标题(一个简单的设置,以确保其他内容不会干扰它)。
我确保我的文件名和位置正确无误。
主要设置
<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>