Set an observer for the video.state variable, and when it is "finished" your video or playlist playback has completed, and your observer will call the function you specified when you set the observer. You should be handling 'most' of the state changes - if only to track an error condition.