Android:audio: little fix when loading sound or music
authorBlackMinou <romain.chanoir@viacesi.fr>
Thu, 10 Sep 2015 09:28:51 +0000 (11:28 +0200)
committerBlackMinou <romain.chanoir@viacesi.fr>
Thu, 10 Sep 2015 09:28:51 +0000 (11:28 +0200)
Signed-off-by: BlackMinou <romain.chanoir@viacesi.fr>

lib/android/audio.nit

index b729219..b361b4f 100644 (file)
@@ -138,7 +138,6 @@ private extern class NativeMediaPlayer in "Java" `{ android.media.MediaPlayer `}
                        self.setDataSource(fd, start_offset, length);
                        return 1;
                }catch(Exception e) {
-                       Log.e("Error loading the Media Player with a file descriptor", e.getMessage());
                        return 0;
                }
        `}
@@ -537,8 +536,8 @@ redef class Sound
        end
 
        redef fun play do
-               if self.error != null then return
                if not is_loaded then load
+               if self.error != null then return
                soundpool.play(soundpool_id)
        end
 
@@ -599,8 +598,8 @@ redef class Music
        end
 
        redef fun play do
-               if self.error != null then return
                if not is_loaded then load
+               if self.error != null then return
                media_player.start
        end