added end-of-video functionality to getFrame()