Skip to content

Commit 1c59a49

Browse files
Merge commit '1c2074744afe364352fb4fa6b48759fc4954b3ad' into development
2 parents a1755b4 + 1c20747 commit 1c59a49

File tree

14 files changed

+75
-119
lines changed

14 files changed

+75
-119
lines changed

.github/workflows/autoMerge.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ jobs:
1313
(contains(github.event.pull_request.base.ref, 'development') || contains(github.event.pull_request.base.ref, 'RC'))
1414
runs-on: ubuntu-latest
1515

16+
permissions:
17+
contents: write
18+
1619
steps:
1720
- name: Auto Merge PR
1821
shell: bash
1922
env:
20-
GH_TOKEN: ${{ secrets.PUSH_TOKEN }}
21-
PR_NUMBER: ${{ github.event.pull_request.number }}
22-
run: gh pr merge "https://github.com/FreeTubeApp/FreeTube/pull/${PR_NUMBER}" --auto --squash
23+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
PR_URL: ${{ github.event.pull_request.html_url }}
25+
run: gh pr merge "$PR_URL" --auto --squash

src/renderer/components/ExperimentalSettings/ExperimentalSettings.vue

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@
1616
@change="handleRestartPrompt"
1717
/>
1818
</FtFlexBox>
19-
<FtFlexBox v-if="sabrAllowedOnPlatform">
20-
<FtToggleSwitch
21-
tooltip-position="top"
22-
:label="$t('Settings.SABR.Label')"
23-
compact
24-
:default-value="sabrEnabled"
25-
:tooltip="$t('Settings.SABR.Tooltip')"
26-
@change="updateSabrEnabled"
27-
/>
28-
</FtFlexBox>
2919
<FtPrompt
3020
v-if="showRestartPrompt"
3121
:label="$t('Settings[\'The app needs to restart for changes to take effect. Restart and apply change?\']')"
@@ -37,15 +27,13 @@
3727
</template>
3828

3929
<script setup>
40-
import { computed, onMounted, ref } from 'vue'
30+
import { onMounted, ref } from 'vue'
4131
4232
import FtSettingsSection from '../FtSettingsSection/FtSettingsSection.vue'
4333
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
4434
import FtToggleSwitch from '../FtToggleSwitch/FtToggleSwitch.vue'
4535
import FtPrompt from '../FtPrompt/FtPrompt.vue'
4636
47-
import store from '../../store/index'
48-
4937
const replaceHttpCacheLoading = ref(true)
5038
const replaceHttpCache = ref(false)
5139
const showRestartPrompt = ref(false)
@@ -81,18 +69,6 @@ function handleReplaceHttpCache(value) {
8169
window.ftElectron.toggleReplaceHttpCache()
8270
}
8371
}
84-
85-
const sabrAllowedOnPlatform = process.env.SUPPORTS_LOCAL_API
86-
/** @type {import('vue').ComputedRef<boolean>} */
87-
const sabrEnabled = process.env.SUPPORTS_LOCAL_API ? computed(() => store.getters.getSabrEnabled) : false
88-
89-
/**
90-
* @param {boolean} value
91-
*/
92-
function updateSabrEnabled(value) {
93-
store.dispatch('updateSabrEnabled', value)
94-
}
95-
9672
</script>
9773

9874
<style scoped src="./ExperimentalSettings.css" />

src/renderer/components/ft-shaka-video-player/ft-shaka-video-player.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,9 +2839,8 @@ export default defineComponent({
28392839
})
28402840
}
28412841

2842-
const delayLoadUntilUnix = props.delayLoadUntilUnix
2843-
const initialLoadDelayMs = delayLoadUntilUnix - Date.now()
2844-
if (initialLoadDelayMs > 0) {
2842+
const initialLoadDelayMs = props.delayLoadUntilUnix - Date.now()
2843+
if (initialLoadDelayMs > 0 && (props.format === 'legacy' || props.manifestMimeType !== MANIFEST_TYPE_SABR)) {
28452844
showToast(
28462845
({ remainingMs }) => {
28472846
// `+value` converts string back to float

src/renderer/helpers/api/local.js

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ export async function getLocalSearchContinuation(continuationData) {
392392

393393
/**
394394
* @param {string} id
395-
* @param {boolean} forceEnableSabrOnlyResponseWorkaround - When true workaround will be forced and there will be no audio track selection
396395
* @returns {Promise<{
397396
* info: import('youtubei.js').YT.VideoInfo,
398397
* poToken: string | undefined,
@@ -402,12 +401,12 @@ export async function getLocalSearchContinuation(continuationData) {
402401
* osName: string,
403402
* osVersion: string
404403
* },
405-
* adEndTimeUnixMs: number,
406-
* sabrCanBeUsed: boolean,
404+
* adEndTimeUnixMs: number
407405
* }>}
408406
*/
409-
export async function getLocalVideoInfo(id, { forceEnableSabrOnlyResponseWorkaround = false } = {}) {
410-
let totalAdTimeSeconds = 0
407+
export async function getLocalVideoInfo(id) {
408+
let responseTime = Date.now()
409+
let totalAdTimeMilliseconds = 0
411410

412411
const webInnertube = await createInnertube({
413412
withPlayer: true,
@@ -421,19 +420,25 @@ export async function getLocalVideoInfo(id, { forceEnableSabrOnlyResponseWorkaro
421420

422421
const responseText = await response.text()
423422

423+
responseTime = Date.now()
424+
424425
const json = JSON.parse(responseText)
425426

426427
if (Array.isArray(json.adSlots)) {
427428
for (const adSlot of json.adSlots) {
428429
if (adSlot.adSlotRenderer?.adSlotMetadata?.triggerEvent === 'SLOT_TRIGGER_EVENT_BEFORE_CONTENT') {
429-
const playerVars = adSlot.adSlotRenderer.fulfillmentContent?.fulfilledLayout?.playerBytesAdLayoutRenderer
430-
?.renderingContent?.instreamVideoAdRenderer?.playerVars
431-
432-
if (playerVars) {
433-
const match = playerVars.match(/length_seconds=([\d.]+)/)
434-
435-
if (match) {
436-
totalAdTimeSeconds += parseFloat(match[1])
430+
const instreamVideoAdRenderer = adSlot.adSlotRenderer.fulfillmentContent?.fulfilledLayout?.playerBytesAdLayoutRenderer
431+
?.renderingContent?.instreamVideoAdRenderer
432+
433+
if (instreamVideoAdRenderer) {
434+
if (typeof instreamVideoAdRenderer.skipOffsetMilliseconds === 'number') {
435+
totalAdTimeMilliseconds += instreamVideoAdRenderer.skipOffsetMilliseconds
436+
} else if (instreamVideoAdRenderer.playerVars) {
437+
const match = instreamVideoAdRenderer.playerVars.match(/length_seconds=([\d.]+)/)
438+
439+
if (match) {
440+
totalAdTimeMilliseconds += parseFloat(match[1]) * 1000
441+
}
437442
}
438443
}
439444
}
@@ -473,36 +478,10 @@ export async function getLocalVideoInfo(id, { forceEnableSabrOnlyResponseWorkaro
473478
}
474479

475480
const info = await webInnertube.getInfo(id, { po_token: contentPoToken })
476-
const sabrCannotBeUsed = info.streaming_data?.server_abr_streaming_url == null ||
477-
info.player_config?.media_common_config?.media_ustreamer_request_config?.video_playback_ustreamer_config == null
478-
const workaroundRequired = forceEnableSabrOnlyResponseWorkaround || sabrCannotBeUsed
479-
// Some time would be used for parsing and maybe additional requests so end time should be calculated sooner to reduce actual waiting time
480-
let adEndTimeUnixMs = Date.now()
481-
482-
// #region temporary workaround for SABR-only responses
483-
484-
if (workaroundRequired) {
485-
// MWEB doesn't have an audio track selector so it picks the audio track on the server based on the request language.
486-
const originalAudioTrackFormat = info.streaming_data?.adaptive_formats.find(format => {
487-
return format.has_audio && format.is_original && format.language
488-
})
489481

490-
if (originalAudioTrackFormat) {
491-
webInnertube.session.context.client.hl = originalAudioTrackFormat.language
492-
}
493-
494-
const mwebInfo = await webInnertube.getBasicInfo(id, { client: 'MWEB', po_token: contentPoToken })
495-
496-
if (mwebInfo.playability_status.status === 'OK' && mwebInfo.streaming_data?.adaptive_formats) {
497-
info.playability_status = mwebInfo.playability_status
498-
info.streaming_data.adaptive_formats = mwebInfo.streaming_data.adaptive_formats
499-
}
500-
}
501482
// Some time would be used for parsing and maybe additional requests so end time should be calculated sooner to reduce actual waiting time
502-
// Legacy format also requires this
503-
adEndTimeUnixMs += totalAdTimeSeconds * 1000
504-
505-
// #endregion temporary workaround for SABR-only responses
483+
// Legacy format requires this
484+
const adEndTimeUnixMs = responseTime + totalAdTimeMilliseconds
506485

507486
let { clientName, clientVersion, osName, osVersion } = webInnertube.session.context.client
508487

@@ -611,7 +590,6 @@ export async function getLocalVideoInfo(id, { forceEnableSabrOnlyResponseWorkaro
611590
poToken: contentPoToken,
612591
clientInfo,
613592
adEndTimeUnixMs,
614-
sabrCanBeUsed: !sabrCannotBeUsed,
615593
}
616594
}
617595

src/renderer/store/modules/settings.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ const state = {
169169
defaultSkipInterval: 5,
170170
defaultViewingMode: 'default',
171171
defaultVideoFormat: 'dash',
172-
sabrEnabled: true,
173172
disableSmoothScrolling: false,
174173
displayVideoPlayButton: true,
175174
enableSearchSuggestions: true,

src/renderer/views/Watch/Watch.js

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ export default defineComponent({
136136
manifestMimeType: MANIFEST_TYPE_DASH,
137137
/** @type {SabrData | null} */
138138
sabrData: null,
139-
// For the same video
140-
sabrReloadCount: 0,
141139
legacyFormats: [],
142140
captions: [],
143141
/** @type {'EQUIRECTANGULAR' | 'EQUIRECTANGULAR_THREED_TOP_BOTTOM' | 'MESH'| null} */
@@ -324,15 +322,6 @@ export default defineComponent({
324322
// `this.$refs.player?.hasLoaded` cannot be used in computed property
325323
return !this.isLoading
326324
},
327-
328-
sabrEnabled() {
329-
return this.$store.getters.getSabrEnabled
330-
},
331-
332-
sabrReloadedTooManyTimes() {
333-
// Hardcoded since no idea what causes player reload loop, but 3 times probably too much already
334-
return this.sabrReloadCount >= 3
335-
}
336325
},
337326
watch: {
338327
async $route() {
@@ -341,10 +330,6 @@ export default defineComponent({
341330
userPlaylistsReady() {
342331
this.onMountedDependOnLocalStateLoading()
343332
},
344-
videoId() {
345-
// Reset SABR reload count when videoID changed
346-
this.sabrReloadCount = 0
347-
},
348333
async thumbnail() {
349334
if (process.env.IS_ANDROID) {
350335
createMediaSession(this.videoTitle, this.channelName, this.videoLengthSeconds * 1000, this.thumbnail)
@@ -361,16 +346,6 @@ export default defineComponent({
361346
this.checkIfTimestamp()
362347
this.currentPlaybackRate = this.$store.getters.getDefaultPlayback
363348
},
364-
created: function () {
365-
this.videoId = this.$route.params.id
366-
this.activeFormat = this.defaultVideoFormat
367-
// So that the value for this session remains unchanged even if setting changed
368-
this.autoplayNextRecommendedVideo = this.autoplayNextRecommendedVideoByDefault
369-
this.autoplayNextPlaylistVideo = this.autoplayNextPlaylistVideoByDefault
370-
371-
this.checkIfTimestamp()
372-
this.currentPlaybackRate = this.$store.getters.getDefaultPlayback
373-
},
374349
mounted: function () {
375350
window.addEventListener('media-next', this.mediaNext)
376351
window.addEventListener('media-previous', this.mediaPrevious)
@@ -519,16 +494,10 @@ export default defineComponent({
519494
}
520495

521496
try {
522-
const sabrShouldBeTried = this.sabrEnabled && !this.sabrReloadedTooManyTimes
523-
524-
const videoInfo = await getLocalVideoInfo(this.videoId, { forceEnableSabrOnlyResponseWorkaround: !sabrShouldBeTried })
497+
const videoInfo = await getLocalVideoInfo(this.videoId)
525498
const { info: result, poToken, clientInfo, adEndTimeUnixMs } = videoInfo
526499

527-
const sabrShouldBeUsed = sabrShouldBeTried && videoInfo.sabrCanBeUsed && this.activeFormat !== 'legacy'
528-
if (!sabrShouldBeUsed) {
529-
// The hack should only be used on non-SABR
530-
this.adEndTimeUnixMs = adEndTimeUnixMs
531-
}
500+
this.adEndTimeUnixMs = adEndTimeUnixMs
532501

533502
this.isFamilyFriendly = result.basic_info.is_family_safe
534503

@@ -956,7 +925,10 @@ export default defineComponent({
956925
})
957926
?.projection_type ?? null
958927

959-
if (sabrShouldBeUsed) {
928+
if (
929+
videoInfo.info.streaming_data?.server_abr_streaming_url &&
930+
videoInfo.info.player_config.media_common_config.media_ustreamer_request_config
931+
) {
960932
const storyboards = storyboard
961933
? [{
962934
templateUrl: storyboard.template_url,
@@ -1361,12 +1333,6 @@ export default defineComponent({
13611333
},
13621334

13631335
handleVideoLoaded: function () {
1364-
if (this.sabrReloadCount > 0) {
1365-
// DO NOT count player reload requests during video playback (at the middle)
1366-
// Video loaded = not reload loop
1367-
this.sabrReloadCount--
1368-
}
1369-
13701336
// Only used one time = remove after use
13711337
this.oneTimeTimestamp = null
13721338

@@ -2018,7 +1984,6 @@ export default defineComponent({
20181984

20191985
async onPlayerReloadRequested() {
20201986
showToast('Reloading player according to SABR request')
2021-
this.sabrReloadCount++
20221987

20231988
const timestamp = this.getTimestamp()
20241989
if (timestamp > 0) {

static/locales/ckb.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Global:
4848
# Search Bar
4949
Comment Count: ١ توانج | {count} توانج
5050
Like Count: ١ بەدڵبوون | {count} بەدڵبوون
51+
Posts: بڵاوکراوەکان
5152
Search / Go to URL: 'گەڕان/ بڕۆ بۆ ئرڵ'
5253
Search Bar:
5354
Clear Input: 'سڕینەوەی نووسراو'
@@ -107,7 +108,7 @@ Subscriptions:
107108
'Your Subscription list is currently empty. Start adding subscriptions to see them here.': ''
108109
Disabled Automatic Fetching: ''
109110
Empty Channels: 'کەناڵە بەشداربووەکانت هێشتا هیچ ڤیدیۆیەکیان نییە.'
110-
Empty Posts: ''
111+
Empty Posts: 'کەناڵە بەشداربووەکانت هێشتا هیچ بڵاوکراوەیەکیان نییە.'
111112
Load More Videos: 'ڤیدیۆی زۆرتر بار بکە'
112113
Load More Posts: 'بڵاوکراوەی زۆرتر بار بکە'
113114
Subscriptions Tabs: ''
@@ -124,6 +125,7 @@ Trending:
124125
Trending: 'باو'
125126
Gaming: 'یاری'
126127
Trending Tabs: ''
128+
Sports: وەرزش
127129
Most Popular: 'باوترین'
128130
Playlists: 'پێڕستی لێدانەکان'
129131
User Playlists:
@@ -185,6 +187,8 @@ User Playlists:
185187
"Video(s) added to {playlistCount} playlists": ""
186188
Allow Adding Duplicate Video(s): ڕێ بە زیادکردنی ڤیدیۆی دووبارە بدە
187189
N playlists selected: '{playlistCount} دیاریکراوە'
190+
"{videoCount}/{totalVideoCount} Videos Will Be Added": '{videoCount}/{totalVideoCount} ڤیدیۆ زیاد دەکرێتن'
191+
"{videoCount}/{totalVideoCount} Videos Already Added": '{videoCount}/{totalVideoCount} ڤیدیۆ زیاد کراینە'
188192
CreatePlaylistPrompt:
189193
New Playlist Name: ناوی پێڕستی لێدانی نوێ
190194
Create: درووستکردن
@@ -194,6 +198,8 @@ User Playlists:
194198
There was an issue with creating the playlist.: هەڵەیەک ڕوویدا لە درووستکردنی پێڕستی لێدانەکە.
195199
Are you sure you want to delete this playlist? This cannot be undone: دڵنیایت لە سڕینەوەی ئەم پێڕستی لێدانە؟ چونکە ناگەڕێندرێتەوە.
196200
Playlist Description: پێناسەی پێڕستی لێدان
201+
Playlists with Matching Videos: پێڕستەکانی لێدان لەگەڵ ڤیدیۆ هاوتاکان
202+
TotalTimePlaylist: 'سەرجەمی کات: {duration}'
197203
History:
198204
# On History Page
199205
History: 'مێژوو'

static/locales/cs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,9 @@ Settings:
622622
Set Password: Nastavit heslo
623623
Sort Settings Sections (A-Z): Seřadit sekce nastavení (A-Z)
624624
Return to Settings Menu: Vrátit se do nastavení
625+
SABR:
626+
Label: Povolti SABR jako backend DASH
627+
Tooltip: SABR se v budoucím vydání stane jediným backendem DASH a nelze jej zakázat. Tento přepínač je poskytnut v případě, že má raná implementace závažné problémy.
625628
About:
626629
#On About page
627630
About: 'O aplikaci'
@@ -869,6 +872,9 @@ Video:
869872
#& Playlists
870873
Save Watched Progress: Uložit průběh sledování
871874
Watched Progress Saved: Průběh sledování uložen
875+
Watch:
876+
'Remaining preroll-ad time: {remindingTimeSeconds}s': 'Zbývající čas prvotní reklamy: {remindingTimeSeconds} s'
877+
'Remaining SABR backoff time: {remindingTimeSeconds}s': 'Zbývající čas pauzy SABR: {remindingTimeSeconds} s'
872878
Playlist:
873879
#& About
874880
View Full Playlist: 'Zobrazit celý seznam skladeb'

static/locales/en-US.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,6 @@ Settings:
692692
Set Password To Prevent Access: Set a password to prevent access to settings
693693
Set Password: Set Password
694694
Remove Password: Remove Password
695-
SABR:
696-
Label: Enable SABR as DASH backend
697-
Tooltip: SABR will become the only DASH backend in future release and cannot be disabled. This toggle is provided in case early implementation has unrecoverable issues.
698695
About:
699696
#On About page
700697
About: About

static/locales/fr-FR.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,9 @@ Settings:
615615
Password Settings: Mot de passe
616616
Sort Settings Sections (A-Z): Trier de À à Z les rubriques des paramètres
617617
Return to Settings Menu: Revenir au Menu paramètres
618+
SABR:
619+
Label: Activer SABR comme backend DASH
620+
Tooltip: SABR deviendra le seul moteur DASH dans les prochaines versions et ne pourra pas être désactivé. Cette option est disponible au cas où une implémentation préliminaire présenterait des problèmes irrémédiables.
618621
About:
619622
#On About page
620623
About: 'À propos'
@@ -821,6 +824,9 @@ Video:
821824
#& Playlists
822825
Save Watched Progress: Enregistrer l'état de visionnage
823826
Watched Progress Saved: État de visionnage enregistré
827+
Watch:
828+
'Remaining preroll-ad time: {remindingTimeSeconds}s': 'Temps restant avant la publicité : {remindingTimeSeconds}s'
829+
'Remaining SABR backoff time: {remindingTimeSeconds}s': 'Temps de recul SABR restant : {remindingTimeSeconds}s'
824830
Playlist:
825831
#& About
826832
View Full Playlist: 'Afficher la playlist complète'

0 commit comments

Comments
 (0)