4

I'm trying to set up a pseudostreaming site that has timed subtitles for h264 video files that are served via nginx_mod_h264_streaming + JW Player. The subtitles are automatically converted to a format that JW player can read, which is a PHP script that takes a viewer's current location in the video and spits out an XML-like file that has subtitle lines and their starting+ending timestamps, relative to where the viewer is.

Whenever the viewer loads the stream page then, the video is automatically-seeked to its proper place relative to a starting time stored in a MySQL DB, and the subtitles are also seeked forward properly. The user doesn't see any of this; he or she just sees him or herself at the proper place in the video.

My issue is that the subtitle timestamps need to be pretty accurate, and that nginx_mod_h264_streaming can only seek to the closest keyframe in the video, which is pretty frequently displaced a significant amount of time from where the user should be seeked. I'm under the impression that this isn't a problem that can really be fixed; you can only really seek to a keyframe if you want to display the video properly.

What I'm wondering is this: is there any way to read the time that the video is actually seeked to, or maybe even the keyframe number so I can at least display the subtitles properly? I can't find anything in the JW Player docs to indicate a way of doing this; if another player is capable of this, I'd be open to switching.

Thanks much for your help!

1 Answers1

1

I believe you can use javascript to get that:

jwplayer("container").getPosition();

Where container is the id of the JWPlayer container element, or without, if there is only one JW Player on the page:

jwplayer().getPosition();

http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12540/javascript-api-reference#GettingStarted

David A
  • 31
  • 3