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