How to use VideoPlayer to play video on application window?

Forum for discussion on different user applications
Post Reply
kunjiang
Posts: 1
Joined: 22 Apr 2021, 10:43

How to use VideoPlayer to play video on application window?

Post by kunjiang » 22 Apr 2021, 11:06

Hello, I'm a new student on BCI2000. I try to use VideoPlayer class to play a video on application window and successfully open video, but failed while playing video. The video duration is 1.05s. I create a new application module and add a piece of code,as follows:
void VideoDemoTask::StartRun()
{
VideoPlayer videoPlayer(mrDisplay);
videoPlayer.Open("D://project//video//M1//left.avi");
if (videoPlayer.IsOpen()) {
bciout << "open "<< endl;
}
int c = videoPlayer.FrameCount();
bciout << c << endl;
videoPlayer.SetFramePosition(0);
videoPlayer.Play();
if (videoPlayer.IsPlaying()) {
bciout << "PLAY " << endl;
}
}
In addition, I want to return a message as soon as the video is over. How do i do it?

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

Re: How to use VideoPlayer to play video on application window?

Post by mellinger » 04 May 2021, 08:57

Hi,

your VideoPlayer object is destroyed when execution leaves the StartRun() function. You need to create it on the heap (with "new").

Hope this helps,
Juergen

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests