-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pause player at first frame immediately after video load with optional seek #637
Comments
Just an update , it seems to work even if I reduce the QThread::msleep(500) to QThread::usleep(1) . That's 500 MILLIseconds to 1 MICROsecond, this makes it a better workaround since the time delay is much smaller. |
setPosition/seek is async too. You have to pause when
|
Ok, that seems to work but I noticed a small issue , I have to sleep for a time immediately after the play() call otherwise the "seekFinished" never gets called, I think that the whole signal and slots are still being setup in the player and the setPosition call immediately after play is ignored. I assume it is only safe to make seek calls to the player only after the started signal is emitted ? |
Are you using the latest code? This issue should be fixed, see #616 |
Have not tried the latest code , will do and confirm soon |
Tested and confirmed that seekFinished gets called if a seek immediately follows a play() call , this is only if async load is set to false, i.e. player->setAsyncLoad(false) |
You have to call seek in your slot connected to |
I can add |
I suppose this would help with load speed in the case of loading multiple videos asynchronously then waiting for them to finish before calling seek on them (all within one function). I don't think this is needed though as the started signal is fine for my purposes. I think the 3 main reasons for my confusion was
Maybe a helpful comment and possible future documentation note would be to indicate the above. Thanks a lot for your assistance. |
I think about |
Then #637 can be simplified as player.setStartPosition(5000); ; connect(&player, &AVPlayer::seekFinished, this, &PlayerWindow::pauseOnSeek);
I have tried this solution and it works...
However, "seekFinished" works later. When some time passes and the videowidget appears on the screen, I can pause and play (leaving first frame displayed), but the video restores to normal behaviour only when I seek to some time by hand. |
Hi
I would like to use two or more players to load different video files , seek to a different position within each player and pause it there. The problem I am having is that the renderer is blank on initial load even after the "started" signal is fired so pausing in the started slot still shows a blank renderer, the only way for me to workaround this is to wait for around half a second and then call pause again. It would be great if there was a way to load, seek and then pause at that position using the AVPlayer object without waiting for playback to happen. Below is a snippet of what I am trying to do. I think the problem is that the pause is ignored because the player is still setting up the threads even though asyncLoad is false, maybe queue the pause request while the initial load is happening and then action it once the first frame has been decoded and sent to renderer. Not sure if this is an issue or an enhancement.
The text was updated successfully, but these errors were encountered: