push fixing changes
This commit is contained in:
parent
ed67ac61cb
commit
699e2e4e3c
2 changed files with 50 additions and 25 deletions
|
|
@ -43,7 +43,8 @@
|
||||||
<center>
|
<center>
|
||||||
<img src="getie3.gif" alt="IE Logo" width="88" height="31"><br><br>
|
<img src="getie3.gif" alt="IE Logo" width="88" height="31"><br><br>
|
||||||
<img src="getnet3.gif" alt="Netscape Logo" width="88" height="31"><br><br>
|
<img src="getnet3.gif" alt="Netscape Logo" width="88" height="31"><br><br>
|
||||||
<font size="1">Free and open software</font>
|
<font size="1">Free and open software</font><br><br>
|
||||||
|
<font size="1">made by binimum</font>
|
||||||
</center>
|
</center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,13 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Global functions exposed for inline onclicks
|
// Global functions exposed for inline onclicks
|
||||||
window.playTrack = function (id) {
|
// Global functions exposed for inline onclicks
|
||||||
|
window.playTrack = function (id, attemptFallback) {
|
||||||
|
var quality = attemptFallback ? "HIGH" : "LOSSLESS";
|
||||||
apiRequest(
|
apiRequest(
|
||||||
"/track/?id=" + id + "&quality=HIGH",
|
"/track/?id=" + id + "&quality=" + quality,
|
||||||
function (data) {
|
function (data) {
|
||||||
|
var success = false;
|
||||||
if (data && data.data && data.data.manifest) {
|
if (data && data.data && data.data.manifest) {
|
||||||
try {
|
try {
|
||||||
var manifestStr = base64Decode(data.data.manifest);
|
var manifestStr = base64Decode(data.data.manifest);
|
||||||
|
|
@ -53,20 +56,32 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTrackInfo.length) {
|
if (currentTrackInfo.length) {
|
||||||
currentTrackInfo.html("Now Playing...");
|
var qualityLabel = attemptFallback ? " (AAC)" : " (FLAC)";
|
||||||
|
currentTrackInfo.html("Now Playing..." + qualityLabel);
|
||||||
}
|
}
|
||||||
} else {
|
success = true;
|
||||||
alert("No stream URLs found.");
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert("Error parsing playback manifest: " + e.message);
|
// Fall through to fallback
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
alert("Invalid track data received.");
|
|
||||||
|
if (!success) {
|
||||||
|
if (!attemptFallback) {
|
||||||
|
// Try fallback to HIGH (AAC)
|
||||||
|
window.playTrack(id, true);
|
||||||
|
} else {
|
||||||
|
alert("No stream URLs found or invalid manifest.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function (err) {
|
function (err) {
|
||||||
alert("Error playing track: " + err);
|
if (!attemptFallback) {
|
||||||
|
// Try fallback to HIGH (AAC) on request error too
|
||||||
|
window.playTrack(id, true);
|
||||||
|
} else {
|
||||||
|
alert("Error playing track: " + err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
@ -201,23 +216,32 @@ $(document).ready(function () {
|
||||||
finalUrl = "http://" + finalUrl.substring(8);
|
finalUrl = "http://" + finalUrl.substring(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
try {
|
||||||
url: finalUrl + endpoint,
|
$.ajax({
|
||||||
method: "GET",
|
url: finalUrl + endpoint,
|
||||||
dataType: "json",
|
method: "GET",
|
||||||
success: function (data) {
|
dataType: "json",
|
||||||
success(data);
|
success: function (data) {
|
||||||
},
|
success(data);
|
||||||
error: function (xhr, status, err) {
|
},
|
||||||
if (!isHttpFallback) {
|
error: function (xhr, status, errorThrown) {
|
||||||
isHttpFallback = true;
|
if (!isHttpFallback && window.location.protocol !== "https:") {
|
||||||
// Retry with fallback logic (recursive call will pick up isHttpFallback)
|
isHttpFallback = true;
|
||||||
apiRequest(endpoint, success, error);
|
// Retry with fallback logic (recursive call will pick up isHttpFallback)
|
||||||
|
apiRequest(endpoint, success, error);
|
||||||
|
} else {
|
||||||
|
error("Request Failed: " + status + " (" + errorThrown + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (!isHttpFallback && window.location.protocol !== "https:") {
|
||||||
|
isHttpFallback = true;
|
||||||
|
apiRequest(endpoint, success, error);
|
||||||
} else {
|
} else {
|
||||||
error("Request Failed: " + status);
|
error("Exception: " + e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function playWithEmbed(url) {
|
function playWithEmbed(url) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue