Reputation: 8279
THE SCENARIO I am working on an application that uses RTPlayer to play prerecorded Video and Audio from our server.
THE SUSPECTS RTPlayer has 2 useful properties; .initialPlaybackTime
and .currentPosition
for calculating media time position in seconds. .initialPlaybackTime
sets where in the media the player should start playing from, and .currentPosition
tells you where you left off to resume at the same position in the media.
THE ISSUE The .initialPlaybackTime
property is of int64_t
type, and .currentPosition
is of type float
. When I "plug" the .currentPosition
value into .initialPlaybackTime
there is always about 8-10 seconds ADDED to the player's position.
QUESTION How can I convert the .currentPosition
float
value to a int64_t
and keep the same value?
Upvotes: 1
Views: 329
Reputation: 4678
The "8-10 seconds being added to the player's position" may have something to do with the underlying HTTP Live Streaming (HLS) technology.
If the media you are playing is streamed it is likely that it conforms to this technology and, if so, will be split into several smaller chunks of media (my experience is this is usually about 15 seconds in length for video) at a variety of bitrates.
In that case, unless the initialPlaybackTime
is set to a value that coincides with the start time of one of those media segments, it is possible the player is just using the nearest media segment and jumping to the beginning of that segment (a common practice) or to the next segment if it is near the end of the current segment to reduce loading a full segment's worth of media data without playing it.
Upvotes: 1