Skip to content

Commit

Permalink
Add comment to explain null value in AudioPlayerService. (oppia#4735)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjiang11 authored and seanlip committed Feb 24, 2018
1 parent e7bdfce commit c3e9a24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/templates/dev/head/services/AudioPlayerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ oppia.factory('AudioPlayerService', [
// to grab native audio.
// TODO(tjiang11): Look for a better way to handle this.
$timeout(function() {
// _currentTrack could be null if the learner stops audio
// shortly after loading a new card or language. In such
// cases, we do not want to attempt setting the 'onended'
// property of the audio.
if (_currentTrack !== null) {
_currentTrack.audio.onended = function() {
_currentTrack = null;
Expand Down

0 comments on commit c3e9a24

Please sign in to comment.