Added checks so that is not possible to hang in case of error on init.
If the video is finished then it stops