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'
|
// @if TARGET='app'
|
||||||
setDesktopPlayStartTime(Date.now());
|
setDesktopPlayStartTime(Date.now());
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
// @if TARGET='app'
|
||||||
|
setDesktopPlayStartTime(undefined);
|
||||||
|
// @endif
|
||||||
|
};
|
||||||
}, [uri]);
|
}, [uri]);
|
||||||
|
|
||||||
if (!isPlayable || !uri || (isFloating && (isMobile || !floatingPlayerEnabled))) {
|
if (!isPlayable || !uri || (isFloating && (isMobile || !floatingPlayerEnabled))) {
|
||||||
|
|
|
@ -88,6 +88,7 @@ function VideoViewer(props: Props) {
|
||||||
|
|
||||||
function doTrackingFirstPlay(e: Event, data: any) {
|
function doTrackingFirstPlay(e: Event, data: any) {
|
||||||
let timeToStartInMs = data.secondsToLoad * 1000;
|
let timeToStartInMs = data.secondsToLoad * 1000;
|
||||||
|
|
||||||
if (desktopPlayStartTime !== undefined) {
|
if (desktopPlayStartTime !== undefined) {
|
||||||
const differenceToAdd = Date.now() - desktopPlayStartTime;
|
const differenceToAdd = Date.now() - desktopPlayStartTime;
|
||||||
timeToStartInMs += differenceToAdd;
|
timeToStartInMs += differenceToAdd;
|
||||||
|
@ -166,7 +167,7 @@ function VideoViewer(props: Props) {
|
||||||
}
|
}
|
||||||
player.on('dispose', () => savePosition(uri, player.currentTime()));
|
player.on('dispose', () => savePosition(uri, player.currentTime()));
|
||||||
},
|
},
|
||||||
[uri]
|
IS_WEB ? [uri] : [uri, desktopPlayStartTime]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue