Only change default from settings page

This commit is contained in:
Rafael 2022-04-20 15:40:21 -03:00 committed by Thomas Zarebczan
parent 524eeff745
commit ef7e6a56b4
5 changed files with 4 additions and 17 deletions

View file

@ -1,7 +1,7 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
import { VIDEO_QUALITY_OPTIONS } from 'constants/video'; import { VIDEO_QUALITY_OPTIONS } from 'constants/player';
import { toCapitalCase } from 'util/string'; import { toCapitalCase } from 'util/string';
type Props = { type Props = {

View file

@ -23,12 +23,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 { selectDaemonSettings, selectClientSetting, selectHomepageData } from 'redux/selectors/settings'; import { selectDaemonSettings, selectClientSetting, selectHomepageData } from 'redux/selectors/settings';
import { import { toggleVideoTheaterMode, toggleAutoplayNext, doSetClientSetting } from 'redux/actions/settings';
toggleVideoTheaterMode,
toggleAutoplayNext,
doSetClientSetting,
doSetDefaultVideoQuality,
} from 'redux/actions/settings';
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user'; import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
const select = (state, props) => { const select = (state, props) => {
@ -107,7 +102,6 @@ const perform = (dispatch) => ({
), ),
doAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)), doAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)),
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()), claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
doSetDefaultVideoQuality: (value) => dispatch(doSetDefaultVideoQuality(value)),
}); });
export default withRouter(connect(select, perform)(VideoViewer)); export default withRouter(connect(select, perform)(VideoViewer));

View file

@ -3,7 +3,7 @@ import videojs from 'video.js';
import { version as VERSION } from './package.json'; import { version as VERSION } from './package.json';
import ConcreteButton from './ConcreteButton'; import ConcreteButton from './ConcreteButton';
import ConcreteMenuItem from './ConcreteMenuItem'; import ConcreteMenuItem from './ConcreteMenuItem';
import * as QUALITY_OPTIONS from 'constants/video'; import * as QUALITY_OPTIONS from 'constants/player';
import { safeGetComputedStyle, simpleSelector } from '../videojs-http-streaming--override/playlist-selectors'; import { safeGetComputedStyle, simpleSelector } from '../videojs-http-streaming--override/playlist-selectors';
// Default options for the plugin. // Default options for the plugin.
@ -287,14 +287,13 @@ class HlsQualitySelectorPlugin {
* @param {number} height - A number representing HLS playlist. * @param {number} height - A number representing HLS playlist.
*/ */
setQuality(height) { setQuality(height) {
const { doSetDefaultVideoQuality } = this.config;
const qualityList = this.player.qualityLevels(); const qualityList = this.player.qualityLevels();
// Set quality on plugin // Set quality on plugin
this._currentQuality = height; this._currentQuality = height;
doSetDefaultVideoQuality(height);
if (this.config.displayCurrentQuality) { if (this.config.displayCurrentQuality) {
console.log(height);
this.setButtonInnerText( this.setButtonInnerText(
height === QUALITY_OPTIONS.AUTO height === QUALITY_OPTIONS.AUTO
? QUALITY_OPTIONS.AUTO ? QUALITY_OPTIONS.AUTO

View file

@ -85,7 +85,6 @@ type Props = {
userId: ?number, userId: ?number,
videoTheaterMode: boolean, videoTheaterMode: boolean,
defaultQuality: ?string, defaultQuality: ?string,
doSetDefaultVideoQuality: (value: ?string) => void,
onPlayerReady: (Player, any) => void, onPlayerReady: (Player, any) => void,
playNext: () => void, playNext: () => void,
playPrevious: () => void, playPrevious: () => void,
@ -147,7 +146,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
userId, userId,
videoTheaterMode, videoTheaterMode,
defaultQuality, defaultQuality,
doSetDefaultVideoQuality,
onPlayerReady, onPlayerReady,
playNext, playNext,
playPrevious, playPrevious,
@ -286,7 +284,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
displayCurrentQuality: true, displayCurrentQuality: true,
originalHeight: claimValues?.video?.height, originalHeight: claimValues?.video?.height,
defaultQuality, defaultQuality,
doSetDefaultVideoQuality,
}); });
} }

View file

@ -72,7 +72,6 @@ type Props = {
isLivestreamClaim: boolean, isLivestreamClaim: boolean,
activeLivestreamForChannel: any, activeLivestreamForChannel: any,
defaultQuality: ?string, defaultQuality: ?string,
doSetDefaultVideoQuality: (value: ?string) => void,
}; };
/* /*
@ -118,7 +117,6 @@ function VideoViewer(props: Props) {
isLivestreamClaim, isLivestreamClaim,
activeLivestreamForChannel, activeLivestreamForChannel,
defaultQuality, defaultQuality,
doSetDefaultVideoQuality,
} = props; } = props;
const permanentUrl = claim && claim.permanent_url; const permanentUrl = claim && claim.permanent_url;
@ -517,7 +515,6 @@ function VideoViewer(props: Props) {
isLivestreamClaim={isLivestreamClaim} isLivestreamClaim={isLivestreamClaim}
activeLivestreamForChannel={activeLivestreamForChannel} activeLivestreamForChannel={activeLivestreamForChannel}
defaultQuality={defaultQuality} defaultQuality={defaultQuality}
doSetDefaultVideoQuality={doSetDefaultVideoQuality}
/> />
</div> </div>
); );