From 0f60b011551df7832306d5861e6df3bdce2b5901 Mon Sep 17 00:00:00 2001 From: Derek Yesmunt Date: Tue, 29 Jan 2019 23:15:01 -0500 Subject: [PATCH 1/2] fix: reset time to zero on file end --- src/renderer/component/fileViewer/internal/player.jsx | 10 +++------- src/renderer/component/fileViewer/view.jsx | 5 ++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/renderer/component/fileViewer/internal/player.jsx b/src/renderer/component/fileViewer/internal/player.jsx index 6d3f37054..44407ae24 100644 --- a/src/renderer/component/fileViewer/internal/player.jsx +++ b/src/renderer/component/fileViewer/internal/player.jsx @@ -48,6 +48,7 @@ class MediaPlayer extends React.PureComponent { claim, onStartCb, onFinishCb, + savePosition, } = this.props; const loadedMetadata = () => { @@ -95,13 +96,7 @@ class MediaPlayer extends React.PureComponent { if (position) { mediaElement.currentTime = position; } - mediaElement.addEventListener('timeupdate', () => - this.props.savePosition( - claim.claim_id, - `${claim.txid}:${claim.nout}`, - mediaElement.currentTime - ) - ); + mediaElement.addEventListener('timeupdate', () => savePosition(mediaElement.currentTime)); mediaElement.addEventListener('click', this.togglePlayListener); mediaElement.addEventListener('loadedmetadata', loadedMetadata.bind(this), { once: true, @@ -110,6 +105,7 @@ class MediaPlayer extends React.PureComponent { if (onFinishCb) { onFinishCb(); } + savePosition(0); }); mediaElement.addEventListener('webkitfullscreenchange', win32FullScreenChange.bind(this)); mediaElement.addEventListener('volumechange', () => { diff --git a/src/renderer/component/fileViewer/view.jsx b/src/renderer/component/fileViewer/view.jsx index da15be1f5..fd916704b 100644 --- a/src/renderer/component/fileViewer/view.jsx +++ b/src/renderer/component/fileViewer/view.jsx @@ -18,6 +18,7 @@ type Props = { written_bytes: number, download_path: string, completed: boolean, + blobs_completed: number, }, fileInfoErrors: ?{ [string]: boolean, @@ -259,7 +260,9 @@ class FileViewer extends React.PureComponent { downloadCompleted={fileInfo.completed} changeVolume={changeVolume} volume={volume} - savePosition={savePosition} + savePosition={newPosition => + savePosition(claim.claim_id, `${claim.txid}:${claim.nout}`, newPosition) + } claim={claim} uri={uri} position={position} From a930c2fe84b0634f61325ff1e318c83cbedb122f Mon Sep 17 00:00:00 2001 From: Derek Yesmunt Date: Tue, 29 Jan 2019 23:26:01 -0500 Subject: [PATCH 2/2] chore: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a47b108b..a1b8df229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Flow errors ([#2213](https://github.com/lbryio/lbry-desktop/pull/2213)) +- Video position on previously viewed files ([#2240](https://github.com/lbryio/lbry-desktop/pull/2240)) ## [0.27.1] - 2018-01-22