The game ends when the laser touches your Hero. 

You'll still have a few seconds to grab a few extra Gems but once the laser got you, your time is counted.

You can also keep playing by watching a short video. 

You'll start close to where the laser touched your Hero and you'll go until it touches you again. 

Once the laser touches your Hero a second time, you'll still get a few seconds for a last ditch effort before your game ends for good.