notify the user about too many soundcloud cdn fuck ups

This commit is contained in:
lone-cloud 2015-11-22 11:44:34 -08:00
parent 3d7ef2e864
commit d68d9b3e15
2 changed files with 22 additions and 10 deletions

View file

@ -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));

View file

@ -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'),