From 38badea514cf12b0c33cf3e953a89ab2c28e887f Mon Sep 17 00:00:00 2001 From: David Russell Date: Fri, 9 Dec 2016 22:08:45 +0700 Subject: [PATCH] Added support for YouTube start and end play offsets. --- app/com/gitpitch/services/VideoService.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/com/gitpitch/services/VideoService.java b/app/com/gitpitch/services/VideoService.java index c1e94c0..8f6b97d 100644 --- a/app/com/gitpitch/services/VideoService.java +++ b/app/com/gitpitch/services/VideoService.java @@ -69,10 +69,17 @@ public class VideoService { * * Example link: * https://www.youtube.com/embed/mkiDkkdGGAQ + * + * Example link with offset start time: + * https://www.youtube.com/embed/mkiDkkdGGAQ?start=121 */ + + String ifrOps = (videoLink.contains("?")) ? + YTUBE_IFR_OPS_APPEND : YTUBE_IFR_OPS; + return new StringBuffer(YTUBE_DIV_OPEN).append(YTUBE_IFR_OPEN) .append(videoLink) - .append(YTUBE_IFR_OPS) + .append(ifrOps) .append(YTUBE_IFR_CLSE) .append(YTUBE_DIV_CLSE) .toString(); @@ -179,6 +186,7 @@ public class VideoService { private static final String YTUBE_DIV_OPEN = "
"; private static final String YTUBE_IFR_OPEN = ""; private static final String YTUBE_DIV_CLSE = "
"; /*