Enable int

This commit is contained in:
Manav Rathi
2025-04-09 18:25:23 +05:30
parent 96194bdfe4
commit 5535fdead5
2 changed files with 35 additions and 15 deletions

View File

@@ -28,7 +28,7 @@ import { useIsSmallWidth } from "ente-base/components/utils/hooks";
import { type ModalVisibilityProps } from "ente-base/components/utils/modal";
import { useBaseContext } from "ente-base/context";
import { lowercaseExtension } from "ente-base/file-name";
import { formattedListJoin, ut } from "ente-base/i18n";
import { formattedListJoin, pt, ut } from "ente-base/i18n";
import type { LocalUser } from "ente-base/local-user";
import log from "ente-base/log";
import {
@@ -45,6 +45,7 @@ import {
ImageEditorOverlay,
type ImageEditorOverlayProps,
} from "ente-new/photos/components/ImageEditorOverlay";
import { settingsSnapshot } from "ente-new/photos/services/settings";
import { t } from "i18next";
import React, {
useCallback,
@@ -1151,8 +1152,22 @@ const Shortcuts: React.FC<ShortcutsProps> = ({
<Shortcut action={t("close")} shortcut={ut("Esc")} />
<Shortcut
action={formattedListJoin([t("previous"), t("next")])}
shortcut={formattedListJoin([ut("←"), ut("→")])}
shortcut={
// TODO(HLS):
settingsSnapshot().isInternalUser
? `${formattedListJoin([ut("←"), ut("→")])} (Option/Alt)`
: formattedListJoin([ut("←"), ut("→")])
}
/>
{
/* TODO(HLS): */
settingsSnapshot().isInternalUser && (
<Shortcut
action={pt("Video seek")}
shortcut={formattedListJoin([ut("←"), ut("→")])}
/>
)
}
<Shortcut
action={t("zoom")}
shortcut={formattedListJoin([t("mouse_scroll"), t("pinch")])}
@@ -1169,6 +1184,15 @@ const Shortcuts: React.FC<ShortcutsProps> = ({
action={t("pan")}
shortcut={formattedListJoin([ut("W A S D"), t("drag")])}
/>
{
/* TODO(HLS): */
settingsSnapshot().isInternalUser && (
<Shortcut
action={pt("Play, Pause")}
shortcut={ut("Space")}
/>
)
}
<Shortcut action={t("toggle_live")} shortcut={ut("Space")} />
<Shortcut action={t("toggle_audio")} shortcut={ut("M")} />
{haveUser && (

View File

@@ -2,6 +2,7 @@ import { pt } from "ente-base/i18n";
import log from "ente-base/log";
import type { EnteFile } from "ente-media/file";
import { FileType } from "ente-media/file-type";
import { settingsSnapshot } from "ente-new/photos/services/settings";
import "hls-video-element";
import { t } from "i18next";
import "media-chrome";
@@ -202,6 +203,9 @@ export class FileViewerPhotoSwipe {
onDownload,
onMore,
}: FileViewerPhotoSwipeOptions) {
// TODO(HLS):
const showPlayerV2 = settingsSnapshot().isInternalUser;
const pswp = new PhotoSwipe({
// Opaque background.
bgOpacity: 1,
@@ -336,11 +340,7 @@ export class FileViewerPhotoSwipe {
html: hlsVideoHTML(videoPlaylistURL, mcID),
mediaControllerID: mcID,
};
} else if (
videoURL &&
// TODO(HLS):
process.env.NEXT_PUBLIC_ENTE_WIP_VIDEO_STREAMING
) {
} else if (videoURL && showPlayerV2) {
const mcID = `ente-mc-orig-${file.id}`;
return {
...itemData,
@@ -522,7 +522,7 @@ export class FileViewerPhotoSwipe {
}
// TODO(HLS): Temporary gate
if (!process.env.NEXT_PUBLIC_ENTE_WIP_VIDEO_STREAMING) return;
if (!showPlayerV2) return;
const qualityMenu = container?.querySelector("#ente-quality-menu");
if (qualityMenu instanceof MediaChromeMenu) {
@@ -767,7 +767,7 @@ export class FileViewerPhotoSwipe {
video.muted = !video.muted;
// TODO(HLS): Temporary gate
if (!process.env.NEXT_PUBLIC_ENTE_WIP_VIDEO_STREAMING) return;
if (!showPlayerV2) return;
// Go via the media chrome mute button when muting, because
// otherwise the local storage that the media chrome internally
@@ -1111,9 +1111,7 @@ export class FileViewerPhotoSwipe {
const handleSeekBackOrPreviousSlide = () => {
// TODO(HLS): Behind temporary flag
// const vid = videoVideoEl;
const vid = process.env.NEXT_PUBLIC_ENTE_WIP_VIDEO_STREAMING
? videoVideoEl
: undefined;
const vid = showPlayerV2 ? videoVideoEl : undefined;
if (vid) {
vid.currentTime = Math.max(vid.currentTime - 5, 0);
} else {
@@ -1124,9 +1122,7 @@ export class FileViewerPhotoSwipe {
const handleSeekForwardOrNextSlide = () => {
// TODO(HLS): Behind temporary flag
// const vid = videoVideoEl;
const vid = process.env.NEXT_PUBLIC_ENTE_WIP_VIDEO_STREAMING
? videoVideoEl
: undefined;
const vid = showPlayerV2 ? videoVideoEl : undefined;
if (vid) {
vid.currentTime = vid.currentTime + 5;
} else {