4
votes

I'm trying to use the JWPlayer Caption plugin in an environment that is not exposed to the public internet.

All of the documentation I've read about JWPlayer plugins (like this) just says to insert a JSON snippet like this in your JWPlayer setup code:

plugins: {
 "captions-2": {
   file: "/assets/captions.srt"
 }

But when I do this JWPlayer attempts to load a plugin script from the following URL http://lp.longtailvideo.com/5/captions/captions-2.js, but--because my system can't reach the public internet--this URL in inaccessible.

I would like to host the captions-2.js file myself, but I don't know how to reference the file in my JWPlayer setup. Can anyone tell me how to customize the location of the plugin file that JWPlayer attempts to download?

Thanks.

2

2 Answers

2
votes

Turns out you can refer to a plugin either via its "name", in which case the plugin will be downloaded from JWplayer's content servers or by URL, in which case JWPlayer attempts to download whatever is at the specified URL and use it as a plugin. So for the example above, assuming I downloaded the captions-2.swf file and saved it on my local server, I could refer to it like so...

plugins: {
  "/static/js/jwplayer-5.8/captions-2.swf": {
     file: "/assets/captions.srt"
  }
}
1
votes

I did the same: I placed .swf and captions-2.js (plugin) in my local server which is configured with Eclipse.

My sample code is:

<script type="text/javascript">
    jwplayer("mediaplayer").setup({
        flashplayer: "player.swf",
        file: "video.mp4",
        plugins: {
            'http://localhost:8080/myvideo/captions-2.js': {
                file: "/assets/captions.srt"
            }
        }
    });
</script>

Also, I used HTTPFOX to check the content returned from request.

Everything worked fine, but closed caption did not work. I guess captions.file is not set..