UNPKG

videojs-contrib-hls

Version:

Play back HLS with video.js, even where it's not natively supported

23 lines (17 loc) 552 B
/** * @file resolve-url.js */ import URLToolkit from 'url-toolkit'; import window from 'global/window'; const resolveUrl = function(baseURL, relativeURL) { // return early if we don't need to resolve if ((/^[a-z]+:/i).test(relativeURL)) { return relativeURL; } // if the base URL is relative then combine with the current location if (!(/\/\//i).test(baseURL)) { baseURL = URLToolkit.buildAbsoluteURL(window.location.href, baseURL); } return URLToolkit.buildAbsoluteURL(baseURL, relativeURL); }; export default resolveUrl;