2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doChangeVolume } from 'redux/actions/app';
|
|
|
|
import { selectVolume } from 'redux/selectors/app';
|
|
|
|
import { doPlayUri, doSetPlayingUri } from 'redux/actions/content';
|
2018-01-08 04:51:34 +01:00
|
|
|
import { doPlay, doPause, savePosition } from 'redux/actions/media';
|
2017-05-15 05:50:59 +02:00
|
|
|
import {
|
2018-04-18 06:03:01 +02:00
|
|
|
makeSelectMetadataForUri,
|
|
|
|
makeSelectContentTypeForUri,
|
|
|
|
makeSelectCostInfoForUri,
|
|
|
|
makeSelectClaimForUri,
|
2017-05-15 05:50:59 +02:00
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectLoadingForUri,
|
|
|
|
makeSelectDownloadingForUri,
|
2018-04-18 06:03:01 +02:00
|
|
|
} from 'lbry-redux';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
2018-01-08 04:51:34 +01:00
|
|
|
import { selectMediaPaused, makeSelectMediaPositionForUri } from 'redux/selectors/media';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { selectPlayingUri } from 'redux/selectors/content';
|
2018-04-18 06:03:01 +02:00
|
|
|
import Video from './view';
|
2017-05-15 05:50:59 +02:00
|
|
|
|
2017-09-08 05:15:05 +02:00
|
|
|
const select = (state, props) => ({
|
2017-12-29 17:07:03 +01:00
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
|
|
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
|
|
|
obscureNsfw: !selectShowNsfw(state),
|
|
|
|
isLoading: makeSelectLoadingForUri(props.uri)(state),
|
|
|
|
isDownloading: makeSelectDownloadingForUri(props.uri)(state),
|
2017-09-18 04:08:43 +02:00
|
|
|
playingUri: selectPlayingUri(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
|
|
|
volume: selectVolume(state),
|
2017-12-21 00:38:11 +01:00
|
|
|
mediaPaused: selectMediaPaused(state),
|
|
|
|
mediaPosition: makeSelectMediaPositionForUri(props.uri)(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
});
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2017-09-18 04:08:43 +02:00
|
|
|
play: uri => dispatch(doPlayUri(uri)),
|
2017-09-18 04:13:05 +02:00
|
|
|
cancelPlay: () => dispatch(doSetPlayingUri(null)),
|
2017-08-25 21:05:00 +02:00
|
|
|
changeVolume: volume => dispatch(doChangeVolume(volume)),
|
2017-12-21 00:38:11 +01:00
|
|
|
doPlay: () => dispatch(doPlay()),
|
2017-12-23 00:14:54 +01:00
|
|
|
doPause: () => dispatch(doPause()),
|
2018-01-08 04:51:34 +01:00
|
|
|
savePosition: (claimId, position) => dispatch(savePosition(claimId, position)),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-09-08 05:15:05 +02:00
|
|
|
export default connect(select, perform)(Video);
|