private static Uri extendUrl(Uri url, String urlExtension) {
        urlExtension = urlExtension.replace(" ", "%20"); // Convert spaces

        Uri newUrl = Uri.parse(urlExtension);

        if(newUrl.isRelative()) {
            /* Uri.withAppendedPath appends the extension to the end of the "real" server path,
             * instead of the end of the uri string.
             * Example: http://server.com/foo?file=http://server2.net/ + file1.mp4
             *           => http://server.com/foo/file1.mp4?file=http://server2.net/
             * To avoid this, we need to join as strings instead. */
            newUrl = Uri.parse(url.toString() + urlExtension);
        }
        return newUrl;
    }
Extends an URL with an extended path if the extension is relative, or replaces the entire URL
with the extension if it is absolute.
MediaPlayer-DASH/src/main/java/net/protyposis/android/mediaplayer/dash/DashParser.java