mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-09 14:30:48 +00:00
Merge pull request #1265 from Stremio/refactor/player-volume-playback-speed-shortcuts
Some checks are pending
Build / build (push) Waiting to run
Some checks are pending
Build / build (push) Waiting to run
Dev: Merge player volume and playback speed shortcuts
This commit is contained in:
commit
9012a9aec8
4 changed files with 18 additions and 38 deletions
|
|
@ -41,7 +41,7 @@
|
|||
"react-i18next": "^15.7.4",
|
||||
"react-is": "18.3.1",
|
||||
"spatial-navigation-polyfill": "github:Stremio/spatial-navigation#64871b1422466f5f45d24ebc8bbd315b2ebab6a6",
|
||||
"stremio-translations": "github:Stremio/stremio-translations#5b00ce88c124eedfc34cba7f363dedeab38071d9",
|
||||
"stremio-translations": "github:Stremio/stremio-translations#c2d68dc590ac7d56f0df5e69a2144ba83e0d5ef0",
|
||||
"url": "0.11.4",
|
||||
"use-long-press": "^3.3.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ importers:
|
|||
specifier: github:Stremio/spatial-navigation#64871b1422466f5f45d24ebc8bbd315b2ebab6a6
|
||||
version: https://codeload.github.com/Stremio/spatial-navigation/tar.gz/64871b1422466f5f45d24ebc8bbd315b2ebab6a6
|
||||
stremio-translations:
|
||||
specifier: github:Stremio/stremio-translations#5b00ce88c124eedfc34cba7f363dedeab38071d9
|
||||
version: https://codeload.github.com/Stremio/stremio-translations/tar.gz/5b00ce88c124eedfc34cba7f363dedeab38071d9
|
||||
specifier: github:Stremio/stremio-translations#c2d68dc590ac7d56f0df5e69a2144ba83e0d5ef0
|
||||
version: https://codeload.github.com/Stremio/stremio-translations/tar.gz/c2d68dc590ac7d56f0df5e69a2144ba83e0d5ef0
|
||||
url:
|
||||
specifier: 0.11.4
|
||||
version: 0.11.4
|
||||
|
|
@ -4421,8 +4421,8 @@ packages:
|
|||
resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
stremio-translations@https://codeload.github.com/Stremio/stremio-translations/tar.gz/5b00ce88c124eedfc34cba7f363dedeab38071d9:
|
||||
resolution: {tarball: https://codeload.github.com/Stremio/stremio-translations/tar.gz/5b00ce88c124eedfc34cba7f363dedeab38071d9}
|
||||
stremio-translations@https://codeload.github.com/Stremio/stremio-translations/tar.gz/c2d68dc590ac7d56f0df5e69a2144ba83e0d5ef0:
|
||||
resolution: {tarball: https://codeload.github.com/Stremio/stremio-translations/tar.gz/c2d68dc590ac7d56f0df5e69a2144ba83e0d5ef0}
|
||||
version: 1.52.0
|
||||
|
||||
string-length@4.0.2:
|
||||
|
|
@ -10000,7 +10000,7 @@ snapshots:
|
|||
es-errors: 1.3.0
|
||||
internal-slot: 1.1.0
|
||||
|
||||
stremio-translations@https://codeload.github.com/Stremio/stremio-translations/tar.gz/5b00ce88c124eedfc34cba7f363dedeab38071d9: {}
|
||||
stremio-translations@https://codeload.github.com/Stremio/stremio-translations/tar.gz/c2d68dc590ac7d56f0df5e69a2144ba83e0d5ef0: {}
|
||||
|
||||
string-length@4.0.2:
|
||||
dependencies:
|
||||
|
|
|
|||
|
|
@ -55,14 +55,9 @@
|
|||
"combos": [["ArrowLeft"], ["Shift", "ArrowLeft"]]
|
||||
},
|
||||
{
|
||||
"name": "volumeUp",
|
||||
"label": "SETTINGS_SHORTCUT_VOLUME_UP",
|
||||
"combos": [["ArrowUp"]]
|
||||
},
|
||||
{
|
||||
"name": "volumeDown",
|
||||
"label": "SETTINGS_SHORTCUT_VOLUME_DOWN",
|
||||
"combos": [["ArrowDown"]]
|
||||
"name": "volume",
|
||||
"label": "SETTINGS_SHORTCUT_VOLUME",
|
||||
"combos": [["ArrowUp"], ["ArrowDown"]]
|
||||
},
|
||||
{
|
||||
"name": "mute",
|
||||
|
|
@ -80,14 +75,9 @@
|
|||
"combos": [["G"], ["H"]]
|
||||
},
|
||||
{
|
||||
"name": "speedDown",
|
||||
"label": "SETTINGS_SHORTCUT_DECREASE_PLAYBACK_SPEED",
|
||||
"combos": [["["]]
|
||||
},
|
||||
{
|
||||
"name": "speedUp",
|
||||
"label": "SETTINGS_SHORTCUT_INCREASE_PLAYBACK_SPEED",
|
||||
"combos": [["]"]]
|
||||
"name": "speed",
|
||||
"label": "SETTINGS_SHORTCUT_PLAYBACK_SPEED",
|
||||
"combos": [["["], ["]"]]
|
||||
},
|
||||
{
|
||||
"name": "toggleSubtitles",
|
||||
|
|
|
|||
|
|
@ -584,15 +584,10 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
video.state.muted === true ? onUnmuteRequested() : onMuteRequested();
|
||||
}, [video.state.muted], !menusOpen);
|
||||
|
||||
onShortcut('volumeUp', () => {
|
||||
onShortcut('volume', (combo) => {
|
||||
if (video.state.volume !== null) {
|
||||
onVolumeChangeRequested(Math.min(video.state.volume + 5, 200));
|
||||
}
|
||||
}, [video.state.volume], !menusOpen);
|
||||
|
||||
onShortcut('volumeDown', () => {
|
||||
if (video.state.volume !== null) {
|
||||
onVolumeChangeRequested(Math.max(video.state.volume - 5, 0));
|
||||
const volume = combo === 0 ? Math.min(video.state.volume + 5, 200) : Math.max(video.state.volume - 5, 0);
|
||||
onVolumeChangeRequested(volume);
|
||||
}
|
||||
}, [video.state.volume], !menusOpen);
|
||||
|
||||
|
|
@ -617,15 +612,10 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
}
|
||||
}, [video.state.playbackSpeed, toggleSpeedMenu]);
|
||||
|
||||
onShortcut('speedUp', () => {
|
||||
onShortcut('speed', (combo) => {
|
||||
if (video.state.playbackSpeed !== null) {
|
||||
onPlaybackSpeedChanged(Math.min(video.state.playbackSpeed + 0.25, 2));
|
||||
}
|
||||
}, [video.state.playbackSpeed, onPlaybackSpeedChanged], !menusOpen);
|
||||
|
||||
onShortcut('speedDown', () => {
|
||||
if (video.state.playbackSpeed !== null) {
|
||||
onPlaybackSpeedChanged(Math.max(video.state.playbackSpeed - 0.25, 0.25));
|
||||
const speed = combo === 0 ? Math.max(video.state.playbackSpeed - 0.25, 0.25) : Math.min(video.state.playbackSpeed + 0.25, 2);
|
||||
onPlaybackSpeedChanged(speed);
|
||||
}
|
||||
}, [video.state.playbackSpeed, onPlaybackSpeedChanged], !menusOpen);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue