Video On Demand Tutorial
s = Session() tdef= TorrentDef.load('HelloWorld.torrent') dscfg = DownloadStartupConfig() dscfg.set_video_start_callback(vod_ready_callback) d = s.start_download(tdef,dscfg) def vod_ready_callback(d,mimetype,stream,filename,length): # Called by new thread if filename: videoplayer.play_file(filename) else: videoplayer.play_stream(mimetype,stream,length)
In this example a video_start_callback is defined. This callback function will be called one time, when (a) sufficient data is downloaded from the beginning of the file and (b) the download speed is larger than the bitrate. So when this function is called you can start watching the video in a player.
This callback was changed in our more recent development branches, see our latest code
