parent
8f2e2197f6
commit
c1f74aba2e
3 changed files with 6 additions and 2 deletions
|
@ -3,6 +3,7 @@ import { makeSelectClaimForUri, makeSelectFileInfoForUri, makeSelectThumbnailFor
|
||||||
import { doChangeVolume, doChangeMute, doAnalyticsView } from 'redux/actions/app';
|
import { doChangeVolume, doChangeMute, doAnalyticsView } from 'redux/actions/app';
|
||||||
import { selectVolume, selectMute } from 'redux/selectors/app';
|
import { selectVolume, selectMute } from 'redux/selectors/app';
|
||||||
import { savePosition } from 'redux/actions/content';
|
import { savePosition } from 'redux/actions/content';
|
||||||
|
import { makeSelectContentPositionForUri } from 'redux/selectors/content';
|
||||||
import VideoViewer from './view';
|
import VideoViewer from './view';
|
||||||
import { withRouter } from 'react-router';
|
import { withRouter } from 'react-router';
|
||||||
import { doClaimEligiblePurchaseRewards } from 'lbryinc';
|
import { doClaimEligiblePurchaseRewards } from 'lbryinc';
|
||||||
|
@ -13,7 +14,7 @@ const select = (state, props) => {
|
||||||
const { search } = props.location;
|
const { search } = props.location;
|
||||||
const urlParams = new URLSearchParams(search);
|
const urlParams = new URLSearchParams(search);
|
||||||
const autoplay = urlParams.get('autoplay');
|
const autoplay = urlParams.get('autoplay');
|
||||||
const position = urlParams.get('t');
|
const position = urlParams.get('t') !== null ? urlParams.get('t') : makeSelectContentPositionForUri(props.uri)(state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
autoplayIfEmbedded: Boolean(autoplay),
|
autoplayIfEmbedded: Boolean(autoplay),
|
||||||
|
|
|
@ -15,7 +15,7 @@ export type Player = {
|
||||||
volume: (?number) => number,
|
volume: (?number) => number,
|
||||||
muted: (?boolean) => boolean,
|
muted: (?boolean) => boolean,
|
||||||
dispose: () => void,
|
dispose: () => void,
|
||||||
currentTime: number => void,
|
currentTime: (?number) => number,
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
|
@ -31,6 +31,7 @@ type Props = {
|
||||||
autoplayIfEmbedded: boolean,
|
autoplayIfEmbedded: boolean,
|
||||||
doAnalyticsView: (string, number) => Promise<any>,
|
doAnalyticsView: (string, number) => Promise<any>,
|
||||||
claimRewards: () => void,
|
claimRewards: () => void,
|
||||||
|
savePosition: (string, number) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,6 +55,7 @@ function VideoViewer(props: Props) {
|
||||||
autoplayIfEmbedded,
|
autoplayIfEmbedded,
|
||||||
doAnalyticsView,
|
doAnalyticsView,
|
||||||
claimRewards,
|
claimRewards,
|
||||||
|
savePosition,
|
||||||
} = props;
|
} = props;
|
||||||
const claimId = claim && claim.claim_id;
|
const claimId = claim && claim.claim_id;
|
||||||
const isAudio = contentType.includes('audio');
|
const isAudio = contentType.includes('audio');
|
||||||
|
@ -155,6 +157,7 @@ function VideoViewer(props: Props) {
|
||||||
if (position) {
|
if (position) {
|
||||||
player.currentTime(position);
|
player.currentTime(position);
|
||||||
}
|
}
|
||||||
|
player.on('timeupdate', () => savePosition(uri, player.currentTime()));
|
||||||
},
|
},
|
||||||
[uri]
|
[uri]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue