The answer for 1 is here:
https://github.com/miohtama/Krusovice/blob/master/src/tools/echonest.js#L107
You can use Echo Nest API service to extract all kind of features of a song file, one including offline beat detection (also detects bars, and such). The example is a Javascript example you can run in a (customized) Chrome:
https://github.com/miohtama/Krusovice/blob/master/demos/timing-tester.html
The answer for 2 is that you tie your game logic clock to audio playback clock, not Javascript system time. Like here:
https://github.com/miohtama/Krusovice/blob/master/src/show.js#L1072
You listen for audio on time update events and then between the events interpolate the passed time using system clock.
Disclaimer: I am the author of the code