cgiffard / Captionator

HTML5 polyfill for closed captioning with the <track> element, and implements the WHATWG Timed Text Track specification.
captionatorjs.com
300 stars 66 forks source link

Fixed initialization failure when providing an array of elements. #41

Open deestan opened 10 years ago

deestan commented 10 years ago

When providing an array of elements to the initializer function, e.g. captionator.captionify([document.getElementById("mainVideo")]), it would call processVideoElement with an invalid videoElement because it used a "spent" iterator index variable for accessing the videoElements array.

Since the rest of the code in the loop appears to work on an iterator value videoElement, it seems this is what should be used anyway.

This may also fix the following open issue: https://github.com/cgiffard/Captionator/issues/39

deestan commented 10 years ago

Also added "pointer-events: none" to overlay style, to avoid it capturing clicks on the video element as these are a popular interaction to play/pause the video.