From b206c5245d89bc0a2f788ed92aa8096478e9edf9 Mon Sep 17 00:00:00 2001 From: Philip Eichinski Date: Thu, 23 Nov 2017 16:11:04 +1000 Subject: [PATCH] fix(audioButtons): fixed bug stopping play and pause buttons from working due to model functions being attached to audio element from previous page --- src/app/audio/bawAudio.js | 15 ++----------- src/app/audio/ngAudio.js | 21 +++++++------------ .../citizenScience/bristlebird/bristlebird.js | 3 --- .../bristlebird/listen.tpl.html | 18 +++++++--------- .../datasetProgress/datasetProgress.js | 10 +++++++-- 5 files changed, 25 insertions(+), 42 deletions(-) diff --git a/src/app/audio/bawAudio.js b/src/app/audio/bawAudio.js index b8de0835..d03bf177 100644 --- a/src/app/audio/bawAudio.js +++ b/src/app/audio/bawAudio.js @@ -5,24 +5,13 @@ angular.module("bawApp.audio.bawAudio", []) controller: [ "$scope", "$route", - function ($scope, $route) { + "$timeout", + function ($scope, $route, $timeout) { var self = this; $scope.audioElementModel = self.audioElementModel; - /** - * Reload audio when the source changes. Without this it won't change the audio - * even though the src attribute changes - */ - $scope.$watch("media", function () { - console.log("new media loaded"); - document.querySelector("audio").load(); - //$route.reload(); - }); - - - }], bindings: { audioElementModel: "=", diff --git a/src/app/audio/ngAudio.js b/src/app/audio/ngAudio.js index f6032160..ab8fa08f 100644 --- a/src/app/audio/ngAudio.js +++ b/src/app/audio/ngAudio.js @@ -31,6 +31,7 @@ angular.module("bawApp.directives.ngAudio", [ restrict: "A", link: function (scope, elements, attributes, controller) { var element = elements[0]; + if (element.nodeName !== "AUDIO") { throw "Cannot put ngAudio element on an element that is not a