Since we already kept the playing index in this.currentIndex and you are not using targetIndex to retrieve the file, targetIndex seems unnecessary here.