make sure player callback has access to latest desktop start time
This commit is contained in:
parent
ab70f1c758
commit
ff429117cd
2 changed files with 8 additions and 1 deletions
|
@ -78,6 +78,12 @@ export default function FileRenderFloating(props: Props) {
|
|||
// @if TARGET='app'
|
||||
setDesktopPlayStartTime(Date.now());
|
||||
// @endif
|
||||
|
||||
return () => {
|
||||
// @if TARGET='app'
|
||||
setDesktopPlayStartTime(undefined);
|
||||
// @endif
|
||||
};
|
||||
}, [uri]);
|
||||
|
||||
if (!isPlayable || !uri || (isFloating && (isMobile || !floatingPlayerEnabled))) {
|
||||
|
|
|
@ -88,6 +88,7 @@ function VideoViewer(props: Props) {
|
|||
|
||||
function doTrackingFirstPlay(e: Event, data: any) {
|
||||
let timeToStartInMs = data.secondsToLoad * 1000;
|
||||
|
||||
if (desktopPlayStartTime !== undefined) {
|
||||
const differenceToAdd = Date.now() - desktopPlayStartTime;
|
||||
timeToStartInMs += differenceToAdd;
|
||||
|
@ -166,7 +167,7 @@ function VideoViewer(props: Props) {
|
|||
}
|
||||
player.on('dispose', () => savePosition(uri, player.currentTime()));
|
||||
},
|
||||
[uri]
|
||||
IS_WEB ? [uri] : [uri, desktopPlayStartTime]
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue