diff --git a/app/index.html b/app/index.html index 840c533..b20695a 100644 --- a/app/index.html +++ b/app/index.html @@ -17,8 +17,8 @@ - - + + {{content-for 'head-footer'}} diff --git a/app/pods/components/music-tab/component.js b/app/pods/components/music-tab/component.js index 3783078..9601bd6 100644 --- a/app/pods/components/music-tab/component.js +++ b/app/pods/components/music-tab/component.js @@ -16,62 +16,17 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { }.observes('active'), actions: { - search: function(){ - var q = $('#query').val(), doSearch = function(){ - var request = gapi.client.youtube.search.list({ - q: q, - part: 'snippet', - key: 'AIzaSyAkwv6RD184j6o5wRfblYWNlV_njt6RXIc' - }); - - request.execute(function(response) { - var str = JSON.stringify(response.result); - $('#search-container').html('
' + str + ''); - }); - }; - if(!gapi.client.youtube){ - gapi.client.load('youtube', 'v3', doSearch); - } else { - doSearch(); - } - }, - useYoutubeAudio: function(){ - var audioStream = this.get('audioStream'); - - this.changePlayerControl('audioMode', 2); - - if(!Em.isNone(audioStream)){ - audioStream.stop(); - this.set('audioStream', null); - } - - var onPlayerReady = function(){ - console.log('ready'); - }, onPlayerStateChange = function(){ - console.log('onPlayerStateChange'); - }, onError = function(err){ - console.log('onError' + err.data); - }; - - var youtubePlayer = new YT.Player('playerArea', { - videoId: 'Mc8LjwZvxHw' - }); - - var audio = new Audio(), dancer = this.get('dancer'); - audio.src = "https://www.youtube.com/embed/Mc8LjwZvxHw?enablejsapi=1&origin=http%3A%2F%2Flocalhost%3A4200"; - dancer.load(audio); - dancer.play(); - - this.set('youtubePlayer', youtubePlayer); - document.title = 'Youtube - Huegasm'; - }, useLocalAudio: function(){ var audioStream = this.get('audioStream'); this.changePlayerControl('audioMode', 0); if(!Em.isNone(audioStream)){ audioStream.stop(); - this.set('audioStream', null); + + this.setProperties({ + audioStream: null, + playing: false + }); } if(this.get('playQueuePointer') !== -1) { @@ -82,7 +37,11 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { document.title = 'Huegasm'; }, useMicAudio() { - this.startUsingMic(); + if(this.get('usingMicAudio')) { + this.send('useLocalAudio'); + } else { + this.startUsingMic(); + } }, slideTogglePlayerBottom(){ this.changePlayerControl('playerBottomDisplayed', !this.get('playerBottomDisplayed')); @@ -337,7 +296,7 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { dancer.setVolume(0); }, (err) => { - if(err.name == 'DevicesNotFoundError'){ + if(err.name === 'DevicesNotFoundError'){ this.get('notify').alert({html: this.get('notFoundHtml')}); } @@ -559,9 +518,5 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { event.preventDefault(); } }); - - if(this.get('audioMode') === 2){ - this.send('useYoutubeAudio'); - } } }); diff --git a/app/pods/components/music-tab/mixins/music-tab.js b/app/pods/components/music-tab/mixins/music-tab.js index 0ff5795..823a85e 100644 --- a/app/pods/components/music-tab/mixins/music-tab.js +++ b/app/pods/components/music-tab/mixins/music-tab.js @@ -78,11 +78,10 @@ export default Em.Mixin.create({ lastLightBopIndex: 0, usingMicSupported: true, - // 0 - local, 1 - mic, 2 - youtube + // 0 - local, 1 - mic, possibly more to come audioMode: 0, usingLocalAudio: Em.computed.equal('audioMode', 0), usingMicAudio: Em.computed.equal('audioMode', 1), - usingYoutubeAudio: Em.computed.equal('audioMode', 2), playerBottomDisplayed: false, dragging: false, @@ -118,7 +117,6 @@ export default Em.Mixin.create({ paused: false, // audio: playing or paused playing: false, - youtubePlayer: null, fadeOutNotification: false, speakerViewed: true, @@ -167,6 +165,14 @@ export default Em.Mixin.create({ } }, + micIcon: function () { + if (this.get('usingMicAudio')) { + return 'mic'; + } + + return 'mic-off'; + }.property('usingMicAudio'), + repeatIcon: function () { if (this.get('repeat') === 2) { return 'repeat-one'; @@ -207,10 +213,6 @@ export default Em.Mixin.create({ return this.get('usingMicAudio') ? 'playerControllIcon active' : 'playerControllIcon'; }.property('usingMicAudio'), - usingYoutubeAudioClass: function() { - return this.get('usingYoutubeAudio') ? 'playerControllIcon active' : 'playerControllIcon'; - }.property('usingYoutubeAudio'), - repeatClass: function () { return this.get('repeat') !== 0 ? 'playerControllIcon active' : 'playerControllIcon'; }.property('repeat'), @@ -320,9 +322,9 @@ export default Em.Mixin.create({ beatDetectionArrowIcon: function(){ if(!this.get('playerBottomDisplayed')){ - return 'angle-double-down'; + return 'keyboard-arrow-down'; } else { - return 'angle-double-up'; + return 'keyboard-arrow-up'; } }.property('playerBottomDisplayed'), diff --git a/app/pods/components/music-tab/template.hbs b/app/pods/components/music-tab/template.hbs index b4ed025..80606ef 100644 --- a/app/pods/components/music-tab/template.hbs +++ b/app/pods/components/music-tab/template.hbs @@ -1,15 +1,14 @@
{{{item}}}
- {{/each}} -{{{item}}}
+ {{/each}} +