mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-03-11 22:15:35 +00:00
fix: hold to FF pointer cancel
This commit is contained in:
parent
ad4ed78b76
commit
71d91d2a8e
2 changed files with 23 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ui",
|
||||
"version": "6.4.68",
|
||||
"version": "6.4.69",
|
||||
"license": "BUSL-1.1",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@9.15.5",
|
||||
|
|
|
|||
|
|
@ -154,10 +154,10 @@
|
|||
})
|
||||
|
||||
function checkAudio () {
|
||||
if (video.audioTracks) {
|
||||
if ('audioTracks' in HTMLVideoElement.prototype && video.audioTracks) {
|
||||
if (!video.audioTracks.length) {
|
||||
toast.error('Audio Codec Unsupported', {
|
||||
description: "This torrent's audio codec is not supported, try a different release by disabling Autoplay Torrents in RSS settings."
|
||||
description: "This torrent's audio codec is not supported, try a different release by disabling Autoplay Torrents in Torrent settings. You can also use external players like MPV."
|
||||
})
|
||||
} else if (video.audioTracks.length > 1) {
|
||||
const preferredTrack = [...video.audioTracks].find(({ language }) => language === $settings.audioLanguage)
|
||||
|
|
@ -166,6 +166,15 @@
|
|||
const japaneseTrack = [...video.audioTracks].find(({ language }) => language === 'jpn')
|
||||
if (japaneseTrack) return selectAudio(japaneseTrack.id)
|
||||
}
|
||||
} else {
|
||||
video.requestVideoFrameCallback(() => {
|
||||
// using capturestream.getAudioTracks() could work too
|
||||
if ('webkitAudioDecodedByteCount' in video && video.webkitAudioDecodedByteCount === 0) {
|
||||
toast.error('Audio Codec Unsupported', {
|
||||
description: "This torrent's audio codec is not supported, try a different release by disabling Autoplay Torrents in Torrent settings. You can also use external players like MPV."
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function selectAudio (id: string) {
|
||||
|
|
@ -691,6 +700,7 @@
|
|||
let timeout = 0
|
||||
let oldPlaybackRate = playbackRate
|
||||
const startFF = () => {
|
||||
clearTimeout(timeout)
|
||||
timeout = setTimeout(() => {
|
||||
paused = false
|
||||
fastForwarding = true
|
||||
|
|
@ -706,20 +716,27 @@
|
|||
paused = true
|
||||
}
|
||||
}
|
||||
document.addEventListener(type + 'down' as 'keydown' | 'pointerdown', (event) => {
|
||||
document.addEventListener(type + 'down' as 'keydown' | 'pointerdown', event => {
|
||||
if (isMiniplayer) return
|
||||
if ('code' in event && (event.code !== 'Space')) return
|
||||
if ('button' in event && event.button !== 0) return
|
||||
if ('pointerId' in event) document.setPointerCapture(event.pointerId)
|
||||
if ('pointerId' in event) {
|
||||
document.setPointerCapture(event.pointerId)
|
||||
}
|
||||
startFF()
|
||||
}, { signal: ctrl.signal })
|
||||
document.addEventListener(type + 'up' as 'keyup' | 'pointerup', (event) => {
|
||||
document.addEventListener(type + 'up' as 'keyup' | 'pointerup', event => {
|
||||
if (isMiniplayer) return
|
||||
if ('code' in event && event.code !== 'Space') return
|
||||
if ('pointerId' in event) document.releasePointerCapture(event.pointerId)
|
||||
endFF()
|
||||
}, { signal: ctrl.signal })
|
||||
|
||||
document.addEventListener('pointercancel', event => {
|
||||
document.releasePointerCapture(event.pointerId)
|
||||
endFF()
|
||||
}, { signal: ctrl.signal })
|
||||
|
||||
return { destroy: () => ctrl.abort() }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue