CursorTask - VideoPlayer

Forum for software developers to discuss BCI2000 software development
elenamon
Posts: 12
Joined: 09 Jun 2025, 09:04

Re: CursorTask - VideoPlayer

Post by elenamon » 12 Jun 2025, 04:26

Thank you for the information. I've updated the SVN inside the src folder, I have configured again BCI2000 with CMake and compiled again my application module. Now, no errors appear and the video is correctly played!
Thanks a million for your help

I've only one more question: it it possible to have more than one application window within the same application module?
Thank you

mellinger
Posts: 1341
Joined: 12 Feb 2003, 11:06

Re: CursorTask - VideoPlayer

Post by mellinger » 12 Jun 2025, 07:34

Great that it works for you now. And thanks for reporting the issue!

And yes, you can have any number of windows in the application module. By default, they all have the same coordinates, so make sure to adjust them under Config->Application-><WindowName>WindowCoordinates.

Here is a code example how to use multiple windows:
MyTask.h:

Code: Select all

 ...
    ApplicationWindow &mrWindow, &mrWindow2;
    class VideoPlayer* mpVideoPlayer, *mpVideoPlayer2;
 ...
MyTask.cpp:

Code: Select all

MyTask::MyTask()
: mrWindow(Window()), mrWindow2(Window("Second")),
  mpVideoPlayer(nullptr), mpVideoPlayer2(nullptr)
{
    mpVideoPlayer = new VideoPlayer(mrWindow);
    mpVideoPlayer2 = new VideoPlayer(mrWindow2);
}

void MyTask::OnInitialize(const SignalProperties & /*Input*/)
{
    mrWindow.Show();
    GUI::Rect rect{ 0.5, 0.7, 0.8, 0.5 };
    mpVideoPlayer->SetObjectRect(rect);
    mpVideoPlayer->SetFile("video/Test_NTSC.mp4");
    if (!mpVideoPlayer->IsOpen())
        bcierr << mpVideoPlayer->Error();
    mpVideoPlayer->SetScalingMode(GUI::ScalingMode::AdjustHeight);
    mpVideoPlayer->Show();
    mpVideoPlayer->Play();

    mrWindow2.Show();
    mpVideoPlayer2->SetScalingMode(GUI::ScalingMode::AdjustHeight);
    GUI::Rect rect2{ 0, 0.5, 1, 0.5 };
    mpVideoPlayer2->SetObjectRect(rect2);
    mpVideoPlayer2->SetFile("video/Test_PAL_HD.mp4");
    if (!mpVideoPlayer2->IsOpen())
        bcierr << mpVideoPlayer2->Error();
    mpVideoPlayer2->Show();
    mpVideoPlayer2->Play();
}

elenamon
Posts: 12
Joined: 09 Jun 2025, 09:04

Re: CursorTask - VideoPlayer

Post by elenamon » 12 Jun 2025, 09:29

Thank you for the information and for the code! It is very helpful.
Thank you again to have solved my issues!

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests