QMediaPlayer::setPosition(qint64 pos) not work in Mac



  • Just to use QMediaPlayer::setPosition to 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.

    and another topic same problem
    and stackoverflow



  • About my problem, I analysis some different what my progream in windows and mac os.

    1. 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.
    2. setPosition may be is asynchronous. the value of my set may not be take effict immediately. so, if i get the position right 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 setPosition and get the position right now. all the 1000 record data different [-130ms,130ms]. this range is acceptable for me.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.