notify the user about too many soundcloud cdn fuck ups
This commit is contained in:
parent
d1099a2db2
commit
62ef43611e
2 changed files with 22 additions and 10 deletions
|
|
@ -148,24 +148,32 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
|
|||
audio.crossOrigin = "anonymous";
|
||||
audio.oncanplay = ()=>{
|
||||
this.set('timeTotal', Math.floor(audio.duration));
|
||||
this.set('soundCloudFuckUps', 0);
|
||||
};
|
||||
audio.onerror = (event)=>{
|
||||
var playQueuePointer =this.get('playQueuePointer'),
|
||||
song = this.get('playQueue')[playQueuePointer];
|
||||
|
||||
if(song.local){
|
||||
this.send('removeAudio', playQueuePointer);
|
||||
if(this.get('soundCloudFuckUps') >= this.get('maxSoundCloudFuckUps')) {
|
||||
this.get('notify').alert({html: this.get('tooManySoundCloudFuckUps')});
|
||||
this.send('play');
|
||||
this.set('soundCloudFuckUps', 0);
|
||||
} else {
|
||||
this.send('next', true);
|
||||
}
|
||||
if(song.local){
|
||||
this.send('removeAudio', playQueuePointer);
|
||||
} else {
|
||||
this.send('next', true);
|
||||
}
|
||||
|
||||
if(event.target.error.code === 2){
|
||||
this.get('notify').alert({html: this.get('failedToDecodeFileHtml')(song.fileName)});
|
||||
} else {
|
||||
this.get('notify').alert({html: this.get('failedToPlayFileHtml')(song.fileName)});
|
||||
}
|
||||
if(event.target.error.code === 2){
|
||||
this.get('notify').alert({html: this.get('failedToDecodeFileHtml')(song.fileName)});
|
||||
} else {
|
||||
this.get('notify').alert({html: this.get('failedToPlayFileHtml')(song.fileName)});
|
||||
}
|
||||
|
||||
this.set('usingBeatPreferences', false);
|
||||
this.set('usingBeatPreferences', false);
|
||||
this.incrementProperty('soundCloudFuckUps');
|
||||
}
|
||||
};
|
||||
audio.ontimeupdate = ()=>{
|
||||
this.set('timeElapsed', Math.floor(audio.currentTime));
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ export default Em.Mixin.create({
|
|||
SC_CLIENT_ID: 'aeec0034f58ecd85c2bd1deaecc41594',
|
||||
notFoundHtml: '<div class="alert alert-danger" role="alert">A microphone was not found.</div>',
|
||||
scUserNotSupportedHtml: '<div class="alert alert-danger" role="alert">SoundCloud user URLs are not supported.</div>',
|
||||
tooManySoundCloudFuckUps: '<div class="alert alert-danger" role="alert">The SoundCloud API is not seving the audio properly. More details <a href="https://www.soundcloudcommunity.com/soundcloud/topics/some-soundcloud-cdn-hosted-tracks-dont-have-access-control-allow-origin-header" target="_blank">HERE</a>.</div>',
|
||||
notStreamableHtml(fileNames){
|
||||
var html = '<div class="alert alert-danger" role="alert">The following file(s) could not be added because they are not allowed to be streamed:<br>' + fileNames.toString().replace(/,/g, '<br>') + '</div>';
|
||||
|
||||
|
|
@ -142,6 +143,9 @@ export default Em.Mixin.create({
|
|||
ambienceWorkedLights: [],
|
||||
ambienceWorkedLightsHandles: {},
|
||||
|
||||
soundCloudFuckUps: 0,
|
||||
maxSoundCloudFuckUps: 3,
|
||||
|
||||
largeArtworkPic: function(){
|
||||
var pic = null,
|
||||
currentVisName = this.get('currentVisName'),
|
||||
|
|
|
|||
Reference in a new issue