don't record file twice if user clicked 'download' before 'play'

This commit is contained in:
seanyesmunt 2018-08-22 15:54:52 -04:00
parent 8eb07634cb
commit 99afa88a36
2 changed files with 7 additions and 1 deletions

View file

@ -46,6 +46,7 @@ class MediaPlayer extends React.PureComponent {
const loadedMetadata = () => { const loadedMetadata = () => {
this.setState({ hasMetadata: true, startedPlaying: true }); this.setState({ hasMetadata: true, startedPlaying: true });
if (startedPlayingCb) { if (startedPlayingCb) {
startedPlayingCb(); startedPlayingCb();
} }

View file

@ -146,7 +146,12 @@ class FileViewer extends React.PureComponent<Props> {
} }
playContent() { playContent() {
const { play, uri } = this.props; const { play, uri, fileInfo, isDownloading, isLoading } = this.props;
if (fileInfo || isDownloading || isLoading) {
// User may have pressed download before clicking play
this.startedPlayingCb = null;
}
if (this.startedPlayingCb) { if (this.startedPlayingCb) {
this.startTime = Date.now(); this.startTime = Date.now();