From 88f5ccbc21694046f0d48620be898c90a09bee0e Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 31 Mar 2022 13:21:14 +0300 Subject: [PATCH] Update video.js --- sdk/src/video.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sdk/src/video.js b/sdk/src/video.js index fea50eb3..4ab373a0 100644 --- a/sdk/src/video.js +++ b/sdk/src/video.js @@ -24,14 +24,13 @@ class videoFetchManager{ var json = xmltojson.toJson(text); let parser = JSON.parse(json); const fetching = parser - var j = fetching.Player.Formats.Format - if(j[1].URL){ - var url = j[1].URL - } else if(j[1].URL){ - var s = j.formats - const lastItem = s[s.length - 1]; - var url = lastItem.URL - } + const j = fetching.Player.Formats.Format, + j_ = Array.isArray(j) + ? j[j.length - 1] + : j; +let url; +if (j_.URL != undefined) + url = j_.URL; return url } }