QMediaPlayer::setPosition(qint64 pos) not work in Mac
Just to use
QMediaPlayer::setPositionto set video current position, like below snippet:
I test the below code in Windows, it can get the correct position after set.
qDebug() << "SetPos:" << newpos; _player->setPosition(newpos); qDebug() << "Get Pos Right now:" << _player->position(); ///< putout wrong position, it not equal newpos
But, In Mac, I get wrong position after set.
sometime, i get the position < set position.
sometime, i get the position > set position.
How to get the correct position after set ?
I also found the one who had same problem with me, but no answer.
About my problem, I analysis some different what my progream in windows and mac os.
- the format of video is different. the video format is avi in windows and mp4 in mac. as we all know, different format will need different video decoder.
setPositionmay be is asynchronous. the value of my set may not be take effict immediately. so, if i get the
positionright now, it will return similar to the value. after you set value, it need to used video devoder to working, maybe it will spend some time. and the time is different from different video format and different video decoder;
I test some
setPositionand get the position right now. all the 1000 record data different [-130ms,130ms]. this range is acceptable for me.