Skip to content

Commit

Permalink
feat: added remember quality selection
Browse files Browse the repository at this point in the history
The last quality chosen is now persistent across the app
  • Loading branch information
aymanmostafa11 committed Oct 11, 2024
1 parent 8b9e0c2 commit 6f73cdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/renderer/components/player/VideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
hls.attachMedia(videoRef.current);
hls.on(Hls.Events.MANIFEST_PARSED, () => {
if (videoRef.current) {
hls.currentLevel = hls.levels.length - 1;
const savedQuality = STORE.get('last_quality');
hls.currentLevel = savedQuality !== undefined ? savedQuality as number : hls.levels.length - 1;

playVideoAndSetTime();
setHlsData(hls);
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/player/VideoSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const VideoSettings = forwardRef<HTMLDivElement, SettingsProps>(
const handleQualityChange = (index: number) => {
if (hlsData) {
hlsData.currentLevel = index;
STORE.set("last_quality", index);
}
};

Expand Down

0 comments on commit 6f73cdb

Please sign in to comment.