mirror of https://github.com/FreeTubeApp/FreeTube
Update external-player-map.json: Add basic support for external SMPlayer (#3771)
* Update external-player-map.json: Add basic support for external SMPlayer 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. * Update utils.js: Add special startOffset handling for SMPlayer * Update external-player-map.json: Add startOffset for SMPlayer * Update utils.js: Truncate startOffset for SMPlayer If watchProgress contains a non-integer value, SMPlayer will simply parse it as 0. Thus, truncate it before passing it along. * Update utils.js: startOffset comments Co-authored-by: PikachuEXE <pikachuexe@gmail.com> --------- Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
This commit is contained in:
parent
dbb8ed0e55
commit
18b758ffaa
|
@ -523,7 +523,15 @@ 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('=')) {
|
||||
// For players using `=` in arguments
|
||||
// e.g. vlc --start-time=xxxxx
|
||||
args.push(`${cmdArgs.startOffset}${payload.watchProgress}`)
|
||||
} else {
|
||||
// For players using space in arguments
|
||||
// e.g. smplayer -start xxxxx
|
||||
args.push(cmdArgs.startOffset, Math.trunc(payload.watchProgress))
|
||||
}
|
||||
} else if (!ignoreWarnings) {
|
||||
showExternalPlayerUnsupportedActionToast(externalPlayer, 'starting video at offset')
|
||||
}
|
||||
|
|
|
@ -58,5 +58,23 @@
|
|||
"playlistShuffle": "--mpv-shuffle",
|
||||
"playlistLoop": "--mpv-loop-playlist"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "SMPlayer",
|
||||
"nameTranslationKey": "Settings.External Player Settings.Players.SMPlayer.Name",
|
||||
"value": "smplayer",
|
||||
"cmdArguments": {
|
||||
"defaultExecutable": "smplayer",
|
||||
"defaultCustomArguments": null,
|
||||
"supportsYtdlProtocol": true,
|
||||
"videoUrl": "",
|
||||
"playlistUrl": "",
|
||||
"startOffset": "-start",
|
||||
"playbackRate": null,
|
||||
"playlistIndex": null,
|
||||
"playlistReverse": null,
|
||||
"playlistShuffle": null,
|
||||
"playlistLoop": null
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue