Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.14.0
-
None
-
macOS 10.15
-
-
545d4aedc2af40182cd9141d014a02f919592cd9 (qt/qtmultimedia/5.14)
Description
1. Description
macOS 10.15 QMediaPlayer setPosition() has 10 second granularity. The millisecond value is rounded to nearest 10000ms. Example:
setPosition(1000) -> position set to 0s
setPosition(2000) -> position set to 0s
setPosition(8000) -> position set to 10s
This makes setPosition() unusable for many applications.
2. Possible root causes
See line 687-689 of qtmultimedia/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm from code.woboq.org:
687 CMTime newTime = [playerItem currentTime];
688 newTime.value = (pos / 1000.0f) * newTime.timescale;
689 [playerItem seekToTime:newTime];
On 689, there is a call to a now-deprecated variant of AVPlayerItem seekToTime method. This might be causing the problem.
Also, there might be a numerical issue on line 688 (should this be done in double precision?).
3. Proposed fix
I think it should suffice to replace the existing call to seekToTime with the following (non-deprecated) variant:
seekToTime:toleranceBefore:toleranceAfter:completionHandler:
toleranceBefore and toleranceAfter should be set to kCMTimeZero to request sample accurate seeking.
Attachments
Issue Links
- is duplicated by
-
QTBUG-83310 Problem seeking in Media Player QML on iOS and MacOS
- Closed
-
QTBUG-49609 Impossible to seek frame by frame position with AVFoundation plugin for IOS
- Closed