cancel play on navigate away

This commit is contained in:
Jeremy Kauffman 2017-09-17 22:13:05 -04:00
parent e741d5ee27
commit 2dfd071e16
2 changed files with 6 additions and 1 deletions

View file

@ -2,7 +2,7 @@ import React from "react";
import { connect } from "react-redux";
import { doChangeVolume } from "actions/app";
import { selectVolume } from "selectors/app";
import { doPlayUri } from "actions/content";
import { doPlayUri, doSetPlayingUri } from "actions/content";
import {
makeSelectMetadataForUri,
makeSelectContentTypeForUri,
@ -31,6 +31,7 @@ const select = (state, props) => ({
const perform = dispatch => ({
play: uri => dispatch(doPlayUri(uri)),
cancelPlay: () => dispatch(doSetPlayingUri(null)),
changeVolume: volume => dispatch(doChangeVolume(volume)),
});

View file

@ -13,6 +13,10 @@ class Video extends React.PureComponent {
};
}
componentWillUnmount() {
this.props.cancelPlay();
}
isMediaSame(nextProps) {
return (
this.props.fileInfo &&