Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0fd7535
Local API: Implement SABR for VODs
PikachuEXE Sep 17, 2025
46d7e61
* Allow max 3 player reloads for the same video before fallback to ol…
PikachuEXE Sep 18, 2025
7e19728
! Fix data type for `playerTimeMs` (googlevideo 4.0.4)
PikachuEXE Sep 18, 2025
d705292
* Update player reload handling to restart player at the current time…
PikachuEXE Sep 18, 2025
69e9500
* Do not count reload if player is loaded after that
PikachuEXE Sep 18, 2025
efa5920
! Fix access from nullable object
PikachuEXE Sep 19, 2025
c4784ee
* Remove code for debug only
PikachuEXE Sep 19, 2025
3d1d4f0
Merge branch 'development' into sabr-pr
PikachuEXE Sep 22, 2025
af51633
! Workaround infinite backoff (mostly at the middle of playback
PikachuEXE Sep 19, 2025
a330d08
! Workaround infinite retry due to nextRequestPolicy (mostly at the m…
PikachuEXE Sep 20, 2025
9efea08
Merge branch 'development' into sabr-pr
PikachuEXE Sep 23, 2025
59f6736
! Fix no audio track selection when SABR used
PikachuEXE Sep 22, 2025
ef6aa70
! Fix no audio track selection when SABR used with less requests
PikachuEXE Sep 23, 2025
5ff45f1
Merge branch 'development' into sabr-pr
PikachuEXE Sep 30, 2025
f762f82
* Use Math.round instead of Math.trunc for start time / duration like…
PikachuEXE Sep 25, 2025
29149af
* Add requestNumber to SABR URL
PikachuEXE Sep 26, 2025
503add9
! Fix SABR redirect handling
PikachuEXE Sep 26, 2025
b9ace0a
! Fix reload sometimes not working
PikachuEXE Sep 28, 2025
6c1a494
* Reload with less cumulative backoff requested (5 > 3)
PikachuEXE Sep 30, 2025
c97b44f
* Implement poToken fallback (visitorData bind > videoID bind
PikachuEXE Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions _scripts/webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const config = {
filename: '[name].js',
},
externals: {
'youtubei.js': '{}'
'youtubei.js': '{}',
googlevideo: '{}'
},
module: {
rules: [
Expand Down Expand Up @@ -131,7 +132,7 @@ const config = {
'process.env.SWIPER_VERSION': `'${swiperVersion}'`
}),
new webpack.ProvidePlugin({
process: 'process/browser'
process: 'process/browser.js'
}),
new HtmlWebpackPlugin({
excludeChunks: ['processTaskWorker'],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"autolinker": "^4.1.5",
"bgutils-js": "^3.2.0",
"electron-context-menu": "^4.1.1",
"googlevideo": "^4.0.4",
"marked": "^16.3.0",
"portal-vue": "^2.1.7",
"process": "^0.11.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
@change="handleRestartPrompt"
/>
</FtFlexBox>
<FtFlexBox v-if="sabrAllowedOnPlatform">
<FtToggleSwitch
tooltip-position="top"
:label="'Enable SABR as DASH backend'"
compact
:default-value="sabrEnabled"
:tooltip="'Experimental and often has backoff time at the start of video playback. But a good alternative backend to try when default DASH backend failed.'"
@change="updateSabrEnabled"
/>
</FtFlexBox>
<FtPrompt
v-if="showRestartPrompt"
:label="$t('Settings[\'The app needs to restart for changes to take effect. Restart and apply change?\']')"
Expand All @@ -27,13 +37,15 @@
</template>

<script setup>
import { onMounted, ref } from 'vue'
import { computed, onMounted, ref } from 'vue'

import FtSettingsSection from '../FtSettingsSection/FtSettingsSection.vue'
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
import FtToggleSwitch from '../FtToggleSwitch/FtToggleSwitch.vue'
import FtPrompt from '../FtPrompt/FtPrompt.vue'

import store from '../../store/index'

const replaceHttpCacheLoading = ref(true)
const replaceHttpCache = ref(false)
const showRestartPrompt = ref(false)
Expand Down Expand Up @@ -69,6 +81,18 @@ function handleReplaceHttpCache(value) {
window.ftElectron.toggleReplaceHttpCache()
}
}

const sabrAllowedOnPlatform = process.env.SUPPORTS_LOCAL_API
/** @type {import('vue').ComputedRef<boolean>} */
const sabrEnabled = process.env.SUPPORTS_LOCAL_API ? computed(() => store.getters.getSabrEnabled) : false

/**
* @param {boolean} value
*/
function updateSabrEnabled(value) {
store.dispatch('updateSabrEnabled', value)
}

</script>

<style scoped src="./ExperimentalSettings.css" />
20 changes: 18 additions & 2 deletions src/renderer/components/FtToast/FtToast.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ let idCounter = 0
* @property {Function | null} action
* @property {boolean} isOpen
* @property {NodeJS.Timeout | number} timeout
* @property {NodeJS.Timeout | number} interval
* @property {number} id
*/

/** @type {import('vue').ShallowReactive<Toast[]>} */
const toasts = shallowReactive([])

/**
* @param {CustomEvent<{ message: string, time: number | null, action: Function | null, abortSignal: AbortSignal | null }>} event
* @param {CustomEvent<{ message: string | (({elapsedMs: number, remainingMs: number}) => string), time: number | null, action: Function | null, abortSignal: AbortSignal | null }>} event
*/
function open({ detail: { message, time, action, abortSignal } }) {
/** @type {Toast} */
Expand All @@ -46,10 +47,24 @@ function open({ detail: { message, time, action, abortSignal } }) {
action,
isOpen: false,
timeout: 0,
interval: 0,
id: idCounter++
}
time = time || 3000
let elapsed = 0
const updateDelay = 1000

if (typeof message === 'function') {
toast.message = message({ elapsedMs: elapsed, remainingMs: time - elapsed })
toast.interval = setInterval(() => {
elapsed += updateDelay
// Skip last update
if (elapsed >= time) { return }
toast.message = message({ elapsedMs: elapsed, remainingMs: time - elapsed })
}, updateDelay)
}

toast.timeout = setTimeout(close, time || 3000, toast)
toast.timeout = setTimeout(close, time, toast)
if (abortSignal != null) {
abortSignal.addEventListener('abort', () => {
close(toast)
Expand Down Expand Up @@ -92,6 +107,7 @@ function remove(toast) {
if (index !== -1) {
toasts.splice(index, 1)
clearTimeout(toast.timeout)
clearInterval(toast.interval)
}
}

Expand Down
Loading