Skip to content

Commit

Permalink
fix: improve navigating to player on TV
Browse files Browse the repository at this point in the history
fix: preferred audio language
fix: some type errors
  • Loading branch information
ThaUnknown committed Dec 26, 2023
1 parent 42e345f commit b598067
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export let alToken = localStorage.getItem('ALtoken') || null

let storedSettings = { ...defaults }

let scopedDefaults = { ...defaults }
let scopedDefaults

try {
storedSettings = JSON.parse(localStorage.getItem('settings')) || { ...defaults }
Expand Down
1 change: 1 addition & 0 deletions common/modules/webtorrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default class TorrentClient extends WebTorrent {
if (!localStorage.getItem('torrent') && !t) return
let torrent = localStorage.getItem('torrent') && new Uint8Array(JSON.parse(localStorage.getItem('torrent')))
if (!torrent) {
// this can be a magnet string, or a stringified array, lazy way of makign sure it works
try {
torrent = new Uint8Array(JSON.parse(t))
} catch (e) {
Expand Down
17 changes: 11 additions & 6 deletions common/views/Player/Player.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
description: "This torrent's audio codec is not supported, try a different release by disabling Autoplay Torrents in RSS settings."
})
} else if (video.audioTracks.length > 1) {
const preferredTrack = [...video.audioTracks].find(({ language }) => language === settings.audioLanguage)
const preferredTrack = [...video.audioTracks].find(({ language }) => language === $settings.audioLanguage)
if (preferredTrack) return selectAudio(preferredTrack.id)
const japaneseTrack = [...video.audioTracks].find(({ language }) => language === 'jpn')
Expand Down Expand Up @@ -742,7 +742,7 @@
const sanitised = []
const first = chapters[0]
if (first.start !== 0) {
sanitised.push({ size: Math.max(first.start, 0) / 10 / safeduration })
sanitised.push({ size: Math.max(first.start, 0) / 10 / safeduration, end: undefined })
}
for (let { start, end, text } of chapters) {
if (start > safeduration * 1000) continue
Expand Down Expand Up @@ -1007,9 +1007,11 @@
<div class='col-4' />
</div>
<div class='middle d-flex align-items-center justify-content-center flex-grow-1 position-relative'>
<!-- eslint-disable-next-line svelte/valid-compile -->
<div class='w-full h-full position-absolute toggle-fullscreen' on:dblclick={toggleFullscreen} on:click|self={() => { if (page === 'player') playPause(); page = 'player' }} />
<!-- eslint-disable-next-line svelte/valid-compile -->
<div class='w-full h-full position-absolute toggle-immerse d-none' on:dblclick={toggleFullscreen} on:click|self={toggleImmerse} use:click={() => { page = 'player' }} />
<div class='w-full h-full position-absolute toggle-immerse d-none' on:dblclick={toggleFullscreen} on:click|self={toggleImmerse} />
<div class='w-full h-full position-absolute mobile-focus-target d-none' use:click={() => { page = 'player' }} />
<span class='material-symbols-outlined ctrl' class:text-muted={!hasLast} class:disabled={!hasLast} use:click={playLast}> skip_previous </span>
<span class='material-symbols-outlined ctrl' use:click={rewind}> fast_rewind </span>
<span class='material-symbols-outlined ctrl' data-name='playPause' use:click={playPause}> {ended ? 'replay' : paused ? 'play_arrow' : 'pause'} </span>
Expand Down Expand Up @@ -1429,9 +1431,6 @@
font-size: 2rem !important;
}
.miniplayer .toggle-immerse:focus-visible {
background: hsla(209, 100%, 55%, 0.3);
}
@media (pointer: none), (pointer: coarse) {
.bottom .ctrl[data-name='playPause'],
.bottom .ctrl[data-name='playNext'],
Expand All @@ -1450,6 +1449,12 @@
.toggle-fullscreen {
display: none !important;
}
.miniplayer .mobile-focus-target {
display: block !important;
}
.miniplayer .mobile-focus-target:focus-visible {
background: hsla(209, 100%, 55%, 0.3);
}
}
</style>

0 comments on commit b598067

Please sign in to comment.