diff --git a/src/renderer/helpers/utils.js b/src/renderer/helpers/utils.js index 697cec8c9c5e9..12871b1779bb6 100644 --- a/src/renderer/helpers/utils.js +++ b/src/renderer/helpers/utils.js @@ -611,7 +611,26 @@ export function getVideoParamsFromUrl(url) { function extractParams(videoId) { paramsObject.videoId = videoId - paramsObject.timestamp = urlObject.searchParams.get('t') + let timestamp = urlObject.searchParams.get('t') + if (timestamp && (timestamp.includes('h') || timestamp.includes('m') || timestamp.includes('s'))) { + const { seconds, minutes, hours } = timestamp.match(/(?:(?(\d+))h)?(?:(?(\d+))m)?(?:(?(\d+))s)?/).groups + let time = 0 + + if (seconds) { + time += Number(seconds) + } + + if (minutes) { + time += 60 * Number(minutes) + } + + if (hours) { + time += 3600 * Number(hours) + } + + timestamp = time + } + paramsObject.timestamp = timestamp } const extractors = [