JSFiddle - React, Tailwind, and code Playground

by musicreader

JavaScript

var video_url="https://www.mrsync.com/functions/help_video_info.php?reference=cqQhYntxWS";
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function() {
                if (xhr.readyState == 4) {
                    // The request is done; did it work?
                    if (xhr.status == 200) {
                        eval("var video_info =" + xhr.responseText+";");

                        var mp4_url=undefined;
                        video_info.sources.forEach(function(source){
                            if(source.type=="mp4"){
                                mp4_url=source.file;
                            }
                        });
                        var srt_url=undefined;
                        video_info.tracks.forEach(function(track){
                            if(typeof track.file!="undefined" && track.file.endsWith(".srt")){
                                srt_url=track.file;
                            }
                        });

                        alert(srt_url);
                    }
                }
            };
            xhr.open("GET", video_url);
            xhr.send();