mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
player seeking
This commit is contained in:
parent
69ff9a7652
commit
f445882a61
7 changed files with 48 additions and 12 deletions
|
@ -18,3 +18,8 @@ export const playerPlay = () => ({
|
|||
export const playerPause = () => ({
|
||||
type: PLAYER_ACTIONS.PAUSE,
|
||||
});
|
||||
|
||||
export const playerSeek = (seek: number) => ({
|
||||
type: PLAYER_ACTIONS.SEEK,
|
||||
seek,
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@ export const PLAYER_ACTIONS = {
|
|||
|
||||
PLAY: `${prefix}PLAY`,
|
||||
PAUSE: `${prefix}PAUSE`,
|
||||
SEEK: `${prefix}SEEK`,
|
||||
};
|
||||
|
||||
export const PLAYER_STATES = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { takeLatest } from 'redux-saga/effects';
|
||||
import { PLAYER_ACTIONS } from './constants';
|
||||
import { playerSetFile } from './actions';
|
||||
import { playerSetFile, playerSeek } from './actions';
|
||||
import { Player } from '~/utils/player';
|
||||
import { getURL } from '~/utils/dom';
|
||||
|
||||
|
@ -17,8 +17,14 @@ function pauseSaga() {
|
|||
Player.pause();
|
||||
}
|
||||
|
||||
function seekSaga({ seek }: ReturnType<typeof playerSeek>) {
|
||||
Player.jumpToPercent(seek * 100);
|
||||
console.log(seek * 100);
|
||||
}
|
||||
|
||||
export default function* playerSaga() {
|
||||
yield takeLatest(PLAYER_ACTIONS.SET_FILE, setFileSaga);
|
||||
yield takeLatest(PLAYER_ACTIONS.PAUSE, pauseSaga);
|
||||
yield takeLatest(PLAYER_ACTIONS.PLAY, playSaga);
|
||||
yield takeLatest(PLAYER_ACTIONS.SEEK, seekSaga);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue