• Home
  • What's Tribler
  • Download
  • FAQ
  • Forum
Tribler
  • Developers Center

  • Getting Started
  • Introduction
  • Development Process
  • Releasing Process
  • Tips & Tricks
  • Architecture
  • Overview
  • Local Storage Structure
  • API
  • Tribler Core
  • Rationale
  • Tutorials
  • Overview
  • 1. Download Hello world!
  • 2. Video on Demand
  • 3. Live Streaming
  • 4. Content injection
  • Tools
  • Source browser
  • Roadmap
  • Timeline
  • Report a bug
  • Reported bugs
  • Gantt Chart
  • Forum

Wiki Navigation


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

  • News
  • Developers
  • Business
  • Research
  • Jobs
  • About Us
  • Press
  • Contact
Login