I'm developing a function that I click next button then the pause video will seekto next part and start.For example when video.getCurrentPosition is 8000, I click button to make video seekto(10000),because the video show same content between 8000 and 10000.
This function on some android devices runs smoothly,such as Samsung s6 edge,OnePlus,Xiaomi,Smartison
...
But the issue is that on some devices,such as Huawei,Moto Nexus 6,
when video on 8000 and I click the button,it has some "delay time
".It looks like about 1sec. later,the video finally starts.
By contrast,I specially change the seekto(10200),which is wrong parameter,and these "problem devices" runs smoothly likes "normal devices".However,the video on previous "normal devices
" skip some frame and start at 10200.
Is anyone know why cause this issue?Hope your answer,thank you.
Was the video encoded using
h264
? Re-encoding as using thempeg4
codec, as suggested in a comment to this SO question, has resolved for me a problem of very oddseekTo
behaviour by an AndroidViewView
.To check the encoding, and to re-encode, you might be able to use
ffmpeg
.$ ffprobe <inputfile> ... ... Stream #0:0(eng): Video: h264 ... ...
That showed the the file is encoded usingh264
, which is more recent and generally produces better quality for the same bitrate asmpeg4
, but is (presumably as a consequence) harder to seek through, at least for the AndroidVideoView
.To encode as
mpeg4
the following worked for me, but theffmpeg
wiki has more detail.$ ffmpeg -i <inputfile> -c:v libxvid <outputfile>