YouTube Android API seekToMillis() not working accurately -
while using youtubeplayer.seektomillis()
function, there seek delay of 2 seconds. not 2 seconds, so. if try seek between 10,000 milliseconds , 12,000 milliseconds (eg: 11,000 11,500, 11,550). video started 10,000 itself. if give value between 12,000 , 14,000 goes 12,000 point.. , on...
we developing app youtube has start accurate time specified. hence function quite crucial us.
youtubeplayer.seektomillis(10000); youtubeplayer.play();
please show hints how can start video youtube player precise starting time, if possible precisely millisecond.
this not bug, this standard behavior of seekable-compressed video file.
short , super-simplified explanation
a compressed video file composed sequence of frames. there 2 macro-types of frame, full frames (f) , partial frames (p*):- full frame: contains full real frame @ specific time (like full jpeg image)
- partial frame set of differences in relation previous frame, expressed motion vectors.
raw video sequence:
f f f f f f f f f f f f f f f f f f ... (eof)
compressed video sequence:
f p p p p f p p p p f p p p p p f p p ... (eof)
a compressed structure allows create smaller file (because partial frames smaller full frames), introduces silly problem: it not possible start playback directly partial frame because, in order decode correctly, need ascend until first full frame!
this problem experiencing: seeking specific time mapped on partial frame, need go nearest full frame , start playback there.
in streming context youtube problem more difficult because header trick limitation using, example, fast forward approach.
as written above, simplified explanation. can find more information here.
Comments
Post a Comment