1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

AudioPlayer initial

This commit is contained in:
Fedor Katurov 2019-10-13 17:47:13 +07:00
parent d1e369f723
commit f66825a9ea
12 changed files with 190 additions and 26 deletions

24
src/redux/player/sagas.ts Normal file
View file

@ -0,0 +1,24 @@
import { takeLatest } from 'redux-saga/effects';
import { PLAYER_ACTIONS } from './constants';
import { playerSetFile } from './actions';
import { Player } from '~/utils/player';
import { getURL } from '~/utils/dom';
function setFileSaga({ file }: ReturnType<typeof playerSetFile>) {
Player.set(getURL(file));
Player.play();
}
function playSaga() {
Player.play();
}
function pauseSaga() {
Player.pause();
}
export default function* playerSaga() {
yield takeLatest(PLAYER_ACTIONS.SET_FILE, setFileSaga);
yield takeLatest(PLAYER_ACTIONS.PAUSE, pauseSaga);
yield takeLatest(PLAYER_ACTIONS.PLAY, playSaga);
}