// var audios = []; var NQ = true; var cd = true; var tracktype = 0; var playPause = false; var blockVisible = false; var CanPlaySong = false; var StopPressed = false; var EndedTrigger = true; var SortNextSongBool = false; var KPlaying = false; audio.addEventListener("ended", function () { if(audio.currentTime > 1){ var FinishForGood = 0; var CarryForExtra = setInterval(function(){ if(FinishForGood == 100){ clearInterval(CarryForExtra); } zer = zer + 10; FinishForGood++; draw(); }, 10); $(".complete").addClass("pl_waiting").removeClass("complete"); $(".activenow").addClass("pl_waiting").removeClass("activenow"); $(".pagegroup").removeClass("active"); $(".pagegroup").first().addClass("active"); $(".seektime").width(0 + "%"); NQ = true; SortNextSongBool = true; $(".playerwrap").html(""); if($(".playwr.notvenue").length > 0) { $(".wrap.remove").addClass("playing"); $(".playwr.notvenue").fadeOut(500); } if (typeof karaokesongended == 'function') { karaokesongended(); } } }); $.fn.loadPlayer = function (options) { var settings = jQuery.extend({ TrackId: '0', CustomerId: '0', PlayButton: 'fa-play', PauseButton: 'fa-pause', StopButton: 'fa-stop', ResetButton: 'fa-backward', SkipButton: 'fa-skip', TrackLocation: 'https://www.karaoke.co.uk/canvasplayerskin/default.aspx/GetTrackLyrics', Delay: 0, Adjustment: 0, AutoPlay: 1, MasterVolume: 1, LocalTrack: 0, LocalTrackFile: '' }, options); if($(".playercss").length == 0){ $('head').append(''); } //$(".playerwrap").css("height", $(".playerwrap").parent().height() + "px").css("width", $(".playerwrap").parent().width() + "px"); $(".playerwrap").css("height", "100%").css("width", "100%"); if(settings.AutoPlay == 1){ setTimeout(function(){ if($(".pagegroup.startinggroup:visible").length > 0){ var newindex = $(".pagegroup:visible").index() + 1; //.removeClass("active"); $(".pagegroup").removeClass("active"); if($(".pagegroup").eq(newindex).find(".textgroup span").length == 0){ newindex++; } $(".pagegroup").eq(newindex).addClass("active"); } }, 10000); } if($(".playwr.notvenue").length > 0) { if(!$(".playwr.notvenue").is(":visible")) { $(".playwr.notvenue").show(); } } var pw = $(".playerwrap").width(); if(pw < 300){$(".playerwrap").addClass("less300");} if(pw < 500 && pw > 300){$(".playerwrap").addClass("less500");} if(pw < 640 && pw > 500){$(".playerwrap").addClass("less640");} if(pw < 720 && pw > 640){$(".playerwrap").addClass("less720");} if(pw < 960 && pw > 720){$(".playerwrap").addClass("less960");} if(pw < 1200 && pw > 960){$(".playerwrap").addClass("less1200");} if($(".playwr.notvenue").length > 0) { $(".playwr.notvenue").hide(); } //StopPlayingAll(); playPause = false; blockVisible = false; var second = 0; var oldsecond = 0; var ccc = 0; var oldseek = 0; var newseek = 0; var mincount = 0; var view = 0; var Blankemp3 = 'data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU2LjM2LjEwMAAAAAAAAAAAAAAA//OEAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAEAAABIADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV6urq6urq6urq6urq6urq6urq6urq6urq6v////////////////////////////////8AAAAATGF2YzU2LjQxAAAAAAAAAAAAAAAAJAAAAAAAAAAAASDs90hvAAAAAAAAAAAAAAAAAAAA//MUZAAAAAGkAAAAAAAAA0gAAAAATEFN//MUZAMAAAGkAAAAAAAAA0gAAAAARTMu//MUZAYAAAGkAAAAAAAAA0gAAAAAOTku//MUZAkAAAGkAAAAAAAAA0gAAAAANVVV'; var TopAnimateHeight = $(window).height(); var htmlblock = this; (function (undefined) { var $ = function (id) { return document.getElementById(id); }; var fillText = function (ctx, text, right, vertal, width) { ctx.fillText(text, right, vertal, width); }; var canvas = document.getElementById('playercanvas'); var ctx = canvas.getContext('2d'); var textMetrics; canvas.style.width='100%'; canvas.style.height='100%'; canvasSize(); var ratio = PIXEL_RATIO; ctx.scale(ratio, ratio); var PIXEL_RATIO = (function () { var ctx = document.createElement("canvas").getContext("2d"), dpr = window.devicePixelRatio || 1, bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1; return dpr / bsr; })(); function canvasSize() { var ratio = PIXEL_RATIO; canvas.width = (canvas.offsetWidth * ratio); canvas.height = (canvas.offsetHeight * ratio); } function FindCorrectColour(ColourGroup, act, ColourChart) { switch (ColourGroup) { case "15": if(act == 1){ return ColourChart.text1; } else{ return ColourChart.text2; } break; case "14": if(act == 1){ return ColourChart.text3; } else{ return ColourChart.text4; } break; case "13": if(act == 1){ return ColourChart.text5; } else{ return ColourChart.text6; } break; default: return "#FFFFFF"; break; } } var LastEndTime = 0; var LastElement = 0; var CountdownGoing = false; draw = function () { canvasSize(); var ColourChart = JSON.parse(PlayerColours); var FontSize = 2 * canvas.width / 40; var width; var oldwidth; var row = 0; var group; var RowTicker = 0; oldwidth = 0; var clearH = FontSize; var clearY = 0; var clearX = 0; if (ColourChart.backgroundimage) { jQuery(".svgbrandcol").css("fill", "#fff"); } else{ var bgrgb = hexToRgb(ColourChart.background1); var bgbrightscore = brightness(bgrgb.r, bgrgb.g, bgrgb.b); if (bgbrightscore < 123) { jQuery(".svgbrandcol").css("fill", "#fff"); } else { jQuery(".svgbrandcol").css("fill", "#000"); } } ctx.textAlign = "center"; ctx.textBaseline = 'middle'; ctx.fillStyle = ColourChart.text1; ctx.strokeStyle = ColourChart.outline1; ctx.lineWidth=4; if(FontSize < 30){ctx.lineWidth=1;} ctx.font = "700 " + FontSize + "px 'proxima-nova', arial"; var CheckHowManyRows = 0; for (var i = 0, l = TextArray.length; i < l; i++) { if (zer > TextArray[i].EndTime) { if(TextArray.length - 1 > (i + 1)){ Group = TextArray[i + 1].Group; } } } var RowAmountForGroup = 0; for (var i = 0, l = TextRow.length; i < l; i++) { if (Group == TextRow[i].Group) { RowAmountForGroup++; } } ctx.translate(canvas.width / 2, (canvas.height / 2) - ((FontSize / 2) * RowAmountForGroup)); for (var i = 0, l = TextRow.length; i < l; i++) { var RowCoord = (RowTicker) * (FontSize + (FontSize / (RowAmountForGroup < 4 ? RowAmountForGroup : 4))); if (Group == TextRow[i].Group) { ctx.fillStyle = FindCorrectColour(TextRow[i].ColourGroup, 1, ColourChart); ctx.strokeText(TextRow[i].LyricLine, 0, RowCoord); //fillText(ctx, TextRow[i].LyricLine, 0, RowCoord); ctx.fillText(TextRow[i].LyricLine, 0, RowCoord, ctx.measureText(TextRow[i].LyricLine).width); RowTicker++; } } RowTicker = 0; var OldGroup = 0; for (var i = 0, l = TextArray.length; i < l; i++) { if (Group == TextArray[i].Group) { if(Group != OldGroup) { RowTicker = 0; OldGroup = Group; } else{ if (row != TextArray[i].Row) { oldwidth = 0; RowTicker++; } } textMetrics = ctx.measureText(TextArray[i].Lyric); width = textMetrics.width; var RowCoord = (RowTicker) * (FontSize + (FontSize / (RowAmountForGroup < 4 ? RowAmountForGroup : 4))); var StartingWidth = 0; ctx.fillStyle = ColourChart.text1; var TimerCountdown = 1000; if(i == 0 || LastElement + 1 == i && LastElement != 0) { if(TextArray[i].StartTime - TimerCountdown > LastEndTime) { if(zer > TextArray[i].StartTime - TimerCountdown) { for (var z = 0, p = TextRow.length; z < p; z++) { if ((TextArray[i].Row) == TextRow[z].Row && (TextArray[i].Group) == TextRow[z].Group) { textMetrics = ctx.measureText(TextRow[z].LyricLine); } } StartingWidth = (- (textMetrics.width / 2)) + oldwidth; var CurrentCompletion = 0; EndWidth = ((width) / 100 * CurrentCompletion); var CurrentCountdownTime = (TextArray[i].StartTime - zer); /* if(CurrentCountdownTime < 3000 && CurrentCountdownTime > 2000) { CurrentCompletion = (50 / 100 * ((CurrentCountdownTime - 2000) / 10)); ctx.fillRect((StartingWidth - 150) + (50 - CurrentCompletion), (RowCoord - (FontSize / 2)), 2, (FontSize)); } if(CurrentCountdownTime < 1999 && CurrentCountdownTime > 1000) { CurrentCompletion = (50 / 100 * ((CurrentCountdownTime - 1000) / 10)); ctx.fillRect((StartingWidth - 100) + (50 - CurrentCompletion), (RowCoord - (FontSize / 2)), 2, (FontSize)); } if(CurrentCountdownTime < 999 && CurrentCountdownTime > 0) { CurrentCompletion = (50 / 100 * ((CurrentCountdownTime) / 10)) ctx.fillRect((StartingWidth - 50) + (50 - CurrentCompletion), (RowCoord - (FontSize / 2)), 2, (FontSize)); }*/ if(CurrentCountdownTime < 3000 ) { CurrentCompletion = (100 / 100 * ((CurrentCountdownTime) / 10)); ctx.fillRect((StartingWidth - 100) + (100 - CurrentCompletion), (RowCoord - (FontSize / 2)), 2, (FontSize)); } } } } if (zer > TextArray[i].StartTime) { for (var z = 0, p = TextRow.length; z < p; z++) { if ((TextArray[i].Row) == TextRow[z].Row && (TextArray[i].Group) == TextRow[z].Group) { textMetrics = ctx.measureText(TextRow[z].LyricLine); } } StartingWidth = textMetrics.width; var EndWidth = 0; var RealStartWidth = 0; if (zer < TextArray[i].EndTime) { var CurrentCompletion = 100 * (zer - TextArray[i].StartTime) / (TextArray[i].EndTime - TextArray[i].StartTime); EndWidth = ((width) / 100 * CurrentCompletion); RealStartWidth = (-(StartingWidth / 2)) + oldwidth; ctx.fillStyle = FindCorrectColour(TextArray[i].ColourGroup, 3, ColourChart); // ctx.fillRect(RealStartWidth + EndWidth, (RowCoord - (FontSize / 2)), 2, (FontSize)); LastEndTime = TextArray[i].EndTime; LastElement = i; } else{ EndWidth = oldwidth + width + 5; RealStartWidth = (-(StartingWidth / 2)) ; ctx.fillStyle = FindCorrectColour(TextArray[i].ColourGroup, 2, ColourChart); } ctx.save(); ctx.beginPath(); //ctx.clearRect(RealStartWidth, (RowCoord - (FontSize / 2)), EndWidth, (FontSize)); ctx.rect(RealStartWidth - 5, (RowCoord - (FontSize / 2)), EndWidth, (FontSize) + (FontSize / 10) ); ctx.clip(); ctx.textAlign = "left"; ctx.fillText(TextArray[i].Lyric, (-(StartingWidth / 2)) + oldwidth, RowCoord, width); //fillText(ctx, TextArray[i].Lyric, (-(StartingWidth / 2)) + oldwidth, RowCoord, width); //ctx.strokeStyle = ColourChart.outline1; // ctx.lineWidth=2; if(FontSize < 30){ctx.lineWidth=1;} //ctx.strokeText(TextArray[i].Lyric, (-(StartingWidth / 2)) + oldwidth, RowCoord, width); if (zer < TextArray[i].EndTime && ColourChart.switchgradient != "off" && 1 == 2) { var gradient=ctx.createLinearGradient(RealStartWidth + EndWidth - 60, 0, RealStartWidth + EndWidth, 0); var BackgroundRGB = PlayerHexToRgb(ColourChart.background1); gradient.addColorStop("0", "rgba(" + BackgroundRGB.r + ", " + BackgroundRGB.g + ", " + BackgroundRGB.b + ",0)"); gradient.addColorStop("1", "rgba(" + BackgroundRGB.r + ", " + BackgroundRGB.g + ", " + BackgroundRGB.b + ",0.8)"); ctx.fillStyle = gradient; ctx.fillRect(RealStartWidth + EndWidth - 60, (RowCoord - (FontSize / 2)), 60, (FontSize)); } ctx.restore(); //Blob Above text /* if (zer < TextArray[i].EndTime) { var topset = (FontSize) + 20; var bottomset = (FontSize) + 30; var PixelPerPercent = ((bottomset - topset) / 100); var PositionOfCircle = PixelPerPercent * CurrentCompletion; if(CurrentCompletion < 50){ PositionOfCircle = PixelPerPercent * (CurrentCompletion * 2); }else { PositionOfCircle = PixelPerPercent * ((100 - CurrentCompletion) * 2); } ctx.fillStyle = FindCorrectColour(TextArray[i].ColourGroup, 3, ColourChart); ctx.fillRect(RealStartWidth + EndWidth - 10, (RowCoord - (FontSize) + PositionOfCircle), 20, 20); }*/ //Blob Above text END oldwidth = oldwidth + width; } row = TextArray[i].Row; } } }; })(); function TriggerText(SectionRun) { var animateheight = TopAnimateHeight; SectionRun.removeClass("pl_waiting"); var chars = SectionRun.html().split(""); var StartingTime = SectionRun.attr("data-start"); if(!SectionRun.parents(".pagegroup").hasClass("active")){ $(".pagegroup").removeClass("active"); SectionRun.parents(".pagegroup").addClass("active"); } var right = SectionRun.width() $(".activenow").addClass("complete").removeClass("activenow"); SectionRun.addClass("activenow"); var TopMove = SectionRun.parents(".line").position().top; var TotalWindow = $(window).height(); } function TrackCurrentTime() { if(!EndedTrigger) { requestAnimationFrame(TrackCurrentTime.bind(this)); if (ccc == 0) { ccc = 1; } second = this.currentTime; zer = (second * 1000); draw(); var seekbar = (this.currentTime / this.duration) * 100; $(".seektime").width(seekbar + "%"); $(".trackstatus").html("Playing "); //PassCurrentTime = second; /*if (second != oldsecond) { if($(".pagegroup:visible").find(".pl_waiting").length == 0){ if(parseInt($(".pagegroup:visible").find(".activenow").attr("data-end") - settings.Adjustment) < ((second * 1000))) { var newindex = $(".pagegroup:visible").index() + 1; //.removeClass("active"); $(".pagegroup").removeClass("active"); $(".pagegroup").eq(newindex).addClass("active"); } } $("#lyrics span.pl_waiting").filter(function () { return ($(this).attr("data-start") - settings.Adjustment) <= (second * 1000); }).each(function () { TriggerText($(this)); }); }*/ //oldsecond = second; /* newseek = parseInt(this.currentTime); if (newseek > oldseek) { mincount++; oldseek = newseek; if (mincount % 5 == 0) { kStatMin(settings.TrackId, 5, "CCD26B33-4F2A-4FA8-B173-DB9A294E74B5"); if (view == 1) { if (mincount >= (parseInt(this.currentTime) - 5)) { kStat(settings.TrackId, "A346FE94-42CE-4328-9A2C-E4CF6D15187B", "Video", "Watched", "", "", this.currentTime, "paused", "", "", "1"); } else { kStatMin(settings.TrackId, 5, "60D39CB0-3990-4A84-9EF1-3C4CE0950D87"); } } } } if (newseek >= 40) { if (view == 0) { view = 1; kStat(settings.TrackId, "60D39CB0-3990-4A84-9EF1-3C4CE0950D87", "Video", "Viewed", "", "", this.currentTime, "paused", "", "", "1"); kStatMin(settings.TrackId, 30, "60D39CB0-3990-4A84-9EF1-3C4CE0950D87"); } }*/ } } function AddTrack(name) { CanPlaySong = false; audio.loop = false; audio.preload = "auto"; var num = 0; audio.src = name; audio.onplaying = function() { onplaying = true; onpause = false; EndedTrigger = false; }; audio.oncanplay = function(e) { CanPlaySong = true; } audio.onpause = function() { onplaying = false; onpause = true; EndedTrigger = true; }; if(settings.AutoPlay == 1){ setTimeout(function(){ if(!StopPressed){ StartPlayingAll(); } }, settings.Delay); } } function PlayerHexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; } $(".queue").on("click", "." + settings.PauseButton, function () { PausePlayingAll(); }); $(".queue").on("click", "." + settings.PlayButton, function () { if($(".playwr.notvenue").length > 0) { if(!$(".playwr.notvenue").is(":visible")) { $(".wrap.queue, .queuebg").addClass("playing"); } } if(PausedState == 1){ StartPlayingAll();} }); $(document).one("click", "." + settings.StopButton, function () { TextArray = []; TextRow = []; PausedState = 1; if($(".playwr.notvenue").length > 0) { $(".wrap.remove").addClass("playing"); $(".wrap.queue, .queuebg").removeClass("playing"); $(".playwr.notvenue").fadeOut(500); } StopPlayingAll(); $(".seektime").width(0 + "%"); }); $(document).one("click", "." + settings.ResetButton, function () { ResetPlayingAll(); }); $(document).one("click", "." + settings.SkipButton, function () { TextArray = []; TextRow = []; StopPlayingAll(); NQ = true; SortNextSongBool = true; playPause = false; $(".nowplaying").removeClass("p"); $(".trackstatus").html("Loading..."); $(".seektime").width(0 + "%"); if (typeof karaokesongended == 'function') { karaokesongended(); } }); $(document).on("click", ".seek", function (event) { //var seekbar = (this.currentTime / audio.duration) * 100; var Percentage = (event.pageX / $(this).width()) * 100; var NewSeekPosition = ((audio.duration / 100) * Percentage); audio.currentTime = NewSeekPosition; }); function RemoveAllAudio() { $(".complete").addClass("pl_waiting").removeClass("complete"); $(".activenow").addClass("pl_waiting").removeClass("activenow"); $(".pagegroup").removeClass("active"); $(".pagegroup").first().addClass("active"); if(audio){ if (!audio.paused && !onpause) { audio.currentTime = 0; audio.pause(); audio.src = Blankemp3; } } } function StopPlayingAll() { $("." + settings.PauseButton).hide(); $("." + settings.PlayButton).css("display", "inline-block"); if ($(".playercontrols").length > 0) { PlayerControls = $(".playercontrols").clone().wrap('
').parent().html(); } $(".trackstatus").html("Loading..."); $(".nowplaying").removeClass("p"); EndedTrigger = true; $(".complete").addClass("pl_waiting").removeClass("complete"); $(".activenow").addClass("pl_waiting").removeClass("activenow"); $(".pagegroup").removeClass("active"); $(".pagegroup").first().addClass("active"); if(audio){ if (!audio.paused && !onpause) { audio.currentTime = 0; audio.pause(); } } } function StartPlayingAll() { $("." + settings.PlayButton).hide(); $("." + settings.PauseButton).css("display", "inline-block"); if($(".wrap.queue").length > 0) { $(".trackstatus").html("Playing"); $(".nowplaying").addClass("p"); } PausedState = 0; var isPlaying = audio.currentTime > 0 && !audio.paused && !audio.ended && audio.readyState > 2; if (!isPlaying) { //audio.volume = 1; audio.volume = settings.MasterVolume; audio.play(); EndedTrigger = false; TrackCurrentTime.call(audio); } if (!audio.paused && !onpause) { var timetostop = setInterval(function(){ if (!audio.paused && !onpause) { //Its playing...do your job $(".showplaybut").hide(); } else { $(".showplaybut").show(); } clearInterval(timetostop); }, 1000); }else{ $(".showplaybut").hide(); } } function PausePlayingAll() { $("." + settings.PauseButton).hide(); $("." + settings.PlayButton).css("display", "inline-block"); $(".trackstatus").html("Paused"); PausedState = 1; onplaying = false; if(audio){ if (!audio.paused && !onpause) { audio.pause(); } } } function SkipPlayingAll(){ } function ResetPlayingAll() { $(".complete").addClass("pl_waiting").removeClass("complete"); $(".activenow").addClass("pl_waiting").removeClass("activenow"); $(".pagegroup").removeClass("active"); $(".pagegroup").first().addClass("active"); if(audio){ if (!audio.paused && !onpause) { audio.pause(); } if (audio.paused && !onplaying) { //audio.volume = 1; audio.volume = settings.MasterVolume; audio.play(); EndedTrigger = false; TrackCurrentTime.call(audio); } } } var kStat = function (video, type, object, event, eventfrom, eventto, currenttime, state, name, filename, val11) { var d = new Date(); var jdate = d.getFullYear() + "-" + d.getMonth() + "-" + d.getDay() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "." + d.getMilliseconds(); //$.ajax({ // type: "POST", // contentType: "application/json; charset=utf-8", // url: 'https://www.karaoke.co.uk/player/videoplayer.aspx/VideoEvent', // data: '{"Val1" : "' + video + '", "Val2" : "' + type + '", "Val3" : "' + object + '", "Val4" : "' + event + '", "Val5" : "' + eventfrom + '", "Val6" : "' + eventto + '", "Val7" : "' + state + '", "Val8" : "' + currenttime + '", "Val9" : "' + name + '", "Val10" : "' + filename + '", "Val11" : "' + val11 + '", "Val12" : "NO QUEUE SENT"}', // dataType: "json", // success: function (msg) { // }, error: function () { // } //}); }; var kStatMin = function (video, num, type) { //$.ajax({ // type: "POST", // contentType: "application/json; charset=utf-8", // url: 'https://www.karaoke.co.uk/player/videoplayer.aspx/VideoSeconds', // data: '{"Val1" : "' + video + '", "Val2" : "' + num + '", "Val3" : "' + type + '"}', // dataType: "json", // success: function (msg) { // // }, error: function () { // // } //}); }; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: settings.TrackLocation, data: '{ "TrackGuid":"' + settings.TrackId + '", "Type": "1"}', dataType: "json", success: function (msg) { if(msg.d.length > 0){ htmlblock.html(""); htmlblock.html(msg.d[0].PlayerLayout); $(".brandinglogo").html(msg.d[0].PlayerBranding); $('img.svg').each(function () { var $img = $(this); var imgID = $img.attr('id'); var imgClass = $img.attr('class'); var imgURL = $img.attr('src'); $.get(imgURL, function (data) { // Get the SVG tag, ignore the rest var $svg = $(data).find('svg'); // Add replaced image's ID to the new SVG if (typeof imgID !== 'undefined') { $svg = $svg.attr('id', imgID); } // Add replaced image's classes to the new SVG if (typeof imgClass !== 'undefined') { $svg = $svg.attr('class', imgClass + ' replaced-svg'); } // Remove any invalid XML tags as per http://validator.w3.org $svg = $svg.removeAttr('xmlns:a'); // Replace image with new SVG $img.replaceWith($svg); }, 'xml'); }); tracktype = msg.d[0].PlayerType; if(tracktype == 1){ settings.Delay = msg.d[0].PlayerDelay; settings.Adjustment = msg.d[0].PlayerAdjustment; if(settings.LocalTrack == 1){ AddTrack(settings.LocalTrackFile); } else{ AddTrack(msg.d[0].SongMp3Location); } $(".pagegroup").first().addClass("active"); } TextArray = []; TextRow = []; if (msg.d.length > 0) { for (var i = 0; i < msg.d[0].LyricRowFull.length; i++) { TextArray.push({ "Lyric": msg.d[0].LyricRowFull[i].Lyric, "StartTime": (msg.d[0].LyricRowFull[i].StartTime - settings.Adjustment), "EndTime": (msg.d[0].LyricRowFull[i].EndTime - settings.Adjustment), "ColourGroup": msg.d[0].LyricRowFull[i].ColourGroup, "Group": msg.d[0].LyricRowFull[i].Group, "Row": msg.d[0].LyricRowFull[i].Row, "PixelEndpoint": "", "PixelStartpoint": "" }); } for (var i = 0; i < msg.d[0].LyricLineByLineFull.length; i++) { TextRow.push({ "LyricLine" : msg.d[0].LyricLineByLineFull[i].Lyric, "Group": msg.d[0].LyricLineByLineFull[i].Group, "Row": msg.d[0].LyricLineByLineFull[i].Row, "ColourGroup": msg.d[0].LyricLineByLineFull[i].ColourGroup }); } Group = 1; } } else{NQ = true;} } }); };