thomassturm / VideoSub

HTML5 Video with SRT Subtitles
Other
120 stars 56 forks source link

throws errors on pages with no video tags #1

Open abritinthebay opened 11 years ago

abritinthebay commented 11 years ago

This is a problem if you're building a library which may or may not have video on page load. For example in any modern javascript application.

Simple fix - in videosub_main add this as the second line:

if(!myVideo) { return; }

and then add below the domReady call:

$VIDEOSUB.fn.videosub = videosub_main;

So the code is callable when needed. In fact I'd suggest removing the dom call entirely.