Capture at Playhead

Capture a thumbnail at the current player position

This sample shows the IVideoPlayer interface together with IVideoIndexer.CaptureSingleFrame: read the current playback position and capture that exact frame as a new thumbnail for the video. It also shows IGUI.IsWindowOpened to check that the player window is open before using it.

Bind the script to a hotkey to bookmark frames while watching.

using System;
using VideoCataloger;

class Script
{
    static public async System.Threading.Tasks.Task Run(IScripting scripting, string arguments)
    {
        IConsole console = scripting.GetConsole();
        IGUI gui = scripting.GetGUI();
        console.Clear();

        if (!gui.IsWindowOpened("Player"))
        {
            console.WriteLine("The video player window is not open.");
            return;
        }

        IVideoPlayer player = scripting.GetVideoPlayer();
        long video_id = player.GetSelectedVideoID();
        if (video_id <= 0)
        {
            console.WriteLine("No video selected in the video player.");
            return;
        }

        // Pause so the user sees exactly which frame is captured.
        player.PauseNoToggleMovie();
        double position = player.GetPlayPosition();

        scripting.GetVideoIndexer().CaptureSingleFrame(video_id, position);
        console.WriteLine("Capturing frame at " + TimeSpan.FromSeconds(position).ToString(@"hh\:mm\:ss") + ".");
    }
}