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

View file

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

View file

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

View file

@ -7,6 +7,7 @@ import eventTracking from 'videojs-event-tracking';
import isUserTyping from 'util/detect-typing'; import isUserTyping from 'util/detect-typing';
import analytics from 'analytics'; import analytics from 'analytics';
import { EmbedContext } from 'page/embedWrapper/view'; import { EmbedContext } from 'page/embedWrapper/view';
import { FORCE_CONTENT_TYPE_PLAYER } from 'constants/claim';
const F11_KEYCODE = 122; const F11_KEYCODE = 122;
const SPACE_BAR_KEYCODE = 32; const SPACE_BAR_KEYCODE = 32;
@ -36,7 +37,7 @@ const VIDEO_JS_OPTIONS: VideoJSOptions = {
controls: true, controls: true,
autoplay: true, autoplay: true,
preload: 'auto', 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, responsive: true,
}; };
@ -84,17 +85,7 @@ function VideoViewer(props: Props) {
VIDEO_JS_OPTIONS.muted = true; VIDEO_JS_OPTIONS.muted = true;
} }
let forceTypes = [ const forcePlayer = FORCE_CONTENT_TYPE_PLAYER.includes(contentType);
'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 [requireRedraw, setRequireRedraw] = useState(false); const [requireRedraw, setRequireRedraw] = useState(false);
let player; let player;
@ -133,16 +124,16 @@ function VideoViewer(props: Props) {
currentVideo.removeEventListener('volumechange', doVolume); currentVideo.removeEventListener('volumechange', doVolume);
} }
}; };
}, []); }, [changeMute, changeVolume, onEndedCB]);
useEffect(() => { useEffect(() => {
const videoNode = videoRef.current; const { current: videoNode } = videoRef;
const videoJsOptions = { const videoJsOptions = {
...VIDEO_JS_OPTIONS, ...VIDEO_JS_OPTIONS,
sources: [ sources: [
{ {
src: source, src: source,
type: forceMp4 ? 'video/mp4' : contentType, type: forcePlayer ? 'video/mp4' : contentType,
}, },
], ],
plugins: { eventTracking: true }, plugins: { eventTracking: true },
@ -182,7 +173,7 @@ function VideoViewer(props: Props) {
useEffect(() => { useEffect(() => {
function handleKeyDown(e: KeyboardEvent) { function handleKeyDown(e: KeyboardEvent) {
const videoNode = videoRef.current; const { current: videoNode } = videoRef;
if (!videoNode || isUserTyping()) { if (!videoNode || isUserTyping()) {
return; 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 // 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 // player analytics
useEffect(() => { useEffect(() => {
@ -249,7 +240,7 @@ function VideoViewer(props: Props) {
player.off(); player.off();
} }
}; };
}, [player]); }, [claimId, player]);
useEffect(() => { useEffect(() => {
if (player && position) { 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_ANONYMOUS = 'anonymous';
export const CHANNEL_NEW = 'new'; export const CHANNEL_NEW = 'new';
@ -6,3 +6,17 @@ export const PAGE_SIZE = 20;
export const INVALID_NAME_ERROR = export const INVALID_NAME_ERROR =
__('LBRY names cannot contain spaces or reserved symbols') + ' ' + '($#@;/"<>%{}|^~[]`)'; __('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 // Leaving for now
// const reducersToClear = whiteListedReducers.filter(reducerKey => reducerKey !== 'tags'); // const reducersToClear = whiteListedReducers.filter(reducerKey => reducerKey !== 'tags');
// window.cacheStore.purge(reducersToClear); // window.cacheStore.purge(reducersToClear);
window.localStorage.clear(); window.sessionStorage.clear();
dispatch(doClearSupport()); dispatch(doClearSupport());
window.location.reload();
return dispatch(doClearPublish()); return dispatch(doClearPublish());
}; };
} }

View file

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