Theater: hide button when not needed
## Issues 5349: Remove theater mode button from player in comments 5519: Theatre mode button doesn't do anything in full screen mode [Odysse/LBRY desktop app] ## Notes 5349: Wanted to hide for 'markdown' as well, but it seems useful for 'markdown' (to clear the screen from Related), so I did not include it.
This commit is contained in:
parent
8b791cb511
commit
d26d76fc70
4 changed files with 23 additions and 7 deletions
|
@ -129,7 +129,7 @@ export default function FileRenderFloating(props: Props) {
|
||||||
|
|
||||||
// Listen to main-window resizing and adjust the fp position accordingly:
|
// Listen to main-window resizing and adjust the fp position accordingly:
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleMainWindowResize = debounce(e => {
|
const handleMainWindowResize = debounce((e) => {
|
||||||
let newPos = {
|
let newPos = {
|
||||||
x: Math.round(relativePos.x * getScreenWidth()),
|
x: Math.round(relativePos.x * getScreenWidth()),
|
||||||
y: Math.round(relativePos.y * getScreenHeight()),
|
y: Math.round(relativePos.y * getScreenHeight()),
|
||||||
|
@ -248,6 +248,7 @@ export default function FileRenderFloating(props: Props) {
|
||||||
className={classnames('content__viewer', {
|
className={classnames('content__viewer', {
|
||||||
'content__viewer--floating': isFloating,
|
'content__viewer--floating': isFloating,
|
||||||
'content__viewer--inline': !isFloating,
|
'content__viewer--inline': !isFloating,
|
||||||
|
'content__viewer--secondary': playingUriSource === 'comment',
|
||||||
'content__viewer--theater-mode': !isFloating && videoTheaterMode,
|
'content__viewer--theater-mode': !isFloating && videoTheaterMode,
|
||||||
})}
|
})}
|
||||||
style={
|
style={
|
||||||
|
|
|
@ -28,11 +28,11 @@ export type Player = {
|
||||||
ended: () => boolean,
|
ended: () => boolean,
|
||||||
error: () => any,
|
error: () => any,
|
||||||
loadingSpinner: any,
|
loadingSpinner: any,
|
||||||
getChild: string => any,
|
getChild: (string) => any,
|
||||||
playbackRate: (?number) => number,
|
playbackRate: (?number) => number,
|
||||||
userActive: (?boolean) => boolean,
|
userActive: (?boolean) => boolean,
|
||||||
overlay: any => void,
|
overlay: (any) => void,
|
||||||
mobileUi: any => void,
|
mobileUi: (any) => void,
|
||||||
controlBar: {
|
controlBar: {
|
||||||
addChild: (string, any) => void,
|
addChild: (string, any) => void,
|
||||||
},
|
},
|
||||||
|
@ -42,7 +42,7 @@ type Props = {
|
||||||
source: string,
|
source: string,
|
||||||
sourceType: string,
|
sourceType: string,
|
||||||
poster: ?string,
|
poster: ?string,
|
||||||
onPlayerReady: Player => void,
|
onPlayerReady: (Player) => void,
|
||||||
isAudio: boolean,
|
isAudio: boolean,
|
||||||
startMuted: boolean,
|
startMuted: boolean,
|
||||||
autoplay: boolean,
|
autoplay: boolean,
|
||||||
|
@ -315,7 +315,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
if (e.shiftKey && (e.keyCode === PERIOD_KEYCODE || e.keyCode === COMMA_KEYCODE)) {
|
if (e.shiftKey && (e.keyCode === PERIOD_KEYCODE || e.keyCode === COMMA_KEYCODE)) {
|
||||||
const isSpeedUp = e.keyCode === PERIOD_KEYCODE;
|
const isSpeedUp = e.keyCode === PERIOD_KEYCODE;
|
||||||
const rate = player.playbackRate();
|
const rate = player.playbackRate();
|
||||||
let rateIndex = videoPlaybackRates.findIndex(x => x === rate);
|
let rateIndex = videoPlaybackRates.findIndex((x) => x === rate);
|
||||||
if (rateIndex >= 0) {
|
if (rateIndex >= 0) {
|
||||||
rateIndex = isSpeedUp ? Math.min(rateIndex + 1, videoPlaybackRates.length - 1) : Math.max(rateIndex - 1, 0);
|
rateIndex = isSpeedUp ? Math.min(rateIndex + 1, videoPlaybackRates.length - 1) : Math.max(rateIndex - 1, 0);
|
||||||
const nextRate = videoPlaybackRates[rateIndex];
|
const nextRate = videoPlaybackRates[rateIndex];
|
||||||
|
@ -329,6 +329,9 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
// Theater Mode shortcut
|
// Theater Mode shortcut
|
||||||
if (e.keyCode === THEATER_MODE_KEYCODE) {
|
if (e.keyCode === THEATER_MODE_KEYCODE) {
|
||||||
toggleVideoTheaterMode();
|
toggleVideoTheaterMode();
|
||||||
|
if (player.isFullscreen()) {
|
||||||
|
player.exitFullscreen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +424,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
// Update video player and reload when source URL changes
|
// Update video player and reload when source URL changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// For some reason the video player is responsible for detecting content type this way
|
// For some reason the video player is responsible for detecting content type this way
|
||||||
fetch(source, { method: 'HEAD', cache: 'no-store' }).then(response => {
|
fetch(source, { method: 'HEAD', cache: 'no-store' }).then((response) => {
|
||||||
const player = playerRef.current;
|
const player = playerRef.current;
|
||||||
|
|
||||||
if (!player) {
|
if (!player) {
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content__viewer--secondary {
|
||||||
|
.vjs-button--theater-mode {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.content__viewer--floating {
|
.content__viewer--floating {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
|
@ -544,6 +544,12 @@ video::-internal-media-controls-overlay-cast-button {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.video-js.vjs-fullscreen {
|
||||||
|
.vjs-button--theater-mode {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
// Tap-to-unmute
|
// Tap-to-unmute
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
|
|
Loading…
Reference in a new issue