fix: audio player not playing audio

This commit is contained in:
Prayag Prajapati committed 2024-11-16 11:22:16 +05:30
1 parent 24e07df249
commit 500a90bcc0
14 files changed
+432 -435

No files matched your search

+17 -41
View File
@@ -9,56 +9,34 @@
<style> <style>
.app-loading { .app-loading {
position: fixed; position: fixed;
top: 0; top: 50%;
left: 0; left: 50%;
bottom: 0; transform: translate(-50%,-50%);
right: 0; width: 10em;
background: #fff; height: 10em;
background: rgb(180 180 180);
z-index: 100000; z-index: 100000;
display: flex; mask-image: url("./src/assets/icon-outline.png");
align-items: center; mask-size: contain;
justify-content: center;
flex-direction: column;
transition: opacity 0.25s ease-in-out;
opacity: 0;
animation: fadeIn linear 500ms forwards;
} }
.app-loading.hidden { .app-loading.hidden {
display: none; display: none;
} }
.app-loading-logo {
width: 5vw;
}
.app-loading-bar-container{ .app-loading-anim{
height: 2px; width: 150%;
width: 16vw;
position: absolute;
left: 50%;
bottom: 36vh;
transform: translateX(-50%);
overflow: hidden;
}
.app-loading-bar{
width: 100%;
height: 100%; height: 100%;
background: #101010; position: absolute;
top: 0;
left: 0;
background: linear-gradient(to right,transparent,rgb(255 255 255),transparent);
transform: scaleX(0); transform: scaleX(0);
animation: loading 1s ease-in-out infinite both; animation: loading 0.75s linear infinite both;
transform-origin: left; transform-origin: left;
} }
@keyframes fadeIn {
0%{
opacity: 0;
}
100%{
opacity: 1;
}
}
@keyframes loading { @keyframes loading {
0%{ 0%{
transform: translate(-100%); transform: translate(-100%);
@@ -75,10 +53,8 @@
<body> <body>
<div class="app-loading"> <div class="app-loading">
<img src="./src/assets/icon-outline.svg" class="app-loading-logo" /> <!-- <img src="./src/assets/icon-outline.svg" class="app-loading-logo" /> -->
<div class="app-loading-bar-container"> <div class="app-loading-anim"></div>
<div class="app-loading-bar"></div>
</div>
</div> </div>
<div id="root"></div> <div id="root"></div>
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false"> <svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
+145 -126
View File
@@ -200,9 +200,9 @@ dependencies = [
[[package]] [[package]]
name = "async-io" name = "async-io"
version = "2.3.4" version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059"
dependencies = [ dependencies = [
"async-lock", "async-lock",
"cfg-if", "cfg-if",
@@ -569,7 +569,7 @@ dependencies = [
"glib", "glib",
"libc", "libc",
"once_cell", "once_cell",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -612,7 +612,7 @@ dependencies = [
"semver", "semver",
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -627,9 +627,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.1.36" version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baee610e9452a8f6f0a1b6194ec09ff9e2d85dea54432acdae41aa0761c95d70" checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47"
dependencies = [ dependencies = [
"shlex", "shlex",
] ]
@@ -778,6 +778,16 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "cookie"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
dependencies = [
"time",
"version_check",
]
[[package]] [[package]]
name = "core-foundation" name = "core-foundation"
version = "0.9.4" version = "0.9.4"
@@ -854,9 +864,9 @@ dependencies = [
[[package]] [[package]]
name = "cpufeatures" name = "cpufeatures"
version = "0.2.14" version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6"
dependencies = [ dependencies = [
"libc", "libc",
] ]
@@ -1188,9 +1198,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]] [[package]]
name = "embed-resource" name = "embed-resource"
version = "2.5.0" version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4e24052d7be71f0efb50c201557f6fe7d237cfd5a64fd5bcd7fd8fe32dbbffa" checksum = "b68b6f9f63a0b6a38bc447d4ce84e2b388f3ec95c99c641c8ff0dd3ef89a6379"
dependencies = [ dependencies = [
"cc", "cc",
"memchr", "memchr",
@@ -1313,9 +1323,9 @@ dependencies = [
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.1.1" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4"
[[package]] [[package]]
name = "fdeflate" name = "fdeflate"
@@ -1360,23 +1370,14 @@ dependencies = [
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.34" version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"miniz_oxide", "miniz_oxide",
] ]
[[package]]
name = "fluent-uri"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17c704e9dbe1ddd863da1e6ff3567795087b1eb201ce80d8fa81162e1516500d"
dependencies = [
"bitflags 1.3.2",
]
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"
@@ -1485,9 +1486,9 @@ checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]] [[package]]
name = "futures-lite" name = "futures-lite"
version = "2.4.0" version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f1fa2f9765705486b33fd2acf1577f8ec449c2ba1f318ae5447697b7c08d210" checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1"
dependencies = [ dependencies = [
"fastrand", "fastrand",
"futures-core", "futures-core",
@@ -1683,8 +1684,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys",
"libc", "libc",
"wasi 0.11.0+wasi-snapshot-preview1", "wasi 0.11.0+wasi-snapshot-preview1",
"wasm-bindgen",
] ]
[[package]] [[package]]
@@ -1719,7 +1722,7 @@ dependencies = [
"once_cell", "once_cell",
"pin-project-lite", "pin-project-lite",
"smallvec", "smallvec",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -1755,7 +1758,7 @@ dependencies = [
"memchr", "memchr",
"once_cell", "once_cell",
"smallvec", "smallvec",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -2323,7 +2326,7 @@ dependencies = [
"combine", "combine",
"jni-sys", "jni-sys",
"log", "log",
"thiserror", "thiserror 1.0.69",
"walkdir", "walkdir",
"windows-sys 0.45.0", "windows-sys 0.45.0",
] ]
@@ -2352,39 +2355,16 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "json-patch"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b1fb8864823fad91877e6caea0baca82e49e8db50f8e5c9f9a453e27d3330fc"
dependencies = [
"jsonptr 0.4.7",
"serde",
"serde_json",
"thiserror",
]
[[package]] [[package]]
name = "json-patch" name = "json-patch"
version = "3.0.1" version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08"
dependencies = [ dependencies = [
"jsonptr 0.6.3", "jsonptr",
"serde",
"serde_json",
"thiserror",
]
[[package]]
name = "jsonptr"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c6e529149475ca0b2820835d3dce8fcc41c6b943ca608d32f35b449255e4627"
dependencies = [
"fluent-uri",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -2638,7 +2618,7 @@ dependencies = [
"once_cell", "once_cell",
"png", "png",
"serde", "serde",
"thiserror", "thiserror 1.0.69",
"windows-sys 0.59.0", "windows-sys 0.59.0",
] ]
@@ -2654,7 +2634,7 @@ dependencies = [
"ndk-sys", "ndk-sys",
"num_enum", "num_enum",
"raw-window-handle", "raw-window-handle",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -3284,9 +3264,9 @@ dependencies = [
[[package]] [[package]]
name = "polling" name = "polling"
version = "3.7.3" version = "3.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"concurrent-queue", "concurrent-queue",
@@ -3444,9 +3424,9 @@ dependencies = [
[[package]] [[package]]
name = "quinn" name = "quinn"
version = "0.11.5" version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef"
dependencies = [ dependencies = [
"bytes", "bytes",
"pin-project-lite", "pin-project-lite",
@@ -3455,26 +3435,29 @@ dependencies = [
"rustc-hash", "rustc-hash",
"rustls", "rustls",
"socket2", "socket2",
"thiserror", "thiserror 2.0.3",
"tokio", "tokio",
"tracing", "tracing",
] ]
[[package]] [[package]]
name = "quinn-proto" name = "quinn-proto"
version = "0.11.8" version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d"
dependencies = [ dependencies = [
"bytes", "bytes",
"getrandom 0.2.15",
"rand 0.8.5", "rand 0.8.5",
"ring", "ring",
"rustc-hash", "rustc-hash",
"rustls", "rustls",
"rustls-pki-types",
"slab", "slab",
"thiserror", "thiserror 2.0.3",
"tinyvec", "tinyvec",
"tracing", "tracing",
"web-time",
] ]
[[package]] [[package]]
@@ -3641,7 +3624,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
dependencies = [ dependencies = [
"getrandom 0.2.15", "getrandom 0.2.15",
"libredox", "libredox",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -3658,9 +3641,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.4.8" version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -3832,9 +3815,9 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.39" version = "0.38.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"errno", "errno",
@@ -3871,6 +3854,9 @@ name = "rustls-pki-types"
version = "1.10.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
dependencies = [
"web-time",
]
[[package]] [[package]]
name = "rustls-webpki" name = "rustls-webpki"
@@ -3974,9 +3960,9 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.214" version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@@ -3994,9 +3980,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.214" version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -4384,9 +4370,9 @@ dependencies = [
[[package]] [[package]]
name = "tao" name = "tao"
version = "0.30.5" version = "0.30.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63f1f6b2017cc33d7f6fc9c6186a2c0f5dfc985899a7b4fe9e64985c17533db3" checksum = "6682a07cf5bab0b8a2bd20d0a542917ab928b5edb75ebd4eda6b05cbaab872da"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"cocoa", "cocoa",
@@ -4457,9 +4443,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "2.0.6" version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3889b392db6d32a105d3757230ea0220090b8f94c90d3e60b6c5eb91178ab1b" checksum = "e545de0a2dfe296fa67db208266cd397c5a55ae782da77973ef4c4fac90e9f2c"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -4494,7 +4480,7 @@ dependencies = [
"tauri-runtime", "tauri-runtime",
"tauri-runtime-wry", "tauri-runtime-wry",
"tauri-utils", "tauri-utils",
"thiserror", "thiserror 2.0.3",
"tokio", "tokio",
"tray-icon", "tray-icon",
"url", "url",
@@ -4507,16 +4493,16 @@ dependencies = [
[[package]] [[package]]
name = "tauri-build" name = "tauri-build"
version = "2.0.2" version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f96827ccfb1aa40d55d0ded79562d18ba18566657a553f992a982d755148376" checksum = "7bd2a4bcfaf5fb9f4be72520eefcb61ae565038f8ccba2a497d8c28f463b8c01"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml", "cargo_toml",
"dirs", "dirs",
"glob", "glob",
"heck 0.5.0", "heck 0.5.0",
"json-patch 3.0.1", "json-patch",
"schemars", "schemars",
"semver", "semver",
"serde", "serde",
@@ -4529,14 +4515,14 @@ dependencies = [
[[package]] [[package]]
name = "tauri-codegen" name = "tauri-codegen"
version = "2.0.2" version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8947f16f47becd9e9cd39b74ee337fd1981574d78819be18e4384d85e5a0b82f" checksum = "bf79faeecf301d3e969b1fae977039edb77a4c1f25cc0a961be298b54bff97cf"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"brotli", "brotli",
"ico", "ico",
"json-patch 2.0.0", "json-patch",
"plist", "plist",
"png", "png",
"proc-macro2", "proc-macro2",
@@ -4547,7 +4533,7 @@ dependencies = [
"sha2", "sha2",
"syn 2.0.87", "syn 2.0.87",
"tauri-utils", "tauri-utils",
"thiserror", "thiserror 2.0.3",
"time", "time",
"url", "url",
"uuid", "uuid",
@@ -4556,9 +4542,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-macros" name = "tauri-macros"
version = "2.0.2" version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bd1c8d4a66799d3438747c3a79705cd665a95d6f24cb5f315413ff7a981fe2a" checksum = "c52027c8c5afb83166dacddc092ee8fff50772f9646d461d8c33ee887e447a03"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@@ -4570,9 +4556,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin" name = "tauri-plugin"
version = "2.0.2" version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fa4e6c94cb1d635f65a770c69e23de1bc054b0e4c554fa037a7cc7676333d39" checksum = "e753f2a30933a9bbf0a202fa47d7cc4a3401f06e8d6dcc53b79aa62954828c79"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"glob", "glob",
@@ -4598,7 +4584,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -4615,7 +4601,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-plugin-fs", "tauri-plugin-fs",
"thiserror", "thiserror 1.0.69",
"url", "url",
] ]
@@ -4635,7 +4621,7 @@ dependencies = [
"serde_repr", "serde_repr",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror", "thiserror 1.0.69",
"url", "url",
"uuid", "uuid",
] ]
@@ -4643,21 +4629,21 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-localhost" name = "tauri-plugin-localhost"
version = "2.0.1" version = "2.0.1"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#3449dd5a8f6d12fee8d6389c034fe47e19d72bcd" source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f025e5240a3739263427647177e678a83543f9f"
dependencies = [ dependencies = [
"http", "http",
"log", "log",
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"thiserror", "thiserror 2.0.3",
"tiny_http", "tiny_http",
] ]
[[package]] [[package]]
name = "tauri-plugin-log" name = "tauri-plugin-log"
version = "2.0.2" version = "2.0.2"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#3449dd5a8f6d12fee8d6389c034fe47e19d72bcd" source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f025e5240a3739263427647177e678a83543f9f"
dependencies = [ dependencies = [
"android_logger", "android_logger",
"byte-unit", "byte-unit",
@@ -4671,7 +4657,7 @@ dependencies = [
"swift-rs", "swift-rs",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror", "thiserror 2.0.3",
"time", "time",
] ]
@@ -4689,7 +4675,7 @@ dependencies = [
"serde_repr", "serde_repr",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror", "thiserror 1.0.69",
"time", "time",
"url", "url",
] ]
@@ -4697,7 +4683,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-process" name = "tauri-plugin-process"
version = "2.0.1" version = "2.0.1"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#3449dd5a8f6d12fee8d6389c034fe47e19d72bcd" source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f025e5240a3739263427647177e678a83543f9f"
dependencies = [ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
@@ -4706,7 +4692,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-store" name = "tauri-plugin-store"
version = "2.1.0" version = "2.1.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#3449dd5a8f6d12fee8d6389c034fe47e19d72bcd" source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f025e5240a3739263427647177e678a83543f9f"
dependencies = [ dependencies = [
"dunce", "dunce",
"log", "log",
@@ -4714,14 +4700,14 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror", "thiserror 2.0.3",
"tokio", "tokio",
] ]
[[package]] [[package]]
name = "tauri-plugin-updater" name = "tauri-plugin-updater"
version = "2.0.2" version = "2.0.2"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#3449dd5a8f6d12fee8d6389c034fe47e19d72bcd" source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f025e5240a3739263427647177e678a83543f9f"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"dirs", "dirs",
@@ -4739,7 +4725,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tempfile", "tempfile",
"thiserror", "thiserror 2.0.3",
"time", "time",
"tokio", "tokio",
"url", "url",
@@ -4761,7 +4747,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror", "thiserror 1.0.69",
"tokio", "tokio",
"tokio-util", "tokio-util",
] ]
@@ -4769,7 +4755,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-window-state" name = "tauri-plugin-window-state"
version = "2.0.2" version = "2.0.2"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#3449dd5a8f6d12fee8d6389c034fe47e19d72bcd" source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f025e5240a3739263427647177e678a83543f9f"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"log", "log",
@@ -4777,14 +4763,14 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror", "thiserror 2.0.3",
] ]
[[package]] [[package]]
name = "tauri-runtime" name = "tauri-runtime"
version = "2.1.1" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1ef7363e7229ac8d04e8a5d405670dbd43dde8fc4bc3bc56105c35452d03784" checksum = "cce18d43f80d4aba3aa8a0c953bbe835f3d0f2370aca75e8dbb14bd4bab27958"
dependencies = [ dependencies = [
"dpi", "dpi",
"gtk", "gtk",
@@ -4794,16 +4780,16 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri-utils", "tauri-utils",
"thiserror", "thiserror 2.0.3",
"url", "url",
"windows 0.58.0", "windows 0.58.0",
] ]
[[package]] [[package]]
name = "tauri-runtime-wry" name = "tauri-runtime-wry"
version = "2.1.2" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62fa2068e8498ad007b54d5773d03d57c3ff6dd96f8c8ce58beff44d0d5e0d30" checksum = "9f442a38863e10129ffe2cec7bd09c2dcf8a098a3a27801a476a304d5bb991d2"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
@@ -4827,9 +4813,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-utils" name = "tauri-utils"
version = "2.0.2" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fc65d6f5c54e56b66258948a6d9e47a82ea41f4b5a7612bfbdd1634c2913ed0" checksum = "9271a88f99b4adea0dc71d0baca4505475a0bbd139fb135f62958721aaa8fe54"
dependencies = [ dependencies = [
"brotli", "brotli",
"cargo_metadata", "cargo_metadata",
@@ -4837,8 +4823,9 @@ dependencies = [
"dunce", "dunce",
"glob", "glob",
"html5ever", "html5ever",
"http",
"infer", "infer",
"json-patch 2.0.0", "json-patch",
"kuchikiki", "kuchikiki",
"log", "log",
"memchr", "memchr",
@@ -4853,7 +4840,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_with", "serde_with",
"swift-rs", "swift-rs",
"thiserror", "thiserror 2.0.3",
"toml 0.8.2", "toml 0.8.2",
"url", "url",
"urlpattern", "urlpattern",
@@ -4884,9 +4871,9 @@ dependencies = [
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.13.0" version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",
@@ -4914,18 +4901,38 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.68" version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl 1.0.69",
]
[[package]]
name = "thiserror"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa"
dependencies = [
"thiserror-impl 2.0.3",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.68" version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.87",
]
[[package]]
name = "thiserror-impl"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -5179,7 +5186,7 @@ dependencies = [
"once_cell", "once_cell",
"png", "png",
"serde", "serde",
"thiserror", "thiserror 1.0.69",
"windows-sys 0.59.0", "windows-sys 0.59.0",
] ]
@@ -5548,6 +5555,16 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "web-time"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]] [[package]]
name = "webkit2gtk" name = "webkit2gtk"
version = "2.0.1" version = "2.0.1"
@@ -5632,7 +5649,7 @@ version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3a3e2eeb58f82361c93f9777014668eb3d07e7d174ee4c819575a9208011886" checksum = "a3a3e2eeb58f82361c93f9777014668eb3d07e7d174ee4c819575a9208011886"
dependencies = [ dependencies = [
"thiserror", "thiserror 1.0.69",
"windows 0.58.0", "windows 0.58.0",
"windows-core 0.58.0", "windows-core 0.58.0",
] ]
@@ -6081,12 +6098,13 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]] [[package]]
name = "wry" name = "wry"
version = "0.46.3" version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd5cdf57c66813d97601181349c63b96994b3074fc3d7a31a8cce96e968e3bbd" checksum = "553ca1ce149982123962fac2506aa75b8b76288779a77e72b12fa2fc34938647"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"block2", "block2",
"cookie",
"crossbeam-channel", "crossbeam-channel",
"dpi", "dpi",
"dunce", "dunce",
@@ -6110,7 +6128,8 @@ dependencies = [
"sha2", "sha2",
"soup3", "soup3",
"tao-macros", "tao-macros",
"thiserror", "thiserror 1.0.69",
"url",
"webkit2gtk", "webkit2gtk",
"webkit2gtk-sys", "webkit2gtk-sys",
"webview2-com", "webview2-com",
@@ -6359,7 +6378,7 @@ dependencies = [
"displaydoc", "displaydoc",
"indexmap 2.6.0", "indexmap 2.6.0",
"memchr", "memchr",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
+1 -1
View File
@@ -84,7 +84,7 @@
} }
}, },
"permissions": { "permissions": {
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ```", "description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ] ```",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/PermissionEntry" "$ref": "#/definitions/PermissionEntry"
+1 -1
View File
@@ -84,7 +84,7 @@
} }
}, },
"permissions": { "permissions": {
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ```", "description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ] ```",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/PermissionEntry" "$ref": "#/definitions/PermissionEntry"
+3 -8
View File
@@ -47,13 +47,7 @@
}, },
"resources": [], "resources": [],
"shortDescription": "Blink", "shortDescription": "Blink",
"targets": [ "targets": ["deb", "appimage", "nsis", "app", "dmg"],
"deb",
"appimage",
"nsis",
"app",
"dmg"
],
"licenseFile": "../LICENSE", "licenseFile": "../LICENSE",
"createUpdaterArtifacts": "v1Compatible" "createUpdaterArtifacts": "v1Compatible"
}, },
@@ -79,7 +73,8 @@
"visible": true, "visible": true,
"center": true, "center": true,
"label": "main", "label": "main",
"dragDropEnabled": false "dragDropEnabled": false,
"backgroundColor": "#08001f"
} }
], ],
"security": { "security": {
Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

+2 -2
View File
@@ -1,3 +1,3 @@
<svg width="1310" height="1512" viewBox="0 0 1310 1512" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="1512" height="1512" viewBox="0 0 1512 1512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M654.715 756L52 1103.98L654.715 1451.96L1257.43 1103.98V408.022L654.715 60.0444L52 408.022L654.715 756ZM654.715 0L1309.43 378V1134L654.715 1512L0 1134V1073.96V438.044V378L654.715 0Z" fill="#101010"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M755.715 756L153 1103.98L755.715 1451.96L1358.43 1103.98V408.022L755.715 60.0444L153 408.022L755.715 756ZM755.715 0L1410.43 378V1134L755.715 1512L101 1134V1073.96V438.044V378L755.715 0Z" fill="white"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 362 B

+37 -25
View File
@@ -9,7 +9,7 @@ import Fab from "@mui/material/Fab";
import LinearProgress from "@mui/material/LinearProgress"; import LinearProgress from "@mui/material/LinearProgress";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { playAudio } from "@/utils/store/audioPlayback"; import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
import { import {
type BaseItemDto, type BaseItemDto,
type BaseItemDtoQueryResult, type BaseItemDtoQueryResult,
@@ -50,22 +50,28 @@ import type { AxiosResponse } from "axios";
type PlayButtonProps = { type PlayButtonProps = {
item: BaseItemDto; item: BaseItemDto;
itemId: string; /**
itemUserData: UserItemDataDto; * @deprecated
*/
itemId?: string;
/**
* @deprecated
*/
itemUserData?: UserItemDataDto;
userId: string | undefined; userId: string | undefined;
itemType: BaseItemKind; itemType: BaseItemKind;
currentAudioTrack: number; currentAudioTrack?: number;
currentVideoTrack: number; currentVideoTrack?: number;
currentSubTrack: number | "nosub"; currentSubTrack?: number | "nosub";
className: string; className?: string;
sx: SxProps; sx?: SxProps;
buttonProps: ButtonProps; buttonProps?: ButtonProps;
iconOnly: boolean; iconOnly?: boolean;
audio: boolean; audio?: boolean;
size: ButtonPropsSizeOverrides; size?: ButtonPropsSizeOverrides;
playlistItem: BaseItemDto; playlistItem?: BaseItemDto;
playlistItemId: string; playlistItemId?: string;
trackIndex: number; trackIndex?: number;
}; };
// Memoized LinearProgress component // Memoized LinearProgress component
@@ -119,7 +125,7 @@ const PlayButton = ({
const { enqueueSnackbar } = useSnackbar(); const { enqueueSnackbar } = useSnackbar();
const itemQuery = useMutation({ const itemQuery = useMutation({
mutationKey: ["playButton", itemId, userId], mutationKey: ["playButton", item?.Id, userId],
mutationFn: async () => { mutationFn: async () => {
setPlaybackDataLoading(true); setPlaybackDataLoading(true);
let result: undefined | AxiosResponse<BaseItemDtoQueryResult, any>; let result: undefined | AxiosResponse<BaseItemDtoQueryResult, any>;
@@ -182,7 +188,7 @@ const PlayButton = ({
break; break;
case BaseItemKind.Series: case BaseItemKind.Series:
result = await getTvShowsApi(api).getEpisodes({ result = await getTvShowsApi(api).getEpisodes({
seriesId: itemId, seriesId: item.Id,
fields: [ fields: [
ItemFields.MediaSources, ItemFields.MediaSources,
ItemFields.MediaStreams, ItemFields.MediaStreams,
@@ -233,7 +239,7 @@ const PlayButton = ({
break; break;
case BaseItemKind.MusicAlbum: case BaseItemKind.MusicAlbum:
result = await getItemsApi(api).getItems({ result = await getItemsApi(api).getItems({
parentId: itemId, parentId: item.Id,
userId: userId, userId: userId,
fields: [ItemFields.MediaSources, ItemFields.MediaStreams], fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
sortOrder: [SortOrder.Ascending], sortOrder: [SortOrder.Ascending],
@@ -242,7 +248,7 @@ const PlayButton = ({
break; break;
case BaseItemKind.MusicArtist: case BaseItemKind.MusicArtist:
result = await getItemsApi(api).getItems({ result = await getItemsApi(api).getItems({
artistIds: [itemId], artistIds: [item.Id],
recursive: true, recursive: true,
includeItemTypes: [BaseItemKind.Audio], includeItemTypes: [BaseItemKind.Audio],
userId: userId, userId: userId,
@@ -253,7 +259,7 @@ const PlayButton = ({
break; break;
case BaseItemKind.BoxSet: case BaseItemKind.BoxSet:
result = await getItemsApi(api).getItems({ result = await getItemsApi(api).getItems({
parentId: itemId, parentId: item.Id,
userId, userId,
fields: [ fields: [
ItemFields.MediaSources, ItemFields.MediaSources,
@@ -285,7 +291,7 @@ const PlayButton = ({
break; break;
default: default:
result = await getItemsApi(api).getItems({ result = await getItemsApi(api).getItems({
ids: [itemId], ids: [item.Id],
userId: userId, userId: userId,
fields: [ fields: [
ItemFields.MediaSources, ItemFields.MediaSources,
@@ -300,7 +306,7 @@ const PlayButton = ({
audioStreamIndex: currentAudioTrack, audioStreamIndex: currentAudioTrack,
subtitleStreamIndex: subtitleStreamIndex:
currentSubTrack === "nosub" ? -1 : currentSubTrack, currentSubTrack === "nosub" ? -1 : currentSubTrack,
itemId: itemId, itemId: item.Id,
startTimeTicks: startTimeTicks:
result.data.Items?.[0].UserData?.PlaybackPositionTicks, result.data.Items?.[0].UserData?.PlaybackPositionTicks,
userId: userId, userId: userId,
@@ -327,9 +333,15 @@ const PlayButton = ({
api_key: api?.accessToken, api_key: api?.accessToken,
}; };
const urlParams = new URLSearchParams(urlOptions).toString(); const urlParams = new URLSearchParams(urlOptions).toString();
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items?.[0].Id}/universal?${urlParams}`; const playbackUrl = generateAudioStreamUrl(
playAudio(playbackUrl, result?.item.Items?.[0], undefined); result?.item?.Items?.[0].Id,
setQueue(result?.item.Items ?? [], 0); userId,
api?.deviceInfo.id,
api.basePath,
api.accessToken,
);
playAudio(playbackUrl, result?.item?.Items?.[0], undefined);
setQueue(result?.item?.Items ?? [], 0);
} else if (item.Type === "Photo") { } else if (item.Type === "Photo") {
const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id); const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id);
if (result?.item?.Items && index) { if (result?.item?.Items && index) {
+38 -159
View File
@@ -57,157 +57,30 @@ const AudioPlayer = () => {
useEffect(() => { useEffect(() => {
if (display) { if (display) {
const audioUrlRequest = new Request(audioRef.current?.dataset.src, { // const audioUrlRequest = new Request(audioRef.current?.dataset.src, {
method: "GET", // method: "GET",
headers: { // headers: {
Authorization: api.authorizationHeader, // Authorization: api.authorizationHeader,
}, // },
});
const currentTrackItem = tracks[currentTrack];
fetch(audioUrlRequest)
.then((res) => res)
.then(async (result) => {
const blob = await result.blob();
const blobUrl = URL.createObjectURL(blob);
audioRef.current.src = blobUrl;
await audioRef.current.play();
if ("mediaSession" in navigator) {
navigator.mediaSession.playbackState = "playing";
navigator.mediaSession.metadata = new MediaMetadata({
title: currentTrackItem.Name ?? "Unknown audio",
artist: currentTrackItem.Artists?.join(", "),
album: currentTrackItem.Album ?? "",
artwork: [
{
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 96,
height: 96,
},
),
sizes: "96x96",
type: "image/jpeg",
},
{
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 128,
height: 128,
},
),
sizes: "128x128",
type: "image/jpeg",
},
{
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 192,
height: 192,
},
),
sizes: "192x192",
type: "image/jpeg",
},
{
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 256,
height: 256,
},
),
sizes: "256x256",
type: "image/jpeg",
},
{
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 384,
height: 384,
},
),
sizes: "384x384",
type: "image/jpeg",
},
{
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 512,
height: 512,
},
),
sizes: "512x512",
type: "image/jpeg",
},
],
});
console.log("Using MediaSession Api");
// navigator.mediaSession.setActionHandler("play", () => {
// /* Code excerpted. */
// }); // });
// navigator.mediaSession.setActionHandler("pause", () => { // fetch(audioUrlRequest)
// /* Code excerpted. */ // .then((res) => res)
// }); // .then(async (result) => {
// navigator.mediaSession.setActionHandler("stop", () => { // const blob = await result.blob();
// /* Code excerpted. */ // const blobUrl = URL.createObjectURL(blob);
// }); // audioRef.current.src = blobUrl;
// navigator.mediaSession.setActionHandler("seekbackward", () => { // await audioRef.current.play();
// /* Code excerpted. */ // setLoading(false);
// });
// navigator.mediaSession.setActionHandler("seekforward", () => {
// /* Code excerpted. */
// });
// navigator.mediaSession.setActionHandler("seekto", () => {
// /* Code excerpted. */
// });
// navigator.mediaSession.setActionHandler("previoustrack", () => {
// /* Code excerpted. */
// });
// navigator.mediaSession.setActionHandler("nexttrack", () => {
// /* Code excerpted. */
// });
// navigator.mediaSession.setActionHandler("skipad", () => {
// /* Code excerpted. */
// });
// navigator.mediaSession.setActionHandler("togglecamera", () => {
// /* Code excerpted. */
// });
// navigator.mediaSession.setActionHandler("togglemicrophone", () => {
// /* Code excerpted. */
// });
// navigator.mediaSession.setActionHandler("hangup", () => {
// /* Code excerpted. */
// }); // });
// setAudioRef(audioRef);
} }
setLoading(false); }, [url, tracks?.[currentTrack]?.Id]);
});
setAudioRef(audioRef);
}
}, [url, tracks[currentTrack]?.Id]);
const navigate = useNavigate(); const navigate = useNavigate();
const info = useMemo( const info = useMemo(
() => ( () =>
!!api?.configuration && (
<div <div
// initial={{ // initial={{
// filter: "opacity(0)", // filter: "opacity(0)",
@@ -222,20 +95,17 @@ const AudioPlayer = () => {
> >
<div className="audio-player-image-container"> <div className="audio-player-image-container">
<img <img
alt={tracks[currentTrack]?.Name ?? "track"} alt={tracks?.[currentTrack]?.Name ?? "track"}
className="audio-player-image" className="audio-player-image"
src={ src={getImageUrlsApi(api).getItemImageUrlById(
!!api?.configuration?.apiKey && (!item?.ImageTags?.Primary ? item?.AlbumId : item?.Id) ?? "",
getImageUrlsApi(api).getItemImageUrlById(
!item?.ImageTags.Primary ? item?.AlbumId : item?.Id,
"Primary", "Primary",
{ {
quality: 85, quality: 85,
fillHeight: 462, fillHeight: 462,
fillWidth: 462, fillWidth: 462,
}, },
) )}
}
/> />
<span className="material-symbols-rounded audio-player-image-icon"> <span className="material-symbols-rounded audio-player-image-icon">
music_note music_note
@@ -262,7 +132,7 @@ const AudioPlayer = () => {
</div> </div>
</div> </div>
), ),
[tracks[currentTrack]?.Id, currentTrack], [tracks?.[currentTrack]?.Id, currentTrack],
); );
const controls = useMemo( const controls = useMemo(
@@ -298,7 +168,7 @@ const AudioPlayer = () => {
<PlayNextButton /> <PlayNextButton />
</div> </div>
), ),
[tracks[currentTrack]?.Id, loading, playing, tracks.length], [tracks?.[currentTrack]?.Id, loading, playing, tracks?.length],
); );
const buttons = useMemo( const buttons = useMemo(
@@ -328,10 +198,12 @@ const AudioPlayer = () => {
step={1} step={1}
max={100} max={100}
onChange={(_, newVal) => { onChange={(_, newVal) => {
Array.isArray(newVal) Array.isArray(newVal) ? setVolume(newVal[0] / 100) : setVolume(newVal / 100);
? setVolume(newVal[0] / 100) if (Array.isArray(newVal)) {
: setVolume(newVal / 100); audioRef.current.volume = newVal[0] / 100;
} else {
audioRef.current.volume = newVal / 100; audioRef.current.volume = newVal / 100;
}
}} }}
valueLabelDisplay="auto" valueLabelDisplay="auto"
valueLabelFormat={(value) => Math.floor(value)} valueLabelFormat={(value) => Math.floor(value)}
@@ -376,7 +248,7 @@ const AudioPlayer = () => {
if (audioRef.current) { if (audioRef.current) {
audioRef.current.addEventListener("ended", () => { audioRef.current.addEventListener("ended", () => {
if (tracks[currentTrack + 1]?.Id) { if (tracks?.[currentTrack + 1]?.Id) {
playItemFromQueue("next", user?.Id, api); playItemFromQueue("next", user?.Id, api);
} }
}); });
@@ -409,7 +281,8 @@ const AudioPlayer = () => {
> >
{info} {info}
<audio <audio
data-src={url} autoPlay
src={url}
ref={audioRef} ref={audioRef}
key={item?.Id} key={item?.Id}
onTimeUpdate={(e) => onTimeUpdate={(e) =>
@@ -451,8 +324,14 @@ const AudioPlayer = () => {
onChangeCommitted={(_, value) => { onChangeCommitted={(_, value) => {
setIsScrubbing(false); setIsScrubbing(false);
// console.log(ticksToSec(value * item?.RunTimeTicks)); // console.log(ticksToSec(value * item?.RunTimeTicks));
setProgress(value); Array.isArray(value)
? setProgress(value[0])
: setProgress(value);
if (Array.isArray(value)) {
audioRef.current.currentTime = ticksToSec(value[0]);
} else {
audioRef.current.currentTime = ticksToSec(value); audioRef.current.currentTime = ticksToSec(value);
}
}} }}
/> />
<Typography <Typography
+1 -1
View File
@@ -7,7 +7,7 @@ import "./tagChip.scss";
const TagChip = ({ const TagChip = ({
label, label,
linkProps, linkProps,
}: { label: string; linkProps: LinkProps }) => { }: { label: string; linkProps?: LinkProps }) => {
return ( return (
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}> <Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
<Typography variant="subtitle2" fontWeight={300}> <Typography variant="subtitle2" fontWeight={300}>
+142 -69
View File
@@ -1,16 +1,9 @@
import PropTypes from "prop-types"; import React, { useLayoutEffect, useMemo, useRef } from "react";
import React, { useLayoutEffect, useRef } from "react";
import heroBg from "@/assets/herobg.png";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import Chip from "@mui/material/Chip";
import CircularProgress from "@mui/material/CircularProgress"; import CircularProgress from "@mui/material/CircularProgress";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import useParallax from "@/utils/hooks/useParallax";
import { motion, useScroll } from "framer-motion";
import { import {
type BaseItemDto, type BaseItemDto,
BaseItemKind, BaseItemKind,
@@ -18,27 +11,19 @@ import {
} from "@jellyfin/sdk/lib/generated-client"; } from "@jellyfin/sdk/lib/generated-client";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api"; import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"; import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
import { Blurhash } from "react-blurhash";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { import { getRuntimeCompact, getRuntimeMusic } from "@/utils/date/time";
getRuntime,
getRuntimeCompact,
getRuntimeMusic,
} from "@/utils/date/time";
import { Card } from "@/components/card/card"; import { Card } from "@/components/card/card";
import { CardScroller } from "@/components/cardScroller/cardScroller"; import { CardScroller } from "@/components/cardScroller/cardScroller";
import LikeButton from "@/components/buttons/likeButton"; import LikeButton from "@/components/buttons/likeButton";
import PlayButton from "@/components/buttons/playButton"; import PlayButton from "@/components/buttons/playButton";
import TrackList from "@/components/layouts/tracksList";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice"; import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
import ShowMoreText from "@/components/showMoreText";
import { getTypeIcon } from "@/components/utils/iconsCollection"; import { getTypeIcon } from "@/components/utils/iconsCollection";
import { import {
@@ -52,39 +37,10 @@ import "./album.scss";
import TagChip from "@/components/tagChip"; import TagChip from "@/components/tagChip";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import { playItem } from "@/utils/store/playback";
import { Link, createFileRoute } from "@tanstack/react-router"; import { Link, createFileRoute } from "@tanstack/react-router";
import lyricsIcon from "../../../assets/icons/lyrics.svg"; import lyricsIcon from "../../../assets/icons/lyrics.svg";
function TabPanel(props) {
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
id={`full-width-tabpanel-${index}`}
aria-labelledby={`full-width-tab-${index}`}
{...other}
style={{ marginTop: "1em" }}
>
{value === index && <Box>{children}</Box>}
</div>
);
}
TabPanel.propTypes = {
children: PropTypes.node,
index: PropTypes.number.isRequired,
value: PropTypes.number.isRequired,
};
function a11yProps(index) {
return {
id: `full-width-tab-${index}`,
"aria-controls": `full-width-tabpanel-${index}`,
};
}
export const Route = createFileRoute("/_api/album/$id")({ export const Route = createFileRoute("/_api/album/$id")({
component: MusicAlbumTitlePage, component: MusicAlbumTitlePage,
}); });
@@ -112,12 +68,14 @@ function MusicAlbumTitlePage() {
const similarItems = useQuery({ const similarItems = useQuery({
queryKey: ["item", id, "similarItem"], queryKey: ["item", id, "similarItem"],
queryFn: async () => { queryFn: async () => {
if (item.data?.Id) {
const result = await getLibraryApi(api).getSimilarAlbums({ const result = await getLibraryApi(api).getSimilarAlbums({
userId: user?.Id, userId: user?.Id,
itemId: item.data?.Id, itemId: item.data?.Id,
limit: 16, limit: 16,
}); });
return result.data; return result.data;
}
}, },
enabled: item.isSuccess, enabled: item.isSuccess,
networkMode: "always", networkMode: "always",
@@ -132,6 +90,7 @@ function MusicAlbumTitlePage() {
parentId: item.data?.Id, parentId: item.data?.Id,
sortOrder: [SortOrder.Ascending], sortOrder: [SortOrder.Ascending],
sortBy: ["IndexNumber"], sortBy: ["IndexNumber"],
fields: ["MediaSources"],
}); });
return result.data; return result.data;
}, },
@@ -141,6 +100,21 @@ function MusicAlbumTitlePage() {
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]); const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
const allDiscs = useMemo(() => {
const discs: number[] = [];
if (musicTracks.data?.Items) {
for (const track of musicTracks.data.Items) {
if (
track.ParentIndexNumber &&
!discs.includes(track.ParentIndexNumber)
) {
discs.push(track.ParentIndexNumber);
}
}
}
return discs;
}, [musicTracks.data]);
useLayoutEffect(() => { useLayoutEffect(() => {
if (item.isSuccess) { if (item.isSuccess) {
setAppBackdrop( setAppBackdrop(
@@ -151,24 +125,22 @@ function MusicAlbumTitlePage() {
}, [item.isSuccess]); }, [item.isSuccess]);
const pageRef = useRef(null); const pageRef = useRef(null);
const { scrollYProgress } = useScroll({
target: pageRef,
offset: ["start start", "60vh start"],
});
const parallax = useParallax(scrollYProgress, 50);
const handlePlayback = ( const handlePlayback = (
index: number, index: number,
item: BaseItemDto, item: BaseItemDto,
queue: BaseItemDto[], queue: BaseItemDto[],
) => { ) => {
if (item.Id && user?.Id) {
const url = generateAudioStreamUrl( const url = generateAudioStreamUrl(
item.Id, item.Id,
user?.Id, user?.Id,
api.deviceInfo.id, api.deviceInfo.id,
api.basePath, api.basePath,
api.accessToken,
); );
playAudio(url, item, undefined, queue, index); playAudio(url, item, undefined);
}
}; };
const currentPlayingItem = useAudioPlayback((s) => s.item); const currentPlayingItem = useAudioPlayback((s) => s.item);
@@ -216,19 +188,19 @@ function MusicAlbumTitlePage() {
{item.data.ProductionYear} {item.data.ProductionYear}
</Typography> </Typography>
<Typography className="opacity-07"> <Typography className="opacity-07">
{musicTracks.data?.TotalRecordCount > 1 {(musicTracks.data?.TotalRecordCount ?? 0) > 1
? `${musicTracks.data?.TotalRecordCount} songs` ? `${musicTracks.data?.TotalRecordCount} songs`
: `1 song`} : "1 song"}
</Typography> </Typography>
<Typography className="opacity-07"> <Typography className="opacity-07">
{getRuntimeCompact(item.data.CumulativeRunTimeTicks)} {getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
</Typography> </Typography>
</div> </div>
<div className="item-info-buttons"> <div className="item-info-buttons">
<PlayButton <PlayButton
item={item} item={item.data}
audio audio
itemType={item.data.Type} itemType={item.data.Type ?? "Audio"}
userId={user?.Id} userId={user?.Id}
/> />
<LikeButton <LikeButton
@@ -239,7 +211,95 @@ function MusicAlbumTitlePage() {
itemName={item.data.Name} itemName={item.data.Name}
/> />
</div> </div>
<div className="item-info-track-container"> <div className="item-info-track-container ">
{allDiscs.length > 0 ? (
allDiscs.map((disc) => (
<>
<div
className="item-info-disc-header flex flex-row flex-align-center"
key={disc}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "2em" }}
>
album
</span>
<Typography variant="h5">Disc {disc}</Typography>
</div>
<div key={disc} className="item-info-track header">
<span className="material-symbols-rounded index">
tag
</span>
<Typography variant="subtitle1">Title</Typography>
<Typography variant="subtitle1">Duration</Typography>
</div>
{musicTracks.data?.Items?.map(
(track, index) =>
track.ParentIndexNumber === disc && (
<div
className={
currentPlayingItem?.Id === track.Id
? "item-info-track playing"
: "item-info-track"
}
key={track.Id}
onClick={() =>
musicTracks.data.Items &&
handlePlayback(
index,
track,
musicTracks.data.Items,
)
}
>
<div className="index-container">
<span className="material-symbols-rounded fill ">
play_arrow
</span>
<Typography className="index">
{track.IndexNumber ?? "-"}
</Typography>
</div>
<div className="item-info-track-info">
<Typography className="item-info-track-info-name">
{track.Name}
</Typography>
<Typography
variant="subtitle2"
style={{
opacity: 0.6,
display: "flex",
alignItems: "center",
gap: "0.6em",
}}
fontWeight={300}
>
{track.HasLyrics && (
<img src={lyricsIcon} alt="lyrics" />
)}
{track.Artists?.join(", ")}
</Typography>
</div>
<Typography>
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
</Typography>
<div className="flex flex-align-center">
<LikeButton
itemId={track.Id}
isFavorite={track.UserData?.IsFavorite}
queryKey={["item", "musicTracks"]}
userId={user?.Id}
itemName={track.Name}
/>
</div>
</div>
),
)}
</>
))
) : (
<>
<div className="item-info-track header"> <div className="item-info-track header">
<span className="material-symbols-rounded index">tag</span> <span className="material-symbols-rounded index">tag</span>
<Typography variant="subtitle1">Title</Typography> <Typography variant="subtitle1">Title</Typography>
@@ -254,6 +314,7 @@ function MusicAlbumTitlePage() {
} }
key={track.Id} key={track.Id}
onClick={() => onClick={() =>
musicTracks.data.Items &&
handlePlayback(index, track, musicTracks.data.Items) handlePlayback(index, track, musicTracks.data.Items)
} }
> >
@@ -279,11 +340,15 @@ function MusicAlbumTitlePage() {
}} }}
fontWeight={300} fontWeight={300}
> >
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />} {track.HasLyrics && (
<img src={lyricsIcon} alt="lyrics" />
)}
{track.Artists?.join(", ")} {track.Artists?.join(", ")}
</Typography> </Typography>
</div> </div>
<Typography>{getRuntimeMusic(track.RunTimeTicks)}</Typography> <Typography>
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
</Typography>
<div className="flex flex-align-center"> <div className="flex flex-align-center">
<LikeButton <LikeButton
itemId={track.Id} itemId={track.Id}
@@ -295,6 +360,8 @@ function MusicAlbumTitlePage() {
</div> </div>
</div> </div>
))} ))}
</>
)}
</div> </div>
</div> </div>
<div className="item-info-sidebar"> <div className="item-info-sidebar">
@@ -303,14 +370,17 @@ function MusicAlbumTitlePage() {
<img <img
className="item-info-sidebar-image" className="item-info-sidebar-image"
alt={item.data.Name ?? "Album"} alt={item.data.Name ?? "Album"}
src={getImageUrlsApi(api).getItemImageUrlById( src={
item.data.Id &&
getImageUrlsApi(api).getItemImageUrlById(
item.data.Id, item.data.Id,
"Primary", "Primary",
{ {
tag: item.data.ImageTags.Primary, tag: item.data.ImageTags.Primary,
quality: 90, quality: 90,
}, },
)} )
}
/> />
) : ( ) : (
<div className="item-info-sidebar-icon"> <div className="item-info-sidebar-icon">
@@ -323,14 +393,14 @@ function MusicAlbumTitlePage() {
style={{ gap: "1em", flexWrap: "wrap" }} style={{ gap: "1em", flexWrap: "wrap" }}
> >
{item.data.GenreItems?.map((genre) => ( {item.data.GenreItems?.map((genre) => (
<TagChip label={genre.Name} key={genre.Id} /> <TagChip label={genre.Name ?? "genre"} key={genre.Id} />
))} ))}
</div> </div>
<div className="flex flex-column item-info-sidebar-artist-container"> <div className="flex flex-column item-info-sidebar-artist-container">
{item.data.ArtistItems?.map((artist) => ( {item.data.ArtistItems?.map((artist) => (
<Link <Link
to="/artist/$id" to="/artist/$id"
params={{ id: artist.Id }} params={{ id: artist.Id ?? "" }}
className="item-info-sidebar-artist" className="item-info-sidebar-artist"
key={artist.Id} key={artist.Id}
> >
@@ -338,13 +408,16 @@ function MusicAlbumTitlePage() {
<img <img
className="item-info-sidebar-artist-image" className="item-info-sidebar-artist-image"
alt={artist.Name ?? "Artist"} alt={artist.Name ?? "Artist"}
src={getImageUrlsApi(api).getItemImageUrlById( src={
artist.Id &&
getImageUrlsApi(api).getItemImageUrlById(
artist.Id, artist.Id,
"Primary", "Primary",
{ {
quality: 90, quality: 90,
}, },
)} )
}
/> />
<span className="material-symbols-rounded">artist</span> <span className="material-symbols-rounded">artist</span>
</div> </div>
@@ -354,13 +427,13 @@ function MusicAlbumTitlePage() {
</div> </div>
</div> </div>
</div> </div>
{(similarItems.data.TotalRecordCount ?? -1) > 0 && ( {(similarItems.data?.TotalRecordCount ?? -1) > 0 && (
<CardScroller <CardScroller
title="You might also like" title="You might also like"
displayCards={7} displayCards={7}
disableDecoration disableDecoration
> >
{similarItems.data.Items?.map((similar) => { {similarItems.data?.Items?.map((similar) => {
return ( return (
<Card <Card
key={similar.Id} key={similar.Id}
+7
View File
@@ -133,6 +133,13 @@ $border-radius: 20px;
display: flex; display: flex;
gap: 1em; gap: 1em;
} }
&-disc-header{
padding: 1em 2em;
background: hsla(0, 0, 100%, 10%);
border-radius: 100px;
gap: 1em;
margin-top: 1em;
}
} }
} }
.item-detail-album { .item-detail-album {
+4 -2
View File
@@ -43,7 +43,7 @@ import TrailerButton from "@/components/buttons/trailerButton";
import ShowMoreText from "@/components/showMoreText"; import ShowMoreText from "@/components/showMoreText";
import { getTypeIcon } from "@/components/utils/iconsCollection"; import { getTypeIcon } from "@/components/utils/iconsCollection";
import { endsAt, getRuntime } from "@/utils/date/time"; import { endsAt, getRuntime } from "@/utils/date/time";
import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop"; import { useBackdropStore } from "@/utils/store/backdrop";
import ItemSkeleton from "@/components/skeleton/item"; import ItemSkeleton from "@/components/skeleton/item";
@@ -194,11 +194,13 @@ function ItemDetail() {
const [mediaQualityInfo, setMediaQualityInfo] = useState<MediaQualityInfo>(); const [mediaQualityInfo, setMediaQualityInfo] = useState<MediaQualityInfo>();
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
useLayoutEffect(() => { useLayoutEffect(() => {
if (item.isSuccess) { if (item.isSuccess) {
if (item.data.BackdropImageTags?.length > 0) { if (item.data.BackdropImageTags?.length > 0) {
setBackdrop( setBackdrop(
getImageUrlsApi(api).getItemImageUrl(item.data.Id, "Backdrop", { getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0], tag: item.data.BackdropImageTags[0],
}), }),
item.data.BackdropImageTags[0], item.data.BackdropImageTags[0],
+34
View File
@@ -2,10 +2,13 @@ import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { create } from "zustand"; import { create } from "zustand";
import { setQueue } from "./queue"; import { setQueue } from "./queue";
import { start } from "repl";
import { max } from "lodash";
import type React from "react"; import type React from "react";
import { shallow } from "zustand/shallow"; import { shallow } from "zustand/shallow";
import { createWithEqualityFn } from "zustand/traditional"; import { createWithEqualityFn } from "zustand/traditional";
import { secToTicks } from "../date/time"; import { secToTicks } from "../date/time";
import playbackProfile from "../playback-profiles";
type AudioPlaybackStore = { type AudioPlaybackStore = {
display: boolean; display: boolean;
@@ -51,10 +54,41 @@ export const generateAudioStreamUrl = (
userId: string, userId: string,
deviceId: string, deviceId: string,
basePath: string, basePath: string,
api_key: string,
) => { ) => {
const transcodingProfile = playbackProfile.TranscodingProfiles?.filter(
(val) => val.Type === "Audio" && val.Context === "Streaming",
)[0];
let directPlayContainers = "";
if (playbackProfile.DirectPlayProfiles) {
for (const p of playbackProfile.DirectPlayProfiles) {
if (p.Type === "Audio") {
if (directPlayContainers) {
directPlayContainers += `, ${p.Container}`;
} else {
directPlayContainers = p.Container ?? "";
}
if (p.AudioCodec) {
directPlayContainers += `| ${p.AudioCodec}`;
}
}
}
}
const urlOptions = { const urlOptions = {
userId, userId,
deviceId, deviceId,
api_key,
container: directPlayContainers,
maxAudioChannels: transcodingProfile?.MaxAudioChannels,
transcodingContainer: transcodingProfile?.Container,
transcodingProtocol: transcodingProfile?.Protocol,
audioCodec: transcodingProfile?.AudioCodec,
playSessionId: new Date().getTime(),
startTimeTicks: 0,
enableRemoteMedia: false,
enableAudioVbrEncoding: true,
}; };
const urlParams = new URLSearchParams(urlOptions).toString(); const urlParams = new URLSearchParams(urlOptions).toString();
return `${basePath}/Audio/${itemId}/universal?${urlParams}`; return `${basePath}/Audio/${itemId}/universal?${urlParams}`;