diff --git a/Grayjay.ClientServer/Settings/GrayjaySettings.cs b/Grayjay.ClientServer/Settings/GrayjaySettings.cs index a14606e..dbaa620 100644 --- a/Grayjay.ClientServer/Settings/GrayjaySettings.cs +++ b/Grayjay.ClientServer/Settings/GrayjaySettings.cs @@ -188,6 +188,9 @@ public int GetPreferredQualityPixelCount() return (int)(height * (16 / (double)9)) * height; } + [SettingsField("Max Buffer", SettingsField.DROPDOWN, "How long to buffer", 3)] + [SettingsDropdownOptions("10s", "30s", "1m", "2m", "3m", "5m", "10m", "20m", "1h", "5h")] + public int MaxBuffer { get; set; } = 2; /* [SettingsField("Preferred Preview Quality", SettingsField.DROPDOWN, "Default qaulity while previewing a video in a feed", 4)] diff --git a/Grayjay.Desktop.Web/src/components/player/VideoPlayerView/index.tsx b/Grayjay.Desktop.Web/src/components/player/VideoPlayerView/index.tsx index 94fab7f..97ea116 100644 --- a/Grayjay.Desktop.Web/src/components/player/VideoPlayerView/index.tsx +++ b/Grayjay.Desktop.Web/src/components/player/VideoPlayerView/index.tsx @@ -489,7 +489,7 @@ const VideoPlayerView: Component = (props) => { setResumePositionVisible(visible); }); - const changeSource = (sourceUrl?: string, mediaType?: string, shouldResume?: boolean, startTime?: Duration) => { + const changeSource = async (sourceUrl?: string, mediaType?: string, shouldResume?: boolean, startTime?: Duration) => { console.info("changeSource", {sourceUrl, mediaType, shouldResume, startTime}); setIsAudioOnly(false); @@ -557,10 +557,18 @@ const VideoPlayerView: Component = (props) => { if (mediaType === 'application/dash+xml' && !videoElement.canPlayType(mediaType)) { dashPlayer = dashjs.MediaPlayer().create(); + let maxBuffer=(await SettingsBackend.settings())?.object?.playback?.maxBuffer; + maxBuffer=[10,30,60,120,180,300,600,1200,3600,18000][maxBuffer]; dashPlayer.updateSettings({ streaming: { text: { dispatchForManualRendering: true + }, + buffer: { + bufferToKeep: maxBuffer, + stableBufferTime: maxBuffer, + bufferTimeAtTopQuality: maxBuffer, + bufferTimeAtTopQualityLongForm: maxBuffer, } } });