Added conditions to prevent breaking if no callback interface is defined.

This commit is contained in:
neviyn 2016-03-19 23:08:05 +00:00
parent 41e7de065e
commit 091126e2e2

View File

@ -67,6 +67,7 @@ public class GStreamerPlayer implements IPlayer{
} }
private void resetSeek(){ private void resetSeek(){
if(callbackInterface != null)
callbackInterface.setSeekBarPosition(0); callbackInterface.setSeekBarPosition(0);
} }
@ -106,6 +107,7 @@ public class GStreamerPlayer implements IPlayer{
while (true) { while (true) {
if (playBin.queryDuration().getSeconds() > 0 || playBin.queryDuration().getNanoSeconds() > 0) break; if (playBin.queryDuration().getSeconds() > 0 || playBin.queryDuration().getNanoSeconds() > 0) break;
} // Wait for song to actually be playing otherwise queryDuration is always zero } // Wait for song to actually be playing otherwise queryDuration is always zero
if(callbackInterface != null)
callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds()); callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds());
} }
else{ else{