I don't use the controller anyway, I have implemented my own slider bar to track and set the position of the video, but it just jumps to the nearest 10 seconds.
How do I implement my own that controls the video to smaller increments?
Sub slideVideo_ValueChanged(Value As Int)
vpAnim.Position = vpAnim.Duration * Value / 100
lblTime.Text = NumberFormat2(vpAnim.Position / 1000, 1, 2, 2, True)
tmrVideo.Enabled = True
End Sub
As you can see the issue isn't with the Value passed to ValueChanged, that is correct.
But when you set vpAnim.Position to this value it jumps to the nearest multiple of 10,000 and sets Position to the nearest 10 seconds (rounding up or down)
The behavior depends on the video source and encoding.
SeekWithNoTolerance:
B4X:
Sub SeekWithNoTolerance (Position As Int)
Dim controller As NativeObject = VideoPlayer1
controller = controller.GetField("controller")
Dim no As NativeObject = Me
no.RunMethod("SeekWithNoTolerance::", Array(controller, Position))
End Sub
#if OBJC
- (void)SeekWithNoTolerance:(AVPlayerViewController*)controller :(int)Position {
int32_t timeScale = controller.player.currentItem.asset.duration.timescale;
CMTime time = CMTimeMakeWithSeconds(Position / 1000.0, timeScale);
[controller.player.currentItem seekToTime:time toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];
}
#End If