Skip to content
Peter Gusev edited this page May 2, 2015 · 1 revision

Description

YoutubeTOP library is a C++ dynamic library linked against libVLC and provides functionality to stream video from video-hosting services like Youtube. It's main class conforms to the TouchDesigner's TOP_CPlusPlusBase interface.

NOTE: as it's a Win32 library, it can only be used with the appropriate TouchDesigner version (x86, not x64).

Requirements

  • libVLC x86

    Once downloaded and installed, the following files/folders should be placed in the same directory as YouTubeTOP.dll:

    • libvlccode.dll
    • libvlc.dll
    • plugins (whole folder)

Interface

Inputs

YouTubeTOP should be loaded using special TouchDesigner's CPlusPlus TOP. It's DLL Path parameter should point to the YouTubeTOP.dll file (double check Requirements and VLC library).

CPlusPlus OP has standard interface and a number of pre-defined input sets (floats, CHOPs and strings). For the end user, these inputs carry no sense unless specific C++ library has been loaded. CPlusPlus_TOP inputs for YouTubeTOP.dll are described below:

  • Strings:
    • string0 (videoURL) - URL of the video to be streamed; YouTubeTOP initiates streaming every time URL changes and if it's not an empty string.

NOTE: Even though, YouTubeTOP initiates streaming process automatically each time URL is changed, the actual playback, however, is controlled by other parameters (see further). Thus, for example, one can enable input isPaused and change URL to achieve so-called "pre-buffering" behavior - video will be buffered, but not played until user explicitly initiates playback by setting isPaused to zero.

  • Floats:
    • value0x (isLooping) - indicates, whether the video should be played repeatedly (1 is looping);
    • value1x (isPaused) - indicates, whether the video should be paused or not (1 is paused);
    • value2x (seek) - seeking position of the video; this input can be used for video scrubbing;
    • value3x (switchOnCue) - if the value is below or equal 0.5, new video will start to play only after it'll be buffered; otherwise - video switching is triggered by using the switchCue input;
    • value3y (switchCue) - active only when switchOnCue is enabled; whenever value of this input changes, pre-buffered video starts to play; switchCue can be triggered in advance (i.e. while new video is still buffering), in this case, new video will start to play automatically as soon as buffering is over.

Outputs

YouTubeTOP exports it's internal parameters using InfoDAT OPs. To query YouTubeTOP's data, specify a name of the YouTubeTOP's CPlusPlus TOP in the Node Path parameter of InfoDAT.

The following parameters are exported by YouTubeTOP:

  • executeCount - counter of total cooks
  • URL - video URL of the current video being processed
  • isLooping - indicates, whether looping is enabled
  • isPaused - indicates, whether video is paused
  • state - indicates current VLC library status; can have several values (defined by VLC library):
    • Nothing Special
    • Opening
    • Buffering
    • Playing
    • Paused
    • Stopped
    • Ended
    • Error
  • TOPstatus - indicates current YoutubeTOP status; can have several values:
    • Running - video is being played
    • Ready to run - video URL has been opened and ready to be played or video is paused and ready to be resumed
    • None - no video URL provided or an error has occurred
  • Duration - total duration of the video in milliseconds
  • playbackProgress - playback progress on the scale from 0 to 1
  • bufferingProgress - buffering progress on the scale from 0 to 100
  • videoWidth - width of the current video
  • videoHeight height of the current video
  • handover - indicates pre-buffering status of new video; handover means that new video has been requested, but it is not yet ready for a playback due to some reasons (video URL fetching, pre-buffering, etc.); therefore, one could say that new video is being "handed over" to the video player during this process; when the video is ready to be played, this output is equal or greater than 100
  • handoverState - could have several possible values:
    • No handover - no video switching
    • Initiated - new video has been requested but is not ready yet to be played
    • Ready - new video is ready to be played
  • switchOnCue - indicates current state of switchOnCue input
  • switchCue - indicates current value of switchCue input

Implementation

The source code as well as VisualStudio project for YouTubeTOP can be found in msvs folder of the repo.