Fixed stopping the stream.
Restart capturing after suspend or errors.
Replaced onended event with a watchdog since onended is broken in Chrome.