position tracking clean up

This commit is contained in:
Travis Eden 2018-07-31 14:06:50 -04:00 committed by Sean Yesmunt
parent 287f1ac656
commit 58ed68d8c3
3 changed files with 7 additions and 5 deletions

View file

@ -29,7 +29,7 @@ const select = (state, props) => ({
playingUri: selectPlayingUri(state),
contentType: makeSelectContentTypeForUri(props.uri)(state),
volume: selectVolume(state),
playbackPosition: makeSelectContentPositionForUri(props.uri)(state),
position: makeSelectContentPositionForUri(props.uri)(state),
autoplay: makeSelectClientSetting(settings.AUTOPLAY)(state),
searchBarFocused: selectSearchBarFocused(state),
fileInfoErrors: selectFileInfoErrors(state),

View file

@ -88,7 +88,9 @@ class MediaPlayer extends React.PureComponent {
document.addEventListener('keydown', this.togglePlayListener);
const mediaElement = this.media.children[0];
if (mediaElement) {
mediaElement.currentTime = position || 0;
if (position) {
mediaElement.currentTime = position;
}
mediaElement.addEventListener('timeupdate', () =>
this.props.savePosition(
claim.claim_id,

View file

@ -35,7 +35,7 @@ type Props = {
claim: Claim,
uri: string,
savePosition: (string, string, number) => void,
playbackPosition: ?number,
position: ?number,
className: ?string,
obscureNsfw: boolean,
play: string => void,
@ -200,7 +200,7 @@ class FileViewer extends React.PureComponent<Props> {
claim,
uri,
savePosition,
playbackPosition,
position,
className,
obscureNsfw,
mediaType,
@ -249,7 +249,7 @@ class FileViewer extends React.PureComponent<Props> {
savePosition={savePosition}
claim={claim}
uri={uri}
position={playbackPosition}
position={position}
playingUri={playingUri}
/>
)}