Skip to content

Commit

Permalink
Temporary important fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Xogy committed Jun 1, 2020
1 parent 9bd1bdb commit dd2d466
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
1 change: 0 additions & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<body>
<script src="./scripts/functions.js" type="text/javascript"></script>
<script src="./scripts/SoundPlayer.js" type="text/javascript"></script>
<script src="./scripts/config.js" type="text/javascript"></script>
<script src="./scripts/listener.js" type="text/javascript"></script>
</body>
</html>
26 changes: 16 additions & 10 deletions html/scripts/SoundPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class SoundPlayer
if(this.max_volume > (this.volume - 0.01)) this.volume = this.max_volume;
if(!this.isYoutube)
{
this.audioPlayer.volume(result);
if(this.audioPlayer != null) this.audioPlayer.volume(result);
}
else
{
Expand All @@ -113,6 +113,8 @@ class SoundPlayer
this.audioPlayer = new Howl({
src: [this.getUrlSound()],
loop: this.isLoop(),
html5: true,
format: ['mp3'],
onend: function(event){
ended(null);
}
Expand Down Expand Up @@ -181,8 +183,10 @@ class SoundPlayer
{
if(!this.isYoutube)
{
this.audioPlayer.volume(this.getVolume());
this.audioPlayer.play();
if(this.audioPlayer != null){
this.audioPlayer.volume(this.getVolume());
this.audioPlayer.play();
}
}
else
{
Expand All @@ -193,7 +197,7 @@ class SoundPlayer
{
if(!this.isYoutube)
{
this.audioPlayer.pause();
if(this.audioPlayer != null) this.audioPlayer.pause();
}
else
{
Expand All @@ -205,7 +209,7 @@ class SoundPlayer
{
if(!this.isYoutube)
{
this.audioPlayer.play();
if(this.audioPlayer != null) this.audioPlayer.play();
}
else
{
Expand All @@ -215,15 +219,17 @@ class SoundPlayer

delete()
{
this.audioPlayer.pause();
this.audioPlayer = null;
if(this.audioPlayer != null){
this.audioPlayer.pause();
this.audioPlayer = null;
}
}

mute ()
{
if(!this.isYoutube)
{
this.audioPlayer.volume(0);
if(this.audioPlayer != null) this.audioPlayer.volume(0);
}
else
{
Expand All @@ -234,7 +240,7 @@ class SoundPlayer
{
if(!this.isYoutube)
{
this.audioPlayer.volume(this.getVolume());
if(this.audioPlayer != null) this.audioPlayer.volume(this.getVolume());
}
else
{
Expand All @@ -246,7 +252,7 @@ class SoundPlayer
{
if(!this.isYoutube)
{
return this.audioPlayer.playing();
return this.audioPlayer != null && this.audioPlayer.playing();
}
return false;
}
Expand Down

0 comments on commit dd2d466

Please sign in to comment.