2017-06-06 17:19:12 -04:00
|
|
|
import React from "react";
|
|
|
|
import { connect } from "react-redux";
|
2017-08-30 08:48:32 -04:00
|
|
|
import { doChangeVolume } from "actions/app";
|
2017-09-17 22:08:43 -04:00
|
|
|
import { selectVolume } from "selectors/app";
|
2017-09-17 22:13:05 -04:00
|
|
|
import { doPlayUri, doSetPlayingUri } from "actions/content";
|
2017-04-23 16:56:50 +07:00
|
|
|
import {
|
2017-05-31 21:36:38 +04:00
|
|
|
makeSelectMetadataForUri,
|
|
|
|
makeSelectContentTypeForUri,
|
2017-06-06 17:19:12 -04:00
|
|
|
} from "selectors/claims";
|
2017-05-14 23:50:59 -04:00
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectLoadingForUri,
|
|
|
|
makeSelectDownloadingForUri,
|
2017-06-06 17:19:12 -04:00
|
|
|
} from "selectors/file_info";
|
|
|
|
import { makeSelectCostInfoForUri } from "selectors/cost_info";
|
2017-06-28 14:12:01 +07:00
|
|
|
import { selectShowNsfw } from "selectors/settings";
|
2017-06-06 17:19:12 -04:00
|
|
|
import Video from "./view";
|
2017-09-17 22:08:43 -04:00
|
|
|
import { selectPlayingUri } from "selectors/content";
|
2017-05-14 23:50:59 -04:00
|
|
|
|
2017-09-07 23:15:05 -04:00
|
|
|
const select = (state, props) => ({
|
|
|
|
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-17 22:08:43 -04:00
|
|
|
playingUri: selectPlayingUri(state),
|
2017-09-07 23:15:05 -04:00
|
|
|
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
|
|
|
volume: selectVolume(state),
|
|
|
|
});
|
2017-04-23 16:56:50 +07:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
const perform = dispatch => ({
|
2017-09-17 22:08:43 -04:00
|
|
|
play: uri => dispatch(doPlayUri(uri)),
|
2017-09-17 22:13:05 -04:00
|
|
|
cancelPlay: () => dispatch(doSetPlayingUri(null)),
|
2017-08-25 20:05:00 +01:00
|
|
|
changeVolume: volume => dispatch(doChangeVolume(volume)),
|
2017-06-05 21:21:55 -07:00
|
|
|
});
|
2017-04-23 16:56:50 +07:00
|
|
|
|
2017-09-07 23:15:05 -04:00
|
|
|
export default connect(select, perform)(Video);
|