lbry-desktop/src/renderer/redux/actions/media.js

31 lines
797 B
JavaScript
Raw Normal View History

2017-12-21 00:38:11 +01:00
// @flow
2018-01-08 04:51:34 +01:00
import * as actions from 'constants/action_types';
import type { Action, Dispatch } from 'redux/reducers/media';
import lbry from 'lbry';
import { makeSelectClaimForUri } from 'redux/selectors/claims';
2017-12-21 00:38:11 +01:00
export const doPlay = () => (dispatch: Dispatch) =>
dispatch({
type: actions.MEDIA_PLAY,
});
export const doPause = () => (dispatch: Dispatch) =>
dispatch({
type: actions.MEDIA_PAUSE,
});
2017-12-21 00:38:11 +01:00
export function savePosition(claimId: String, position: Number) {
2018-01-05 20:27:58 +01:00
return function(dispatch: Dispatch, getState: Function) {
const state = getState();
const claim = state.claims.byId[claimId];
const outpoint = `${claim.txid}:${claim.nout}`;
dispatch({
type: actions.MEDIA_POSITION,
data: {
outpoint,
position,
},
});
};
}