game loop implementation for youtube video