Added default playback rate
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "Materialious",
|
||||
"version": "1.9.4",
|
||||
"version": "1.9.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "Materialious",
|
||||
"version": "1.9.4",
|
||||
"version": "1.9.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@capacitor-community/electron": "^5.0.0",
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
playerAndroidLockOrientation,
|
||||
playerAutoPlayStore,
|
||||
playerDefaultLanguage,
|
||||
playerDefaultPlaybackSpeed,
|
||||
playerDefaultQualityStore,
|
||||
playerProxyVideosStore,
|
||||
playerSavePlaybackPositionStore,
|
||||
@@ -41,6 +42,7 @@
|
||||
import { getDynamicTheme, setStatusBarColor } from '../theme';
|
||||
import { injectSABR } from '$lib/sabr';
|
||||
import { patchYoutubeJs } from '$lib/patches/youtubejs';
|
||||
import { playbackRates } from '$lib/const';
|
||||
|
||||
interface Props {
|
||||
data: { video: VideoPlay; content: PhasedDescription; playlistId: string | null };
|
||||
@@ -317,9 +319,13 @@
|
||||
ui('#snackbar-alert');
|
||||
}
|
||||
|
||||
restoreQualityPreference();
|
||||
restoreQualityPreference();
|
||||
restoreDefaultLanguage();
|
||||
|
||||
if ($playerDefaultPlaybackSpeed && playerElement) {
|
||||
console.log('$playerDefaultPlaybackSpeed', $playerDefaultPlaybackSpeed);
|
||||
playerElement.playbackRate = $playerDefaultPlaybackSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
async function reloadVideo() {
|
||||
@@ -394,7 +400,7 @@
|
||||
'language',
|
||||
'statistics'
|
||||
],
|
||||
playbackRates: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3],
|
||||
playbackRates: playbackRates,
|
||||
enableTooltips: false,
|
||||
seekBarColors: {
|
||||
played: (await getDynamicTheme())['--primary']
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
playerAutoPlayStore,
|
||||
playerAutoplayNextByDefaultStore,
|
||||
playerDefaultLanguage,
|
||||
playerDefaultPlaybackSpeed,
|
||||
playerDefaultQualityStore,
|
||||
playerProxyVideosStore,
|
||||
playerSavePlaybackPositionStore,
|
||||
@@ -17,6 +18,7 @@
|
||||
playerYouTubeJsAlways,
|
||||
playerYouTubeJsFallback
|
||||
} from '../../store';
|
||||
import { playbackRates } from '$lib/const';
|
||||
|
||||
let defaultLanguage = $state(get(playerDefaultLanguage));
|
||||
|
||||
@@ -36,6 +38,11 @@
|
||||
playerDefaultQualityStore.set(value);
|
||||
}
|
||||
|
||||
function onSpeedChange(event: Event) {
|
||||
const value = (event.target as HTMLSelectElement).value;
|
||||
playerDefaultPlaybackSpeed.set(Number(value));
|
||||
}
|
||||
|
||||
function onLocalVideoFallbackChange() {
|
||||
switch (localVideoFallback) {
|
||||
case 'enabled':
|
||||
@@ -90,6 +97,21 @@
|
||||
<i>arrow_drop_down</i>
|
||||
</div>
|
||||
|
||||
<div class="field label suffix border">
|
||||
<select
|
||||
name="quality"
|
||||
id="quality"
|
||||
bind:value={$playerDefaultPlaybackSpeed}
|
||||
onchange={onSpeedChange}
|
||||
>
|
||||
{#each playbackRates as speed}
|
||||
<option value={speed}>x{speed}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<label for="quality">{$_('layout.player.defaultPlaybackSpeed')}</label>
|
||||
<i>arrow_drop_down</i>
|
||||
</div>
|
||||
|
||||
{#if Capacitor.isNativePlatform()}
|
||||
<div class="field suffix border label">
|
||||
<select name="ytfallback" bind:value={localVideoFallback} onchange={onLocalVideoFallbackChange}>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export const playbackRates = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3];
|
||||
@@ -32,14 +32,15 @@ import {
|
||||
synciousInstanceStore,
|
||||
synciousStore,
|
||||
themeColorStore,
|
||||
interfaceAutoExpandChapters
|
||||
interfaceAutoExpandChapters,
|
||||
playerDefaultPlaybackSpeed
|
||||
} from '$lib/store';
|
||||
import { get, type Writable } from 'svelte/store';
|
||||
|
||||
const persistedStores: {
|
||||
name: string;
|
||||
store: Writable<any>;
|
||||
type: 'string' | 'boolean' | 'array';
|
||||
type: 'string' | 'boolean' | 'array' | 'number';
|
||||
}[] = [
|
||||
{
|
||||
name: 'returnYTDislikesInstance',
|
||||
@@ -205,6 +206,11 @@ const persistedStores: {
|
||||
name: 'autoExpandChapters',
|
||||
store: interfaceAutoExpandChapters,
|
||||
type: 'boolean'
|
||||
},
|
||||
{
|
||||
name: 'defaultPlaybackSpeed',
|
||||
store: playerDefaultPlaybackSpeed,
|
||||
type: 'number'
|
||||
}
|
||||
];
|
||||
|
||||
@@ -221,6 +227,8 @@ function setStores(toSet: Record<string, any>) {
|
||||
|
||||
if (store.type === 'array') {
|
||||
value = paramValue.split(',');
|
||||
} else if (store.type === 'number') {
|
||||
value = Number(paramValue);
|
||||
} else if (store.type === 'boolean') {
|
||||
value = typeof paramValue === 'string' ? paramValue === 'true' : paramValue;
|
||||
} else {
|
||||
|
||||
@@ -150,7 +150,8 @@
|
||||
"localVideoFallback": "Local video fallback",
|
||||
"youtubeJsFallback": "Local video processing fallback",
|
||||
"youtubeJsAlways": "Always use",
|
||||
"lockOrientation": "Orientation locked to aspect ratio"
|
||||
"lockOrientation": "Orientation locked to aspect ratio",
|
||||
"defaultPlaybackSpeed": "Default playback speed"
|
||||
},
|
||||
"bookmarklet": "Bookmarklet",
|
||||
"instanceUrl": "Instance URL",
|
||||
|
||||
@@ -46,6 +46,7 @@ export const playerYouTubeJsFallback = persisted('youTubeJsFallback', true);
|
||||
export const playerYouTubeJsAlways = persisted('youTubeJsAlways', false);
|
||||
export const playerAndroidLockOrientation = persisted('androidLockOrientation', true);
|
||||
export const playerDefaultLanguage = persisted('defaultLanguage', '');
|
||||
export const playerDefaultPlaybackSpeed: Writable<number> = persisted('defaultPlaybackSpeed', 1);
|
||||
|
||||
export const returnYtDislikesStore = persisted('returnYtDislikes', false);
|
||||
export const returnYTDislikesInstanceStore: Writable<string | null | undefined> = persisted(
|
||||
|
||||
Reference in New Issue
Block a user