Make 'playback rate' persistent
## Issue 5308: Ability to choose default play speed and theatre mode or regular playback size ## Comments Initially, I used the local storage, as per 'muted' and 'volume' -- I thought that would be appropriate. Later, I saw that Theater Mode is already using Client Settings, so I re-did everything to match that. Also, there is an accompanying commit in lbyr-redux.
This commit is contained in:
parent
46102c0b3a
commit
95b4f89e50
4 changed files with 15 additions and 2 deletions
|
@ -1553,5 +1553,6 @@
|
||||||
"Consolidate Now": "Consolidate Now",
|
"Consolidate Now": "Consolidate Now",
|
||||||
"Your wallet has a lot of change lying around. Consolidating will speed up your transactions. This could take some time. %now%%help%": "Your wallet has a lot of change lying around. Consolidating will speed up your transactions. This could take some time. %now%%help%",
|
"Your wallet has a lot of change lying around. Consolidating will speed up your transactions. This could take some time. %now%%help%": "Your wallet has a lot of change lying around. Consolidating will speed up your transactions. This could take some time. %now%%help%",
|
||||||
"Consolidating": "Consolidating",
|
"Consolidating": "Consolidating",
|
||||||
|
"Theater mode": "Theater mode",
|
||||||
"--end--": "--end--"
|
"--end--": "--end--"
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import VideoViewer from './view';
|
||||||
import { withRouter } from 'react-router';
|
import { withRouter } from 'react-router';
|
||||||
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import { toggleVideoTheaterMode } from 'redux/actions/settings';
|
import { toggleVideoTheaterMode, doSetClientSetting } from 'redux/actions/settings';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
const { search } = props.location;
|
const { search } = props.location;
|
||||||
|
@ -21,6 +21,7 @@ const select = (state, props) => {
|
||||||
autoplaySetting: Boolean(makeSelectClientSetting(SETTINGS.AUTOPLAY)(state)),
|
autoplaySetting: Boolean(makeSelectClientSetting(SETTINGS.AUTOPLAY)(state)),
|
||||||
volume: selectVolume(state),
|
volume: selectVolume(state),
|
||||||
muted: selectMute(state),
|
muted: selectMute(state),
|
||||||
|
videoPlaybackRate: makeSelectClientSetting(SETTINGS.VIDEO_PLAYBACK_RATE)(state),
|
||||||
position: position,
|
position: position,
|
||||||
hasFileInfo: Boolean(makeSelectFileInfoForUri(props.uri)(state)),
|
hasFileInfo: Boolean(makeSelectFileInfoForUri(props.uri)(state)),
|
||||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||||
|
@ -37,6 +38,7 @@ const perform = dispatch => ({
|
||||||
doAnalyticsBuffer: (uri, bufferData) => dispatch(doAnalyticsBuffer(uri, bufferData)),
|
doAnalyticsBuffer: (uri, bufferData) => dispatch(doAnalyticsBuffer(uri, bufferData)),
|
||||||
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
||||||
toggleVideoTheaterMode: () => dispatch(toggleVideoTheaterMode()),
|
toggleVideoTheaterMode: () => dispatch(toggleVideoTheaterMode()),
|
||||||
|
setVideoPlaybackRate: rate => dispatch(doSetClientSetting(SETTINGS.VIDEO_PLAYBACK_RATE, rate)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default withRouter(connect(select, perform)(VideoViewer));
|
export default withRouter(connect(select, perform)(VideoViewer));
|
||||||
|
|
|
@ -25,6 +25,7 @@ type Props = {
|
||||||
thumbnail: string,
|
thumbnail: string,
|
||||||
claim: StreamClaim,
|
claim: StreamClaim,
|
||||||
muted: boolean,
|
muted: boolean,
|
||||||
|
videoPlaybackRate: number,
|
||||||
volume: number,
|
volume: number,
|
||||||
uri: string,
|
uri: string,
|
||||||
autoplaySetting: boolean,
|
autoplaySetting: boolean,
|
||||||
|
@ -36,6 +37,7 @@ type Props = {
|
||||||
savePosition: (string, number) => void,
|
savePosition: (string, number) => void,
|
||||||
clearPosition: string => void,
|
clearPosition: string => void,
|
||||||
toggleVideoTheaterMode: () => void,
|
toggleVideoTheaterMode: () => void,
|
||||||
|
setVideoPlaybackRate: number => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -49,6 +51,7 @@ function VideoViewer(props: Props) {
|
||||||
source,
|
source,
|
||||||
changeVolume,
|
changeVolume,
|
||||||
changeMute,
|
changeMute,
|
||||||
|
videoPlaybackRate,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
position,
|
position,
|
||||||
claim,
|
claim,
|
||||||
|
@ -64,6 +67,7 @@ function VideoViewer(props: Props) {
|
||||||
clearPosition,
|
clearPosition,
|
||||||
desktopPlayStartTime,
|
desktopPlayStartTime,
|
||||||
toggleVideoTheaterMode,
|
toggleVideoTheaterMode,
|
||||||
|
setVideoPlaybackRate,
|
||||||
} = props;
|
} = props;
|
||||||
const claimId = claim && claim.claim_id;
|
const claimId = claim && claim.claim_id;
|
||||||
const isAudio = contentType.includes('audio');
|
const isAudio = contentType.includes('audio');
|
||||||
|
@ -137,7 +141,7 @@ function VideoViewer(props: Props) {
|
||||||
if (!embedded) {
|
if (!embedded) {
|
||||||
player.muted(muted);
|
player.muted(muted);
|
||||||
player.volume(volume);
|
player.volume(volume);
|
||||||
|
player.playbackRate(videoPlaybackRate);
|
||||||
addTheaterModeButton(player, toggleVideoTheaterMode);
|
addTheaterModeButton(player, toggleVideoTheaterMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +189,11 @@ function VideoViewer(props: Props) {
|
||||||
changeMute(player.muted());
|
changeMute(player.muted());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
player.on('ratechange', () => {
|
||||||
|
if (player) {
|
||||||
|
setVideoPlaybackRate(player.playbackRate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (position) {
|
if (position) {
|
||||||
player.currentTime(position);
|
player.currentTime(position);
|
||||||
|
|
|
@ -48,6 +48,7 @@ const defaultState = {
|
||||||
[SETTINGS.AUTOMATIC_DARK_MODE_ENABLED]: false,
|
[SETTINGS.AUTOMATIC_DARK_MODE_ENABLED]: false,
|
||||||
[SETTINGS.TILE_LAYOUT]: true,
|
[SETTINGS.TILE_LAYOUT]: true,
|
||||||
[SETTINGS.VIDEO_THEATER_MODE]: false,
|
[SETTINGS.VIDEO_THEATER_MODE]: false,
|
||||||
|
[SETTINGS.VIDEO_PLAYBACK_RATE]: 1,
|
||||||
|
|
||||||
[SETTINGS.DARK_MODE_TIMES]: {
|
[SETTINGS.DARK_MODE_TIMES]: {
|
||||||
from: { hour: '21', min: '00', formattedTime: '21:00' },
|
from: { hour: '21', min: '00', formattedTime: '21:00' },
|
||||||
|
|
Loading…
Add table
Reference in a new issue