How can I specify the path to the .json file in html, and so that the text works there and is displayed on the screen?

  • 0
    I need to connect json (file) to html. And so that the text is displayed on the screen, and the side will indicate:

    {
     "startTime":"1000", (Это пример таймкода)
     "text":"I love you baby",
     "Lineend":"*" (0 будет означать что оно не будет делать новую строку. 1 будет означать что будет переход в начало нового текста.)
    }


    But I want to be used with src: (if possible). Or with fetch.

    But I already have:

    var audio = new Audio();
    audio.src = "http://mus.com/song.mp3";
    audio.play();
    var lirycs = [{
    "time": 5444,
    "duration": 121,
    "text": "Top ",
    "isLineEnding": 0
    },
    {
    "time": 6000,
    "duration": 121,
    "text": "Top2 ",
    "isLineEnding": 0
    }];
    var next_text = lirycs.shift();
    var checker = setInterval(function(){
        if(next_text.time<audio.currentTime*1000){
            console.log(next_text.text);
            next_text = lirycs.shift();
        }
        if(audio.ended)clearInterval(checker);
    });
    (And I want to use dson in this script not just like in the script, but to take timecodes by src: or using fetch.
    JavaScript Wyatt Stone, Feb 23, 2019

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!