mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Better handling of errors in videos, only removing if an error is found, else a regular skip is performed
This commit is contained in:
@@ -345,6 +345,7 @@ var Player = {
|
||||
Player.soundcloud_player.bind("finish", Player.soundcloudFinish);
|
||||
Player.soundcloud_player.bind("pause", Player.soundcloudPause);
|
||||
Player.soundcloud_player.bind("play", Player.soundcloudPlay);
|
||||
Player.soundcloud_player.bind("error", Player.soundcloudError);
|
||||
window.player = player;
|
||||
Player.soundcloud_dead = false;
|
||||
SC_player.get('/tracks', {
|
||||
@@ -355,16 +356,19 @@ var Player = {
|
||||
document.querySelector("#soundcloud_listen_link").href = sound.permalink_url;
|
||||
document.querySelector(".soundcloud_info_container .green").href = sound.user.permalink_url;
|
||||
//document.querySelector(".soundcloud_info_container .red").href = sound.user.permalink_url;
|
||||
}).catch(function(){});
|
||||
}).catch(function(e){});
|
||||
if(_autoplay) {
|
||||
player.play().then(function(){
|
||||
Player.soundcloud_player.setVolume(embed ? 1 : Crypt.get_volume() / 100);
|
||||
Player.soundcloud_player.seek((seekTo) * 1000);
|
||||
}).catch(function(e){
|
||||
});
|
||||
}).catch(function(e){});
|
||||
}
|
||||
}).catch(function(error) {
|
||||
Player.initializeSCWidget(_autoplay, id);
|
||||
if(error.status == 404) {
|
||||
Player.errorHandler({data: 5});
|
||||
} else {
|
||||
Player.initializeSCWidget(_autoplay, id);
|
||||
}
|
||||
});
|
||||
//Player.initializeSCWidget(_autoplay, id);
|
||||
//Player.initializeSCWidget(_autoplay, id);
|
||||
@@ -401,6 +405,7 @@ var Player = {
|
||||
Player.soundcloud_player.unbind("finish", Player.soundcloudFinish);
|
||||
Player.soundcloud_player.unbind("pause", Player.soundcloudPause);
|
||||
Player.soundcloud_player.unbind("play", Player.soundcloudPlay);
|
||||
Player.soundcloud_player.unbind("error", Player.soundcloudError);
|
||||
//Player.soundcloud_player.unbind("seek", Player.soundcloudSeek);
|
||||
}catch(e){}
|
||||
var this_autoplay = "";
|
||||
@@ -418,10 +423,15 @@ var Player = {
|
||||
Player.soundcloud_player.bind("finish", Player.soundcloudFinish);
|
||||
Player.soundcloud_player.bind("pause", Player.soundcloudPause);
|
||||
Player.soundcloud_player.bind("play", Player.soundcloudPlay);
|
||||
Player.soundcloud_player.bind("error", Player.soundcloudError);
|
||||
Player.soundcloud_player.load('https://api.soundcloud.com/tracks/' + id + this_autoplay, {single_active: false});
|
||||
}
|
||||
},
|
||||
|
||||
soundcloudError: function() {
|
||||
Player.errorHandler({data: "5"});
|
||||
},
|
||||
|
||||
addSCWidgetElements: function() {
|
||||
try {
|
||||
Player.soundcloud_player = SC_widget.Widget(document.querySelector("#scplayerElement"));
|
||||
@@ -429,6 +439,7 @@ var Player = {
|
||||
Player.soundcloud_player.bind("finish", Player.soundcloudFinish);
|
||||
Player.soundcloud_player.bind("pause", Player.soundcloudPause);
|
||||
Player.soundcloud_player.bind("play", Player.soundcloudPlay);
|
||||
Player.soundcloud_player.bind("error", Player.soundcloudError);
|
||||
|
||||
SC_player.get('/tracks', {
|
||||
ids: id
|
||||
@@ -438,7 +449,8 @@ var Player = {
|
||||
document.querySelector("#soundcloud_listen_link").href = sound.permalink_url;
|
||||
document.querySelector(".soundcloud_info_container .green").href = sound.user.permalink_url;
|
||||
//document.querySelector(".soundcloud_info_container .red").href = sound.user.permalink_url;
|
||||
}).catch(function(){});
|
||||
}).catch(function(e){
|
||||
});
|
||||
} catch(e) {
|
||||
setTimeout(function() {
|
||||
Player.addSCWidgetElements();
|
||||
|
||||
Reference in New Issue
Block a user