Video On Demand Tutorial

s = Session()

tdef= TorrentDef.load('HelloWorld.torrent')

dscfg = DownloadStartupConfig()


d = s.start_download(tdef,dscfg)


def vod_event_callback(d,event,params):

    # Called by new thread

    if event == VODEVENT_START:

        filename = params["filename"]

        mimetype = params["mimetype"]

        stream   = params["stream"]

        length   = params["length"]


        if filename:




In this example a video_event_callback is defined. This callback function will be called one time with event VODEVENT_START, 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 with this event you can start watching the video in a player.