@prozilla-os/media-viewer 1.1.17 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -40,7 +40,7 @@ function g({ file: e, close: t, setTitle: s }) {
|
|
|
40
40
|
] }) }) : /* @__PURE__ */ r("div", { className: n.MediaViewer, children: /* @__PURE__ */ r("img", { src: e.source, alt: e.id, draggable: "false" }) });
|
|
41
41
|
}
|
|
42
42
|
const S = new h("Media Viewer", "media-viewer", g).setIconUrl("https://os.prozilla.dev/assets/apps/icons/media-viewer.svg").setRole(m.APP_ROLES.mediaViewer).setAssociatedExtensions(V).setCategory("Photo & video");
|
|
43
|
-
S.setMetadata({ name: "@prozilla-os/media-viewer", version: "1.1.
|
|
43
|
+
S.setMetadata({ name: "@prozilla-os/media-viewer", version: "1.1.17", author: "Prozilla" });
|
|
44
44
|
export {
|
|
45
45
|
S as mediaViewer
|
|
46
46
|
};
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../src/components/MediaViewer.tsx","../src/main.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport styles from \"./MediaViewer.module.css\";\nimport { AppsConfig, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS, useSystemManager, useWindowsManager, VirtualFile, WindowProps, MEDIA_EXTENSIONS } from \"@prozilla-os/core\";\n\nexport interface MediaViewerProps extends WindowProps {\n\tfile?: VirtualFile;\n}\n\nexport function MediaViewer({ file, close, setTitle }: MediaViewerProps) {\n\tconst { appsConfig } = useSystemManager();\n\tconst windowsManager = useWindowsManager();\n\tconst audioRef = useRef<HTMLAudioElement | null>(null);\n\tconst videoRef = useRef<HTMLVideoElement | null>(null);\n\n\tuseEffect(() => {\n\t\tif (file != null)\n\t\t\tsetTitle?.(file.id);\n\t}, [file, setTitle]);\n\n\tuseEffect(() => {\n\t\tif (file == null || file.source == null)\n\t\t\treturn;\n\n\t\tif (file.extension && AUDIO_EXTENSIONS.includes(file.extension)) {\n\t\t\tif (audioRef.current) {\n\t\t\t\taudioRef.current.src = file.source;\n\t\t\t\tvoid audioRef.current.play();\n\t\t\t}\n\t\t}\n\n\t\tif (file.extension && VIDEO_EXTENSIONS.includes(file.extension)) {\n\t\t\tif (videoRef.current) {\n\t\t\t\tvideoRef.current.src = file.source;\n\t\t\t\tvoid videoRef.current.play();\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (audioRef.current) {\n\t\t\t\taudioRef.current.pause();\n\t\t\t\taudioRef.current.currentTime = 0;\n\t\t\t}\n\t\t\tif (videoRef.current) {\n\t\t\t\tvideoRef.current.pause();\n\t\t\t\tvideoRef.current.currentTime = 0;\n\t\t\t}\n\t\t};\n\t}, [file]);\n\n\tif (file == null) {\n\t\tconst fileExplorerApp = appsConfig.getAppByRole(AppsConfig.APP_ROLES.fileExplorer);\n\n\t\tsetTimeout(() => {\n\t\t\tif (fileExplorerApp != null)\n\t\t\t\twindowsManager?.open(fileExplorerApp.id, { path: \"~/Pictures\" });\n\t\t\tclose?.();\n\t\t}, 10);\n\t\treturn null;\n\t}\n\n\tif (file.extension == null || !MEDIA_EXTENSIONS.includes(file.extension)) {\n\t\treturn <p>Invalid file format.</p>;\n\t}\n\n\tif (file.source == null)\n\t\treturn <p>File failed to load.</p>;\n\n\tif (IMAGE_EXTENSIONS.includes(file.extension)) {\n\t\treturn <div className={styles.MediaViewer}>\n\t\t\t<img src={file.source} alt={file.id} draggable=\"false\" />\n\t\t</div>;\n\t} else if (AUDIO_EXTENSIONS.includes(file.extension)) {\n\t\treturn <div className={styles.AudioViewer}>\n\t\t\t<audio ref={audioRef} controls>\n\t\t\t\t<source src={file.source} type={`video/${file.extension}`}/>\n\t\t\t\tYour browser does not support audio.\n\t\t\t</audio> \n\t\t</div>;\n\t} else if (VIDEO_EXTENSIONS.includes(file.extension)) {\n\t\tif (file.extension === \"yt\") {\n\t\t\treturn <div className={styles.VideoViewer}>\n\t\t\t\t<iframe\n\t\t\t\t\tsrc={file.source.replace(\"watch?v=\", \"embed/\")}\n\t\t\t\t\ttitle={file.id}\n\t\t\t\t\tallow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n\t\t\t\t\tallowFullScreen\n\t\t\t\t\tallowTransparency={true}\n\t\t\t\t/>\n\t\t\t</div>;\n\t\t} else {\n\t\t\treturn <div className={styles.VideoViewer}>\n\t\t\t\t<video ref={videoRef} controls className={styles.VideoPlayer}>\n\t\t\t\t\t<source src={file.source} type={`video/${file.extension}`} />\n\t\t\t\t\tYour browser does not support videos.\n\t\t\t\t</video>\n\t\t\t</div>;\n\t\t}\n\t}\n\n\treturn <div className={styles.MediaViewer}>\n\t\t<img src={file.source} alt={file.id} draggable=\"false\"/>\n\t</div>;\n}","import { App, AppsConfig, MEDIA_EXTENSIONS } from \"@prozilla-os/core\";\nimport { MediaViewer, MediaViewerProps } from \"./components/MediaViewer\";\n\nconst mediaViewer = new App<MediaViewerProps>(\"Media Viewer\", \"media-viewer\", MediaViewer)\n\t.setIconUrl(\"https://os.prozilla.dev/assets/apps/icons/media-viewer.svg\")\n\t.setRole(AppsConfig.APP_ROLES.mediaViewer)\n\t.setAssociatedExtensions(MEDIA_EXTENSIONS)\n\t.setCategory(\"Photo & video\");\nmediaViewer.setMetadata({ name: \"@prozilla-os/media-viewer\", version: \"1.1.
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/components/MediaViewer.tsx","../src/main.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport styles from \"./MediaViewer.module.css\";\nimport { AppsConfig, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS, useSystemManager, useWindowsManager, VirtualFile, WindowProps, MEDIA_EXTENSIONS } from \"@prozilla-os/core\";\n\nexport interface MediaViewerProps extends WindowProps {\n\tfile?: VirtualFile;\n}\n\nexport function MediaViewer({ file, close, setTitle }: MediaViewerProps) {\n\tconst { appsConfig } = useSystemManager();\n\tconst windowsManager = useWindowsManager();\n\tconst audioRef = useRef<HTMLAudioElement | null>(null);\n\tconst videoRef = useRef<HTMLVideoElement | null>(null);\n\n\tuseEffect(() => {\n\t\tif (file != null)\n\t\t\tsetTitle?.(file.id);\n\t}, [file, setTitle]);\n\n\tuseEffect(() => {\n\t\tif (file == null || file.source == null)\n\t\t\treturn;\n\n\t\tif (file.extension && AUDIO_EXTENSIONS.includes(file.extension)) {\n\t\t\tif (audioRef.current) {\n\t\t\t\taudioRef.current.src = file.source;\n\t\t\t\tvoid audioRef.current.play();\n\t\t\t}\n\t\t}\n\n\t\tif (file.extension && VIDEO_EXTENSIONS.includes(file.extension)) {\n\t\t\tif (videoRef.current) {\n\t\t\t\tvideoRef.current.src = file.source;\n\t\t\t\tvoid videoRef.current.play();\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (audioRef.current) {\n\t\t\t\taudioRef.current.pause();\n\t\t\t\taudioRef.current.currentTime = 0;\n\t\t\t}\n\t\t\tif (videoRef.current) {\n\t\t\t\tvideoRef.current.pause();\n\t\t\t\tvideoRef.current.currentTime = 0;\n\t\t\t}\n\t\t};\n\t}, [file]);\n\n\tif (file == null) {\n\t\tconst fileExplorerApp = appsConfig.getAppByRole(AppsConfig.APP_ROLES.fileExplorer);\n\n\t\tsetTimeout(() => {\n\t\t\tif (fileExplorerApp != null)\n\t\t\t\twindowsManager?.open(fileExplorerApp.id, { path: \"~/Pictures\" });\n\t\t\tclose?.();\n\t\t}, 10);\n\t\treturn null;\n\t}\n\n\tif (file.extension == null || !MEDIA_EXTENSIONS.includes(file.extension)) {\n\t\treturn <p>Invalid file format.</p>;\n\t}\n\n\tif (file.source == null)\n\t\treturn <p>File failed to load.</p>;\n\n\tif (IMAGE_EXTENSIONS.includes(file.extension)) {\n\t\treturn <div className={styles.MediaViewer}>\n\t\t\t<img src={file.source} alt={file.id} draggable=\"false\" />\n\t\t</div>;\n\t} else if (AUDIO_EXTENSIONS.includes(file.extension)) {\n\t\treturn <div className={styles.AudioViewer}>\n\t\t\t<audio ref={audioRef} controls>\n\t\t\t\t<source src={file.source} type={`video/${file.extension}`}/>\n\t\t\t\tYour browser does not support audio.\n\t\t\t</audio> \n\t\t</div>;\n\t} else if (VIDEO_EXTENSIONS.includes(file.extension)) {\n\t\tif (file.extension === \"yt\") {\n\t\t\treturn <div className={styles.VideoViewer}>\n\t\t\t\t<iframe\n\t\t\t\t\tsrc={file.source.replace(\"watch?v=\", \"embed/\")}\n\t\t\t\t\ttitle={file.id}\n\t\t\t\t\tallow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n\t\t\t\t\tallowFullScreen\n\t\t\t\t\tallowTransparency={true}\n\t\t\t\t/>\n\t\t\t</div>;\n\t\t} else {\n\t\t\treturn <div className={styles.VideoViewer}>\n\t\t\t\t<video ref={videoRef} controls className={styles.VideoPlayer}>\n\t\t\t\t\t<source src={file.source} type={`video/${file.extension}`} />\n\t\t\t\t\tYour browser does not support videos.\n\t\t\t\t</video>\n\t\t\t</div>;\n\t\t}\n\t}\n\n\treturn <div className={styles.MediaViewer}>\n\t\t<img src={file.source} alt={file.id} draggable=\"false\"/>\n\t</div>;\n}","import { App, AppsConfig, MEDIA_EXTENSIONS } from \"@prozilla-os/core\";\nimport { MediaViewer, MediaViewerProps } from \"./components/MediaViewer\";\n\nconst mediaViewer = new App<MediaViewerProps>(\"Media Viewer\", \"media-viewer\", MediaViewer)\n\t.setIconUrl(\"https://os.prozilla.dev/assets/apps/icons/media-viewer.svg\")\n\t.setRole(AppsConfig.APP_ROLES.mediaViewer)\n\t.setAssociatedExtensions(MEDIA_EXTENSIONS)\n\t.setCategory(\"Photo & video\");\nmediaViewer.setMetadata({ name: \"@prozilla-os/media-viewer\", version: \"1.1.17\", author: \"Prozilla\" });\n\n\nexport { mediaViewer };"],"names":["MediaViewer","file","close","setTitle","appsConfig","useSystemManager","windowsManager","useWindowsManager","audioRef","useRef","videoRef","useEffect","AUDIO_EXTENSIONS","VIDEO_EXTENSIONS","fileExplorerApp","AppsConfig","MEDIA_EXTENSIONS","jsx","IMAGE_EXTENSIONS","styles","jsxs","mediaViewer","App"],"mappings":";;;;;;;;AAQO,SAASA,EAAY,EAAE,MAAAC,GAAM,OAAAC,GAAO,UAAAC,KAA8B;AAClE,QAAA,EAAE,YAAAC,MAAeC,KACjBC,IAAiBC,KACjBC,IAAWC,EAAgC,IAAI,GAC/CC,IAAWD,EAAgC,IAAI;AAqCrD,MAnCAE,EAAU,MAAM;AACf,IAAIV,KAAQ,SACXE,KAAA,QAAAA,EAAWF,EAAK;AAAA,EAAE,GACjB,CAACA,GAAME,CAAQ,CAAC,GAEnBQ,EAAU,MAAM;AACX,QAAA,EAAAV,KAAQ,QAAQA,EAAK,UAAU;AAGnC,aAAIA,EAAK,aAAaW,EAAiB,SAASX,EAAK,SAAS,KACzDO,EAAS,YACHA,EAAA,QAAQ,MAAMP,EAAK,QACvBO,EAAS,QAAQ,SAIpBP,EAAK,aAAaY,EAAiB,SAASZ,EAAK,SAAS,KACzDS,EAAS,YACHA,EAAA,QAAQ,MAAMT,EAAK,QACvBS,EAAS,QAAQ,SAIjB,MAAM;AACZ,QAAIF,EAAS,YACZA,EAAS,QAAQ,SACjBA,EAAS,QAAQ,cAAc,IAE5BE,EAAS,YACZA,EAAS,QAAQ,SACjBA,EAAS,QAAQ,cAAc;AAAA,MAChC;AAAA,EACD,GACE,CAACT,CAAI,CAAC,GAELA,KAAQ,MAAM;AACjB,UAAMa,IAAkBV,EAAW,aAAaW,EAAW,UAAU,YAAY;AAEjF,sBAAW,MAAM;AAChB,MAAID,KAAmB,SACtBR,KAAA,QAAAA,EAAgB,KAAKQ,EAAgB,IAAI,EAAE,MAAM,kBAC1CZ,KAAA,QAAAA;AAAA,OACN,EAAE,GACE;AAAA,E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AE9D,CAAA,EACD,CAAA,IAIM,gBAAAgB,EAAA,OAAA,EAAI,WAAWE,EAAO,aAC7B,UAAC,gBAAAF,EAAA,OAAA,EAAI,KAAKhB,EAAK,QAAQ,KAAKA,EAAK,IAAI,WAAU,SAAO,EACvD,CAAA;AACD;ACnGA,MAAMoB,IAAc,IAAIC,EAAsB,gBAAgB,gBAAgBtB,CAAW,EACvF,WAAW,4DAA4D,EACvE,QAAQe,EAAW,UAAU,WAAW,EACxC,wBAAwBC,CAAgB,EACxC,YAAY,eAAe;AAC7BK,EAAY,YAAY,EAAE,MAAM,6BAA6B,SAAS,UAAU,QAAQ,YAAY;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prozilla-os/media-viewer",
|
|
3
3
|
"description": "A ProzillaOS application for viewing different kinds of media.",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.18",
|
|
5
5
|
"homepage": "https://os.prozilla.dev/media-viewer",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Prozilla",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"react": "^18.3.1",
|
|
23
|
-
"@prozilla-os/core": "1.3.
|
|
23
|
+
"@prozilla-os/core": "1.3.13"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^20.14.5",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"vite": "^5.4.8",
|
|
31
31
|
"vite-plugin-dts": "^3.9.1",
|
|
32
32
|
"vite-plugin-lib-inject-css": "^2.1.1",
|
|
33
|
-
"@prozilla-os/dev-tools": "1.1.
|
|
33
|
+
"@prozilla-os/dev-tools": "1.1.10"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist"
|