small fixes

This commit is contained in:
Thomas Zarebczan 2020-03-27 12:49:41 -04:00 committed by Sean Yesmunt
parent 0c042376a4
commit 829c2eac50
7 changed files with 34 additions and 26 deletions

View file

@ -121,7 +121,6 @@ function App(props: Props) {
const urlParams = new URLSearchParams(search);
const rawReferrerParam = urlParams.get('r');
const sanitizedReferrerParam = rawReferrerParam && rawReferrerParam.replace(':', '#');
const wrapperElement = appRef.current;
const shouldHideNag = pathname.startsWith(`/$/${PAGES.EMBED}`) || pathname.startsWith(`/$/${PAGES.AUTH_VERIFY}`);
let uri;
@ -172,6 +171,7 @@ function App(props: Props) {
}, [sanitizedReferrerParam, isRewardApproved, referredRewardAvailable]);
useEffect(() => {
const { current: wrapperElement } = appRef;
if (wrapperElement) {
ReactModal.setAppElement(wrapperElement);
}
@ -181,7 +181,7 @@ function App(props: Props) {
fetchTransactions(1, TX_LIST.LATEST_PAGE_SIZE);
fetchChannelListMine(); // This needs to be done for web too...
// @endif
}, [fetchTransactions, fetchAccessToken, fetchChannelListMine, wrapperElement]);
}, [appRef, fetchAccessToken, fetchChannelListMine, fetchTransactions]);
useEffect(() => {
// $FlowFixMe

View file

@ -10,6 +10,7 @@ import isUserTyping from 'util/detect-typing';
import Yrbl from 'component/yrbl';
import I18nMessage from 'component/i18nMessage';
import { generateDownloadUrl } from 'util/lbrytv';
import { FORCE_CONTENT_TYPE_PLAYER } from 'constants/claim';
const SPACE_BAR_KEYCODE = 32;
@ -54,7 +55,7 @@ export default function FileViewerInitiator(props: Props) {
claim,
} = props;
const cost = costInfo && costInfo.cost;
const forceVideo = ['application/x-ext-mkv', 'video/x-matroska'].includes(contentType);
const forceVideo = FORCE_CONTENT_TYPE_PLAYER.includes(contentType);
const isPlayable = ['audio', 'video'].includes(mediaType) || forceVideo;
const isImage = mediaType === 'image';
const fileStatus = fileInfo && fileInfo.status;
@ -114,7 +115,7 @@ export default function FileViewerInitiator(props: Props) {
if (((autoplay && !videoOnPage && isAutoPlayable) || isText || isImage) && hasCostInfo && cost === 0) {
viewFile();
}
}, [autoplay, viewFile, isAutoPlayable, hasCostInfo, cost, isText]);
}, [autoplay, viewFile, isAutoPlayable, hasCostInfo, cost, isText, isImage]);
return (
<div

View file

@ -72,7 +72,7 @@ function PublishName(props: Props) {
setBidError(bidError);
updatePublishForm({ bidError: bidError });
}, [bid, previousBidAmount, balance]);
}, [bid, previousBidAmount, balance, updatePublishForm]);
return (
<Card

View file

@ -7,6 +7,7 @@ import eventTracking from 'videojs-event-tracking';
import isUserTyping from 'util/detect-typing';
import analytics from 'analytics';
import { EmbedContext } from 'page/embedWrapper/view';
import { FORCE_CONTENT_TYPE_PLAYER } from 'constants/claim';
const F11_KEYCODE = 122;
const SPACE_BAR_KEYCODE = 32;
@ -36,7 +37,7 @@ const VIDEO_JS_OPTIONS: VideoJSOptions = {
controls: true,
autoplay: true,
preload: 'auto',
playbackRates: [0.25, 0.5, 0.75, 1, 1.1, 1.25, 1.5, 2],
playbackRates: [0.25, 0.5, 0.75, 1, 1.1, 1.25, 1.5, 1.75, 2],
responsive: true,
};
@ -84,17 +85,7 @@ function VideoViewer(props: Props) {
VIDEO_JS_OPTIONS.muted = true;
}
let forceTypes = [
'video/quicktime',
'application/x-ext-mkv',
'video/x-matroska',
'application/octet-stream',
'video/x-ms-wmv',
'video/x-msvideo',
'video/mpeg',
'video/m4v',
];
const forceMp4 = forceTypes.includes(contentType);
const forcePlayer = FORCE_CONTENT_TYPE_PLAYER.includes(contentType);
const [requireRedraw, setRequireRedraw] = useState(false);
let player;
@ -133,16 +124,16 @@ function VideoViewer(props: Props) {
currentVideo.removeEventListener('volumechange', doVolume);
}
};
}, []);
}, [changeMute, changeVolume, onEndedCB]);
useEffect(() => {
const videoNode = videoRef.current;
const { current: videoNode } = videoRef;
const videoJsOptions = {
...VIDEO_JS_OPTIONS,
sources: [
{
src: source,
type: forceMp4 ? 'video/mp4' : contentType,
type: forcePlayer ? 'video/mp4' : contentType,
},
],
plugins: { eventTracking: true },
@ -182,7 +173,7 @@ function VideoViewer(props: Props) {
useEffect(() => {
function handleKeyDown(e: KeyboardEvent) {
const videoNode = videoRef.current;
const { current: videoNode } = videoRef;
if (!videoNode || isUserTyping()) {
return;
@ -225,7 +216,7 @@ function VideoViewer(props: Props) {
};
// include requireRedraw here so the event listener is re-added when we need to manually remove/add the video player
}, [videoRef, requireRedraw]);
}, [videoRef, requireRedraw, player]);
// player analytics
useEffect(() => {
@ -249,7 +240,7 @@ function VideoViewer(props: Props) {
player.off();
}
};
}, [player]);
}, [claimId, player]);
useEffect(() => {
if (player && position) {

View file

@ -1,4 +1,4 @@
export const MINIMUM_PUBLISH_BID = 0.00001000;
export const MINIMUM_PUBLISH_BID = 0.00001;
export const CHANNEL_ANONYMOUS = 'anonymous';
export const CHANNEL_NEW = 'new';
@ -6,3 +6,17 @@ export const PAGE_SIZE = 20;
export const INVALID_NAME_ERROR =
__('LBRY names cannot contain spaces or reserved symbols') + ' ' + '($#@;/"<>%{}|^~[]`)';
export const FORCE_CONTENT_TYPE_PLAYER = [
'video/quicktime',
'application/x-ext-mkv',
'video/x-matroska',
'application/octet-stream',
'video/x-ms-wmv',
'video/x-msvideo',
'video/mpeg',
'video/m4v',
'audio/ogg',
'application/x-ext-ogg',
'application/x-ext-m4a',
];

View file

@ -367,8 +367,9 @@ export function doClearCache() {
// Leaving for now
// const reducersToClear = whiteListedReducers.filter(reducerKey => reducerKey !== 'tags');
// window.cacheStore.purge(reducersToClear);
window.localStorage.clear();
window.sessionStorage.clear();
dispatch(doClearSupport());
window.location.reload();
return dispatch(doClearPublish());
};
}

View file

@ -46,13 +46,14 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
dispatch(doAbandonClaim(txid, Number(nout)));
}
// @if TARGET='app'
dispatch({
type: ACTIONS.FILE_DELETE,
data: {
outpoint,
},
});
// @endif
};
}