don't record file twice if user clicked 'download' before 'play'
This commit is contained in:
parent
8eb07634cb
commit
99afa88a36
2 changed files with 7 additions and 1 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue