$('#button-play').click(function() {
var ace_stream_url = $('#ace-stream-url').val();
var torrent_file_data = $.base64('decode', $('#torrent-file-data').val());
console.log("[" + ace_stream_url + "] get engine version");
$.ajax({
url: ace_stream_url + "/webui/api/service/",
data: {
method: "get_version",
format: "jsonp",
},
dataType: "jsonp",
timeout: 2000,
success: function(response, status) {
if (status === "success") {
if (response.error) {
console.log("error: " + response.error);
} else {
console.log("engine version: " + response.result.code);
}
} else {
console.log("object: %O", response)
}
var data = new FormData();
data.append('file', torrent_file_data);
console.log(ace_stream_url + "/server/api");
console.log("object: %O", data)
var callbackName = 'cb' + String(Math.random()).slice(-6);
$.ajax({
url: ace_stream_url + "/server/api/?method=get_available_players&format=jsonp&callback=get_available_players_callback",
method: "POST",
data: torrent_file_data,
dataType: "json: false",
success: function(response, status) {
if (status === "success") {
if (response.error) {
console.log("error: " + response.error);
}
} else {
console.log("object: %O", response)
}
},
error: function() {
console.log("get_available_players: request failed");
},
});
},
error: function(){
console.log("get engine version request failed");
}
});
});