2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2019-08-13 07:35:13 +02:00
|
|
|
import * as ICONS from 'constants/icons';
|
2020-04-01 20:43:50 +02:00
|
|
|
import * as RENDER_MODES from 'constants/file_render_modes';
|
2020-05-01 18:41:32 +02:00
|
|
|
import React, { useEffect, useState } from 'react';
|
2019-08-13 07:35:13 +02:00
|
|
|
import Button from 'component/button';
|
2018-03-26 23:32:43 +02:00
|
|
|
import classnames from 'classnames';
|
2018-07-05 04:49:12 +02:00
|
|
|
import LoadingScreen from 'component/common/loading-screen';
|
2021-07-06 11:02:05 +02:00
|
|
|
import FileRender from 'component/fileRender';
|
2019-08-13 07:35:13 +02:00
|
|
|
import UriIndicator from 'component/uriIndicator';
|
2019-09-27 20:56:15 +02:00
|
|
|
import usePersistedState from 'effects/use-persisted-state';
|
2020-10-20 19:10:02 +02:00
|
|
|
import { PRIMARY_PLAYER_WRAPPER_CLASS } from 'page/file/view';
|
2021-07-06 11:02:05 +02:00
|
|
|
import Draggable from 'react-draggable';
|
2019-10-14 00:28:12 +02:00
|
|
|
import { onFullscreenChange } from 'util/full-screen';
|
2021-09-10 19:27:21 +02:00
|
|
|
import { generateListSearchUrlParams, formatLbryUrlForWeb } from 'util/url';
|
2020-08-10 22:47:39 +02:00
|
|
|
import { useIsMobile } from 'effects/use-screensize';
|
2020-09-10 13:52:42 +02:00
|
|
|
import debounce from 'util/debounce';
|
2020-10-20 19:10:02 +02:00
|
|
|
import { useHistory } from 'react-router';
|
2021-10-08 05:47:39 +02:00
|
|
|
import { isURIEqual } from 'util/lbryURI';
|
2021-09-10 19:27:21 +02:00
|
|
|
import AutoplayCountdown from 'component/autoplayCountdown';
|
2020-09-10 13:52:42 +02:00
|
|
|
|
2020-11-06 22:25:47 +01:00
|
|
|
const IS_DESKTOP_MAC = typeof process === 'object' ? process.platform === 'darwin' : false;
|
2021-11-15 22:13:48 +01:00
|
|
|
const DEBOUNCE_WINDOW_RESIZE_HANDLER_MS = 100;
|
2021-07-06 11:02:05 +02:00
|
|
|
export const INLINE_PLAYER_WRAPPER_CLASS = 'inline-player__wrapper';
|
2018-05-16 21:34:38 +02:00
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
function getScreenWidth() {
|
|
|
|
if (document && document.documentElement) {
|
|
|
|
return document.documentElement.clientWidth;
|
|
|
|
} else {
|
|
|
|
return window.innerWidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getScreenHeight() {
|
|
|
|
if (document && document.documentElement) {
|
|
|
|
return document.documentElement.clientHeight;
|
|
|
|
} else {
|
|
|
|
return window.innerHeight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getFloatingPlayerRect() {
|
|
|
|
// TODO: use 'fileViewerRect'?
|
|
|
|
const FLOATING_PLAYER_CLASS = 'content__viewer--floating';
|
|
|
|
const elem = document.querySelector(`.${FLOATING_PLAYER_CLASS}`);
|
|
|
|
if (elem) {
|
|
|
|
return elem.getBoundingClientRect();
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function clampRectToScreen(x, y, rect) {
|
|
|
|
if (rect) {
|
|
|
|
const ESTIMATED_SCROLL_BAR_PX = 50;
|
|
|
|
const screenW = getScreenWidth();
|
|
|
|
const screenH = getScreenHeight();
|
|
|
|
|
|
|
|
if (x + rect.width > screenW - ESTIMATED_SCROLL_BAR_PX) {
|
|
|
|
x = screenW - rect.width - ESTIMATED_SCROLL_BAR_PX;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (y + rect.height > screenH) {
|
|
|
|
y = screenH - rect.height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return { x, y };
|
|
|
|
}
|
|
|
|
|
|
|
|
function calculateRelativePos(x, y) {
|
|
|
|
return {
|
|
|
|
x: x / getScreenWidth(),
|
|
|
|
y: y / getScreenHeight(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// ****************************************************************************
|
|
|
|
// ****************************************************************************
|
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
2020-04-14 01:48:11 +02:00
|
|
|
isFloating: boolean,
|
2019-08-06 05:25:33 +02:00
|
|
|
fileInfo: FileListItem,
|
2021-03-19 16:04:12 +01:00
|
|
|
mature: boolean,
|
2018-03-26 23:32:43 +02:00
|
|
|
uri: string,
|
2019-08-02 08:28:14 +02:00
|
|
|
streamingUrl?: string,
|
2019-08-13 07:35:13 +02:00
|
|
|
title: ?string,
|
|
|
|
floatingPlayerEnabled: boolean,
|
2020-04-29 22:50:06 +02:00
|
|
|
closeFloatingPlayer: () => void,
|
2021-09-24 17:53:17 +02:00
|
|
|
clearSecondarySource: (string) => void,
|
2020-04-01 20:43:50 +02:00
|
|
|
renderMode: string,
|
2020-10-20 19:10:02 +02:00
|
|
|
playingUri: ?PlayingUri,
|
|
|
|
primaryUri: ?string,
|
2021-01-08 16:21:27 +01:00
|
|
|
videoTheaterMode: boolean,
|
2021-03-19 16:04:12 +01:00
|
|
|
doFetchRecommendedContent: (string, boolean) => void,
|
2021-09-10 19:27:21 +02:00
|
|
|
doPlayUri: (string, string, boolean) => void,
|
2021-09-02 22:05:32 +02:00
|
|
|
collectionId: string,
|
2021-09-10 19:27:21 +02:00
|
|
|
costInfo: any,
|
|
|
|
claimWasPurchased: boolean,
|
|
|
|
nextListUri: string,
|
|
|
|
previousListUri: string,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2020-04-14 01:48:11 +02:00
|
|
|
export default function FileRenderFloating(props: Props) {
|
2020-04-29 22:50:06 +02:00
|
|
|
const {
|
|
|
|
fileInfo,
|
2021-03-19 16:04:12 +01:00
|
|
|
mature,
|
2020-04-29 22:50:06 +02:00
|
|
|
uri,
|
|
|
|
streamingUrl,
|
|
|
|
title,
|
|
|
|
isFloating,
|
|
|
|
closeFloatingPlayer,
|
2021-09-24 17:53:17 +02:00
|
|
|
clearSecondarySource,
|
2020-04-29 22:50:06 +02:00
|
|
|
floatingPlayerEnabled,
|
|
|
|
renderMode,
|
2020-10-20 19:10:02 +02:00
|
|
|
playingUri,
|
|
|
|
primaryUri,
|
2021-01-08 16:21:27 +01:00
|
|
|
videoTheaterMode,
|
2021-03-19 16:04:12 +01:00
|
|
|
doFetchRecommendedContent,
|
2021-09-10 19:27:21 +02:00
|
|
|
doPlayUri,
|
2021-09-02 22:05:32 +02:00
|
|
|
collectionId,
|
2021-09-10 19:27:21 +02:00
|
|
|
costInfo,
|
|
|
|
claimWasPurchased,
|
|
|
|
nextListUri,
|
|
|
|
previousListUri,
|
2020-04-29 22:50:06 +02:00
|
|
|
} = props;
|
2021-09-10 19:27:21 +02:00
|
|
|
const { location, push } = useHistory();
|
|
|
|
const hideFloatingPlayer = location.state && location.state.hideFloatingPlayer;
|
2021-09-24 17:53:17 +02:00
|
|
|
const playingUriSource = playingUri && playingUri.source;
|
|
|
|
const isComment = playingUriSource === 'comment';
|
2019-12-18 06:27:08 +01:00
|
|
|
const isMobile = useIsMobile();
|
2021-10-14 22:46:36 +02:00
|
|
|
const mainFilePlaying = !isFloating && primaryUri && isURIEqual(uri, primaryUri);
|
2021-09-24 17:53:17 +02:00
|
|
|
|
2020-05-01 18:41:32 +02:00
|
|
|
const [fileViewerRect, setFileViewerRect] = useState();
|
2020-05-05 20:02:12 +02:00
|
|
|
const [desktopPlayStartTime, setDesktopPlayStartTime] = useState();
|
2020-08-27 08:02:43 +02:00
|
|
|
const [wasDragging, setWasDragging] = useState(false);
|
2021-09-10 19:27:21 +02:00
|
|
|
const [doNavigate, setDoNavigate] = useState(false);
|
|
|
|
const [playNextUrl, setPlayNextUrl] = useState(true);
|
|
|
|
const [countdownCanceled, setCountdownCanceled] = useState(false);
|
2019-08-13 07:35:13 +02:00
|
|
|
const [position, setPosition] = usePersistedState('floating-file-viewer:position', {
|
|
|
|
x: -25,
|
|
|
|
y: window.innerHeight - 400,
|
|
|
|
});
|
2021-11-15 22:13:48 +01:00
|
|
|
const relativePosRef = React.useRef({ x: 0, y: 0 });
|
2020-04-14 01:48:11 +02:00
|
|
|
|
2021-09-13 17:24:35 +02:00
|
|
|
const navigateUrl =
|
2021-09-24 17:53:17 +02:00
|
|
|
playingUri &&
|
|
|
|
(playingUri.primaryUri || playingUri.uri) + (collectionId ? generateListSearchUrlParams(collectionId) : '');
|
2021-09-02 22:05:32 +02:00
|
|
|
|
2021-09-10 19:27:21 +02:00
|
|
|
const isFree = costInfo && costInfo.cost === 0;
|
|
|
|
const canViewFile = isFree || claimWasPurchased;
|
2020-04-01 20:43:50 +02:00
|
|
|
const isPlayable = RENDER_MODES.FLOATING_MODES.includes(renderMode);
|
|
|
|
const isReadyToPlay = isPlayable && (streamingUrl || (fileInfo && fileInfo.completed));
|
2019-08-02 08:28:14 +02:00
|
|
|
const loadingMessage =
|
2020-04-01 20:43:50 +02:00
|
|
|
fileInfo && fileInfo.blobs_completed >= 1 && (!fileInfo.download_path || !fileInfo.written_bytes)
|
2019-08-02 08:28:14 +02:00
|
|
|
? __("It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.")
|
|
|
|
: __('Loading');
|
2019-08-14 05:04:08 +02:00
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
function restoreToRelativePosition() {
|
|
|
|
const newX = Math.round(relativePosRef.current.x * getScreenWidth());
|
|
|
|
const newY = Math.round(relativePosRef.current.y * getScreenHeight());
|
|
|
|
setPosition(clampRectToScreen(newX, newY, getFloatingPlayerRect()));
|
2020-09-10 13:52:42 +02:00
|
|
|
}
|
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
const clampToScreenOnResize = React.useCallback(
|
|
|
|
debounce(() => {
|
|
|
|
restoreToRelativePosition();
|
|
|
|
}, DEBOUNCE_WINDOW_RESIZE_HANDLER_MS),
|
|
|
|
[]
|
|
|
|
);
|
2020-09-10 13:52:42 +02:00
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
// ???
|
2020-09-10 13:52:42 +02:00
|
|
|
useEffect(() => {
|
2020-09-15 04:38:49 +02:00
|
|
|
if (isFloating) {
|
2021-09-24 17:53:17 +02:00
|
|
|
// When the player begins floating, remove the comment source
|
|
|
|
// so that it doesn't try to resize again in case of going back
|
|
|
|
// to the origin's comment section and fail to position correctly
|
|
|
|
if (isComment && playingUri) clearSecondarySource(playingUri.uri);
|
2021-11-15 22:13:48 +01:00
|
|
|
}
|
|
|
|
}, [isFloating, isComment, clearSecondarySource, playingUri]);
|
2021-09-24 17:53:17 +02:00
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
// Initial update for relativePosRef:
|
|
|
|
useEffect(() => {
|
|
|
|
relativePosRef.current = calculateRelativePos(position.x, position.y);
|
|
|
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
|
|
|
|
|
|
// Ensure player is within screen when 'isFloating' changes.
|
|
|
|
useEffect(() => {
|
|
|
|
if (isFloating) {
|
|
|
|
restoreToRelativePosition();
|
2020-09-15 04:38:49 +02:00
|
|
|
}
|
2021-11-15 22:13:48 +01:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, [isFloating]);
|
2020-09-10 13:52:42 +02:00
|
|
|
|
2020-09-15 04:38:49 +02:00
|
|
|
// Listen to main-window resizing and adjust the fp position accordingly:
|
|
|
|
useEffect(() => {
|
2021-11-15 22:13:48 +01:00
|
|
|
if (isFloating) {
|
|
|
|
window.addEventListener('resize', clampToScreenOnResize);
|
|
|
|
return () => window.removeEventListener('resize', clampToScreenOnResize);
|
|
|
|
}
|
|
|
|
}, [isFloating, clampToScreenOnResize]);
|
2020-09-10 13:52:42 +02:00
|
|
|
|
2021-09-10 19:27:21 +02:00
|
|
|
const handleResize = React.useCallback(() => {
|
2020-10-20 19:10:02 +02:00
|
|
|
const element = mainFilePlaying
|
|
|
|
? document.querySelector(`.${PRIMARY_PLAYER_WRAPPER_CLASS}`)
|
|
|
|
: document.querySelector(`.${INLINE_PLAYER_WRAPPER_CLASS}`);
|
|
|
|
|
2021-09-13 17:24:35 +02:00
|
|
|
if (!element) return;
|
2020-10-20 19:10:02 +02:00
|
|
|
|
|
|
|
const rect = element.getBoundingClientRect();
|
|
|
|
|
2021-09-13 17:24:35 +02:00
|
|
|
// getBoundingClientRect returns a DomRect, not an object
|
2020-11-06 22:25:47 +01:00
|
|
|
const objectRect = {
|
|
|
|
top: rect.top,
|
|
|
|
right: rect.right,
|
|
|
|
bottom: rect.bottom,
|
|
|
|
left: rect.left,
|
|
|
|
width: rect.width,
|
|
|
|
height: rect.height,
|
2020-11-09 19:36:35 +01:00
|
|
|
// $FlowFixMe
|
|
|
|
x: rect.x,
|
2020-11-06 22:25:47 +01:00
|
|
|
};
|
|
|
|
|
2020-10-20 19:10:02 +02:00
|
|
|
// $FlowFixMe
|
2020-11-06 22:25:47 +01:00
|
|
|
setFileViewerRect({ ...objectRect, windowOffset: window.pageYOffset });
|
2021-09-10 19:27:21 +02:00
|
|
|
}, [mainFilePlaying]);
|
2019-08-13 07:35:13 +02:00
|
|
|
|
2020-10-20 19:10:02 +02:00
|
|
|
useEffect(() => {
|
2021-09-24 17:53:17 +02:00
|
|
|
if (playingUri && (playingUri.primaryUri || playingUri.uri)) {
|
2020-10-20 19:10:02 +02:00
|
|
|
handleResize();
|
2021-09-10 19:27:21 +02:00
|
|
|
setCountdownCanceled(false);
|
2019-08-13 07:35:13 +02:00
|
|
|
}
|
2021-09-13 17:24:35 +02:00
|
|
|
}, [handleResize, playingUri, videoTheaterMode]);
|
2019-08-13 07:35:13 +02:00
|
|
|
|
2020-10-20 19:10:02 +02:00
|
|
|
useEffect(() => {
|
2019-12-31 04:09:20 +01:00
|
|
|
handleResize();
|
|
|
|
window.addEventListener('resize', handleResize);
|
|
|
|
onFullscreenChange(window, 'add', handleResize);
|
2020-10-20 19:10:02 +02:00
|
|
|
|
2019-12-19 21:43:49 +01:00
|
|
|
return () => {
|
|
|
|
window.removeEventListener('resize', handleResize);
|
|
|
|
onFullscreenChange(window, 'remove', handleResize);
|
|
|
|
};
|
2021-09-10 19:27:21 +02:00
|
|
|
}, [handleResize]);
|
2020-04-01 20:43:50 +02:00
|
|
|
|
2020-05-05 20:02:12 +02:00
|
|
|
useEffect(() => {
|
|
|
|
// @if TARGET='app'
|
|
|
|
setDesktopPlayStartTime(Date.now());
|
|
|
|
// @endif
|
2020-05-05 22:45:59 +02:00
|
|
|
|
|
|
|
return () => {
|
|
|
|
// @if TARGET='app'
|
|
|
|
setDesktopPlayStartTime(undefined);
|
|
|
|
// @endif
|
|
|
|
};
|
2020-05-05 20:02:12 +02:00
|
|
|
}, [uri]);
|
|
|
|
|
2021-03-19 16:04:12 +01:00
|
|
|
useEffect(() => {
|
|
|
|
if (isFloating) {
|
|
|
|
doFetchRecommendedContent(uri, mature);
|
|
|
|
}
|
2021-09-10 19:27:21 +02:00
|
|
|
}, [doFetchRecommendedContent, isFloating, mature, uri]);
|
|
|
|
|
|
|
|
const doPlay = React.useCallback(
|
|
|
|
(playUri) => {
|
|
|
|
setDoNavigate(false);
|
|
|
|
if (!isFloating) {
|
|
|
|
const navigateUrl = formatLbryUrlForWeb(playUri);
|
|
|
|
push({
|
|
|
|
pathname: navigateUrl,
|
|
|
|
search: collectionId && generateListSearchUrlParams(collectionId),
|
|
|
|
state: { collectionId, forceAutoplay: true, hideFloatingPlayer: true },
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
doPlayUri(playUri, collectionId, true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
[collectionId, doPlayUri, isFloating, push]
|
|
|
|
);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (!doNavigate) return;
|
2021-03-19 16:04:12 +01:00
|
|
|
|
2021-09-10 19:27:21 +02:00
|
|
|
if (playNextUrl && nextListUri) {
|
|
|
|
doPlay(nextListUri);
|
|
|
|
} else if (previousListUri) {
|
|
|
|
doPlay(previousListUri);
|
|
|
|
}
|
|
|
|
setPlayNextUrl(true);
|
|
|
|
}, [doNavigate, doPlay, nextListUri, playNextUrl, previousListUri]);
|
|
|
|
|
|
|
|
if (
|
|
|
|
!isPlayable ||
|
|
|
|
!uri ||
|
|
|
|
(isFloating && (isMobile || !floatingPlayerEnabled || hideFloatingPlayer)) ||
|
|
|
|
(collectionId && !isFloating && ((!canViewFile && !nextListUri) || countdownCanceled))
|
|
|
|
) {
|
2020-04-01 20:43:50 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-09-13 17:24:35 +02:00
|
|
|
function handleDragStart() {
|
2020-08-27 08:02:43 +02:00
|
|
|
// Not really necessary, but reset just in case 'handleStop' didn't fire.
|
|
|
|
setWasDragging(false);
|
|
|
|
}
|
|
|
|
|
2020-09-09 04:14:51 +02:00
|
|
|
function handleDragMove(e, ui) {
|
2019-08-14 05:04:08 +02:00
|
|
|
const { x, y } = position;
|
2021-11-15 22:13:48 +01:00
|
|
|
const newX = ui.x;
|
|
|
|
const newY = ui.y;
|
|
|
|
|
|
|
|
// Mark as dragging if the position changed and we were not dragging before.
|
|
|
|
if (!wasDragging && (newX !== x || newY !== y)) {
|
|
|
|
setWasDragging(true);
|
|
|
|
}
|
2019-08-14 05:04:08 +02:00
|
|
|
}
|
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
function handleDragStop(e, ui) {
|
2020-08-27 08:02:43 +02:00
|
|
|
if (wasDragging) {
|
2021-11-15 22:13:48 +01:00
|
|
|
// e.stopPropagation();
|
2020-08-27 08:02:43 +02:00
|
|
|
setWasDragging(false);
|
2021-11-15 22:13:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
let newPos = { x: ui.x, y: ui.y };
|
|
|
|
if (newPos.x !== position.x || newPos.y !== position.y) {
|
|
|
|
newPos = clampRectToScreen(newPos.x, newPos.y, getFloatingPlayerRect());
|
|
|
|
setPosition(newPos);
|
|
|
|
relativePosRef.current = calculateRelativePos(newPos.x, newPos.y);
|
2020-08-27 08:02:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-02 08:28:14 +02:00
|
|
|
return (
|
2021-07-06 11:02:05 +02:00
|
|
|
<Draggable
|
|
|
|
onDrag={handleDragMove}
|
|
|
|
onStart={handleDragStart}
|
|
|
|
onStop={handleDragStop}
|
|
|
|
defaultPosition={position}
|
|
|
|
position={isFloating ? position : { x: 0, y: 0 }}
|
|
|
|
bounds="parent"
|
|
|
|
disabled={!isFloating}
|
|
|
|
handle=".draggable"
|
|
|
|
cancel=".button"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
className={classnames('content__viewer', {
|
|
|
|
'content__viewer--floating': isFloating,
|
|
|
|
'content__viewer--inline': !isFloating,
|
2021-09-24 17:53:17 +02:00
|
|
|
'content__viewer--secondary': isComment,
|
2021-07-06 11:02:05 +02:00
|
|
|
'content__viewer--theater-mode': !isFloating && videoTheaterMode,
|
2021-11-15 22:13:48 +01:00
|
|
|
'content__viewer--disable-click': wasDragging,
|
2021-07-06 11:02:05 +02:00
|
|
|
})}
|
|
|
|
style={
|
|
|
|
!isFloating && fileViewerRect
|
|
|
|
? {
|
|
|
|
width: fileViewerRect.width,
|
|
|
|
height: fileViewerRect.height,
|
|
|
|
left: fileViewerRect.x,
|
|
|
|
// 80px is header height in scss/init/vars.scss
|
|
|
|
top: fileViewerRect.windowOffset + fileViewerRect.top - 80 - (IS_DESKTOP_MAC ? 24 : 0),
|
|
|
|
}
|
|
|
|
: {}
|
|
|
|
}
|
2019-08-13 07:35:13 +02:00
|
|
|
>
|
|
|
|
<div
|
2021-07-06 11:02:05 +02:00
|
|
|
className={classnames('content__wrapper', {
|
|
|
|
'content__wrapper--floating': isFloating,
|
2019-08-02 08:28:14 +02:00
|
|
|
})}
|
2019-08-13 07:35:13 +02:00
|
|
|
>
|
2021-07-06 11:02:05 +02:00
|
|
|
{isFloating && (
|
|
|
|
<Button
|
|
|
|
title={__('Close')}
|
|
|
|
onClick={closeFloatingPlayer}
|
|
|
|
icon={ICONS.REMOVE}
|
|
|
|
button="primary"
|
|
|
|
className="content__floating-close"
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{isReadyToPlay ? (
|
2021-11-15 22:13:48 +01:00
|
|
|
<FileRender className="draggable" uri={uri} desktopPlayStartTime={desktopPlayStartTime} />
|
2021-07-06 11:02:05 +02:00
|
|
|
) : (
|
2021-09-10 19:27:21 +02:00
|
|
|
<>
|
|
|
|
{collectionId && !canViewFile ? (
|
|
|
|
<div className="content__loading">
|
|
|
|
<AutoplayCountdown
|
|
|
|
nextRecommendedUri={nextListUri}
|
|
|
|
doNavigate={() => setDoNavigate(true)}
|
|
|
|
doReplay={() => doPlayUri(uri, collectionId, false)}
|
|
|
|
doPrevious={() => {
|
|
|
|
setPlayNextUrl(false);
|
|
|
|
setDoNavigate(true);
|
|
|
|
}}
|
|
|
|
onCanceled={() => setCountdownCanceled(true)}
|
|
|
|
skipPaid
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<LoadingScreen status={loadingMessage} />
|
|
|
|
)}
|
|
|
|
</>
|
2021-07-06 11:02:05 +02:00
|
|
|
)}
|
|
|
|
{isFloating && (
|
|
|
|
<div className="draggable content__info">
|
|
|
|
<div className="claim-preview__title" title={title || uri}>
|
2021-09-10 19:27:21 +02:00
|
|
|
<Button label={title || uri} navigate={navigateUrl} button="link" className="content__floating-link" />
|
2019-08-13 07:35:13 +02:00
|
|
|
</div>
|
2021-07-06 11:02:05 +02:00
|
|
|
<UriIndicator link uri={uri} />
|
|
|
|
</div>
|
|
|
|
)}
|
2019-08-13 07:35:13 +02:00
|
|
|
</div>
|
2021-07-06 11:02:05 +02:00
|
|
|
</div>
|
|
|
|
</Draggable>
|
2019-08-02 08:28:14 +02:00
|
|
|
);
|
2017-04-23 11:56:50 +02:00
|
|
|
}
|