Closed fxedel closed 6 years ago
YouTube and vimeo allow strings like 1h23m45s as value for their time parameter in video urls (e.g. https://www.youtube.com/watch?v=_FvgGrI6pe4&t=1m5s and https://vimeo.com/283459050#t=2m15s). It would be nice if embetty-vue would also support them as possible value for start-at.
1h23m45s
start-at
The YouTube iframe needs a single positive integer, though. Parsing could be done like this:
const timeRegex = /^(?:(\d+)h|)(?:(\d+)m|)(?:(\d+)s|)$/; const timeMatch = query.t.match(timeRegex); if (timeMatch) { // '1m16s' -> timeMatch = ['1m16s', undefined, '1', '16'] // '1h23m45s' -> timeMatch = ['1h23m45s', '1', '2', '34'] const [hours, minutes, seconds] = timeMatch.slice(1, 4).map(val => { if (val === undefined) { return 0; } return parseInt(val); }); const startAt = (hours * 3600) + (minutes * 60) + seconds; }
Closed by 92f30ca9dcec8ab2389881a517e764b8fd3b30ab in version 0.4.0.
YouTube and vimeo allow strings like
1h23m45s
as value for their time parameter in video urls (e.g. https://www.youtube.com/watch?v=_FvgGrI6pe4&t=1m5s and https://vimeo.com/283459050#t=2m15s). It would be nice if embetty-vue would also support them as possible value forstart-at
.The YouTube iframe needs a single positive integer, though. Parsing could be done like this: