SRT file with JWplayer

user3009618 picture user3009618 · Nov 19, 2013 · Viewed 7.9k times · Source

I am attempting to use an SRT file to add captions to JWplayer.

I am able to get JWplayer to list multiple subtitle options for the viewer to choose, and able to set a default option and this works. However the captions do not appear in the videos.

I first attempted to apply captions in a setup which uses a playlist and listbar.

I have also tried to use captions on a setup which just has a single video file (a bare-bones setup to make sure something else is not interfering with it).

I have made sure that my file names and locations are correct.

Bellow is my javascript for both JWplayer setups.

MAIN SETUP

<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>

BASIC SETUP

<script type="text/javascript">
    jwplayer("player").setup({
        file: "rtmp:// -- THE URL --",
        image: "Images/WallWoman.jpg",
        tracks:
        [
            { file: "Subtitles/WallWoman.srt" }
        ]
    });
</script>

Answer