Update external-player-map.json: Add basic support for external SMPlayer#3771
Update external-player-map.json: Add basic support for external SMPlayer#3771FreeTubeBot merged 5 commits intoFreeTubeApp:developmentfrom trostboot:development
Conversation
Adds basic functionality to open videos in SMPlayer. Adding more parameters (e.g., startOffset or speed) is not possible at this time as SMPlayer expects different formatting compared to what FreeTube currently passes through.
|
How do you normally set the start offset from the cli with SMPlayer for YouTube videos? |
|
By passing the -start switch with the desired offset, e.g. Setting startOffset to "-start " does not work as it's parsed as a separate input URL.
vs invoking it from a terminal:
Other options differ more substantially as they would have to be passed via the -actions switch, e.g. |
|
This patch seems to be getting the start offset to work for me diff --git a/src/renderer/store/modules/utils.js b/src/renderer/store/modules/utils.js
index 1f4edda9..454c5936 100644
--- a/src/renderer/store/modules/utils.js
+++ b/src/renderer/store/modules/utils.js
@@ -523,7 +523,12 @@ const actions = {
if (payload.watchProgress > 0 && payload.watchProgress < payload.videoLength - 10) {
if (typeof cmdArgs.startOffset === 'string') {
- args.push(`${cmdArgs.startOffset}${payload.watchProgress}`)
+ if (cmdArgs.startOffset.endsWith('=')) {
+ args.push(`${cmdArgs.startOffset}${payload.watchProgress}`)
+ } else {
+ // special handling for SMPlayer and similar
+ args.push(cmdArgs.startOffset, payload.watchProgress)
+ }
} else if (!ignoreWarnings) {
showExternalPlayerUnsupportedActionToast(externalPlayer, 'starting video at offset')
}
diff --git a/static/external-player-map.json b/static/external-player-map.json
index f77ae13c..0885eb40 100644
--- a/static/external-player-map.json
+++ b/static/external-player-map.json
@@ -69,7 +69,7 @@
"supportsYtdlProtocol": true,
"videoUrl": "",
"playlistUrl": "",
- "startOffset": null,
+ "startOffset": "-start",
"playbackRate": null,
"playlistIndex": null,
"playlistReverse": null, |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
|
I can confirm that works. I've added it to this PR, hope you don't mind. |
If watchProgress contains a non-integer value, SMPlayer will simply parse it as 0. Thus, truncate it before passing it along.
Head branch was pushed to by a user without write access
|
I don't mind at all 😊 |
Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
Head branch was pushed to by a user without write access
PikachuEXE
left a comment
There was a problem hiding this comment.
Math.trunc might only be applicable for SMPlayer
But I have no better alternative yet
|
@PikachuEXE Well, the question that needs to be asked is if there is any value in passing along fractions of a second to begin with. If you open a link to an external player from within the Freetube video player with some amount of progress in a video, it will only pass on integer seconds, so I would assume there is some truncating already going on somewhere. If indeed the behaviour of the player page is the desired behaviour, then my fix is just a band-aid and this should probably be handled further up the chain. |
|
I have no idea what But I am fine with a band-aid for one player, we can fix it more properly when more external players added |
|
Thanks @trostboot for contributing! If u are interested there are more issues open to support external players so u might want to look into that. |
Add basic functionality to open videos in SMPlayer
Pull Request Type
Related issue
closes #2231
Description
Adds basic functionality to open videos in SMPlayer.
Adding more parameters (e.g., startOffset or speed) is not possible at this time as SMPlayer expects different formatting compared to what FreeTube currently passes through.
Screenshots
Testing
Testing has been done on Windows 11 x64 only.
Desktop
Additional context