2017-06-06 23:19:12 +02:00
|
|
|
import React from "react";
|
|
|
|
import { connect } from "react-redux";
|
2017-08-30 14:48:32 +02:00
|
|
|
import { doChangeVolume } from "actions/app";
|
2017-09-18 04:08:43 +02:00
|
|
|
import { selectVolume } from "selectors/app";
|
2017-09-18 04:13:05 +02:00
|
|
|
import { doPlayUri, doSetPlayingUri } from "actions/content";
|
2017-04-23 11:56:50 +02:00
|
|
|
import {
|
2017-05-31 19:36:38 +02:00
|
|
|
makeSelectMetadataForUri,
|
|
|
|
makeSelectContentTypeForUri,
|
2017-06-06 23:19:12 +02:00
|
|
|
} from "selectors/claims";
|
2017-05-15 05:50:59 +02:00
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectLoadingForUri,
|
|
|
|
makeSelectDownloadingForUri,
|
2017-06-06 23:19:12 +02:00
|
|
|
} from "selectors/file_info";
|
|
|
|
import { makeSelectCostInfoForUri } from "selectors/cost_info";
|
2017-06-28 09:12:01 +02:00
|
|
|
import { selectShowNsfw } from "selectors/settings";
|
2017-06-06 23:19:12 +02:00
|
|
|
import Video from "./view";
|
2017-09-18 04:08:43 +02:00
|
|
|
import { selectPlayingUri } from "selectors/content";
|
2017-05-15 05:50:59 +02:00
|
|
|
|
2017-09-08 05:15:05 +02: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-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-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-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);
|