Added getYouTubeVideoStartTime

This commit is contained in:
Official Noob
2019-08-04 19:06:07 +01:00
committed by GitHub
parent e6fa832cb8
commit 5ee279dec7

View File

@@ -9,3 +9,14 @@ function getYouTubeVideoID(url) { // Returns with video id else returns false
return (match && match[7].length == 11) ? id : false;
}
//returns the start time of the video if there was one specified (ex. ?t=5s)
function getYouTubeVideoStartTime(url) {
let searchParams = new URL(url).searchParams;
var startTime = searchParams.get("t");
if (startTime == null) {
startTime = searchParams.get("time_continue");
}
return startTime;
}